Add Cosmos support to Utils and SDK (#2859)
Co-authored-by: J M Rossy <jm.rossy@gmail.com> Co-authored-by: Nam Chu Hoai <nambrot@googlemail.com> Co-authored-by: Kunal Arora <55632507+aroralanuk@users.noreply.github.com>pull/2896/head
parent
34afc967e8
commit
4c49f6179a
@ -0,0 +1,2 @@ |
||||
typescript/sdk/src/cw-types/*.types.ts linguist-generated=true |
||||
rust/chains/hyperlane-ethereum/abis/*.abi.json linguist-generated=true |
@ -0,0 +1,184 @@ |
||||
import { ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; |
||||
|
||||
import { Address, HexString } from '@hyperlane-xyz/utils'; |
||||
|
||||
import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp'; |
||||
import { |
||||
Coin, |
||||
DefaultHookResponse, |
||||
DefaultIsmResponse, |
||||
ExecuteMsg, |
||||
LatestDispatchedIdResponse, |
||||
MessageDeliveredResponse, |
||||
NonceResponse, |
||||
OwnerResponse, |
||||
QueryMsg, |
||||
RequiredHookResponse, |
||||
} from '../../cw-types/Mailbox.types'; |
||||
import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; |
||||
import { |
||||
ProviderType, |
||||
TypedTransactionReceipt, |
||||
} from '../../providers/ProviderType'; |
||||
import { ChainName } from '../../types'; |
||||
|
||||
import { ICoreAdapter } from './types'; |
||||
|
||||
type MailboxResponse = |
||||
| DefaultHookResponse |
||||
| RequiredHookResponse |
||||
| DefaultIsmResponse |
||||
| NonceResponse |
||||
| LatestDispatchedIdResponse |
||||
| OwnerResponse |
||||
| MessageDeliveredResponse; |
||||
|
||||
export class CosmWasmCoreAdapter |
||||
extends BaseCosmWasmAdapter |
||||
implements ICoreAdapter |
||||
{ |
||||
constructor( |
||||
public readonly chainName: ChainName, |
||||
public readonly multiProvider: MultiProtocolProvider<any>, |
||||
public readonly addresses: { mailbox: Address }, |
||||
) { |
||||
super(chainName, multiProvider, addresses); |
||||
} |
||||
|
||||
prepareMailbox(msg: ExecuteMsg, funds?: Coin[]): ExecuteInstruction { |
||||
return { |
||||
contractAddress: this.addresses.mailbox, |
||||
msg, |
||||
funds, |
||||
}; |
||||
} |
||||
|
||||
initTransferOwner(newOwner: Address): ExecuteInstruction { |
||||
return this.prepareMailbox({ |
||||
ownable: { |
||||
init_ownership_transfer: { |
||||
next_owner: newOwner, |
||||
}, |
||||
}, |
||||
}); |
||||
} |
||||
|
||||
claimTransferOwner(): ExecuteInstruction { |
||||
return this.prepareMailbox({ |
||||
ownable: { |
||||
claim_ownership: {}, |
||||
}, |
||||
}); |
||||
} |
||||
|
||||
setDefaultHook(address: Address): ExecuteInstruction { |
||||
return this.prepareMailbox({ |
||||
set_default_hook: { |
||||
hook: address, |
||||
}, |
||||
}); |
||||
} |
||||
|
||||
setRequiredHook(address: Address): ExecuteInstruction { |
||||
return this.prepareMailbox({ |
||||
set_required_hook: { |
||||
hook: address, |
||||
}, |
||||
}); |
||||
} |
||||
|
||||
async queryMailbox<R extends MailboxResponse>(msg: QueryMsg): Promise<R> { |
||||
const provider = await this.getProvider(); |
||||
const response: R = await provider.queryContractSmart( |
||||
this.addresses.mailbox, |
||||
msg, |
||||
); |
||||
return response; |
||||
} |
||||
|
||||
async defaultHook(): Promise<string> { |
||||
const response = await this.queryMailbox<DefaultHookResponse>({ |
||||
mailbox: { |
||||
default_hook: {}, |
||||
}, |
||||
}); |
||||
return response.default_hook; |
||||
} |
||||
|
||||
async defaultIsm(): Promise<string> { |
||||
const response = await this.queryMailbox<DefaultIsmResponse>({ |
||||
mailbox: { |
||||
default_ism: {}, |
||||
}, |
||||
}); |
||||
return response.default_ism; |
||||
} |
||||
|
||||
async requiredHook(): Promise<string> { |
||||
const response = await this.queryMailbox<RequiredHookResponse>({ |
||||
mailbox: { |
||||
required_hook: {}, |
||||
}, |
||||
}); |
||||
return response.required_hook; |
||||
} |
||||
|
||||
async nonce(): Promise<number> { |
||||
const response = await this.queryMailbox<NonceResponse>({ |
||||
mailbox: { |
||||
nonce: {}, |
||||
}, |
||||
}); |
||||
return response.nonce; |
||||
} |
||||
|
||||
async latestDispatchedId(): Promise<string> { |
||||
const response = await this.queryMailbox<LatestDispatchedIdResponse>({ |
||||
mailbox: { |
||||
latest_dispatch_id: {}, |
||||
}, |
||||
}); |
||||
return response.message_id; |
||||
} |
||||
|
||||
async owner(): Promise<string> { |
||||
const response = await this.queryMailbox<OwnerResponse>({ |
||||
ownable: { |
||||
get_owner: {}, |
||||
}, |
||||
}); |
||||
return response.owner; |
||||
} |
||||
|
||||
async delivered(id: string): Promise<boolean> { |
||||
const response = await this.queryMailbox<MessageDeliveredResponse>({ |
||||
mailbox: { |
||||
message_delivered: { |
||||
id, |
||||
}, |
||||
}, |
||||
}); |
||||
return response.delivered; |
||||
} |
||||
|
||||
extractMessageIds( |
||||
sourceTx: TypedTransactionReceipt, |
||||
): Array<{ messageId: string; destination: ChainName }> { |
||||
if (sourceTx.type !== ProviderType.CosmJsWasm) { |
||||
throw new Error( |
||||
`Unsupported provider type for CosmosCoreAdapter ${sourceTx.type}`, |
||||
); |
||||
} |
||||
// TODO: parse mailbox logs and extract message ids
|
||||
throw new Error('Method not implemented.'); |
||||
} |
||||
|
||||
async waitForMessageProcessed( |
||||
_messageId: HexString, |
||||
_destination: ChainName, |
||||
_delayMs?: number, |
||||
_maxAttempts?: number, |
||||
): Promise<void> { |
||||
throw new Error('Method not implemented.'); |
||||
} |
||||
} |
@ -0,0 +1,142 @@ |
||||
import { ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; |
||||
|
||||
import { Address } from '@hyperlane-xyz/utils'; |
||||
|
||||
import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp'; |
||||
import { |
||||
BeneficiaryResponse, |
||||
DefaultGasResponse, |
||||
DomainsResponse, |
||||
GetExchangeRateAndGasPriceResponse, |
||||
OwnerResponse, |
||||
QueryMsg, |
||||
QuoteGasPaymentResponse, |
||||
RouteResponseForAddr, |
||||
RoutesResponseForAddr, |
||||
} from '../../cw-types/Igp.types'; |
||||
import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; |
||||
import { ChainMap, ChainName } from '../../types'; |
||||
|
||||
// TODO: import more
|
||||
type IgpResponse = |
||||
| OwnerResponse |
||||
| BeneficiaryResponse |
||||
| DomainsResponse |
||||
| GetExchangeRateAndGasPriceResponse |
||||
| RoutesResponseForAddr |
||||
| RouteResponseForAddr |
||||
| DefaultGasResponse |
||||
| QuoteGasPaymentResponse; |
||||
|
||||
export class CosmWasmIgpAdapter extends BaseCosmWasmAdapter { |
||||
constructor( |
||||
public readonly chainName: ChainName, |
||||
public readonly multiProvider: MultiProtocolProvider<any>, |
||||
public readonly addresses: { igp: Address }, |
||||
) { |
||||
super(chainName, multiProvider, addresses); |
||||
} |
||||
|
||||
async queryIgp<R extends IgpResponse>(msg: QueryMsg): Promise<R> { |
||||
const provider = await this.getProvider(); |
||||
const response: R = await provider.queryContractSmart( |
||||
this.addresses.igp, |
||||
msg, |
||||
); |
||||
return response; |
||||
} |
||||
|
||||
async owner(): Promise<string> { |
||||
const response = await this.queryIgp<OwnerResponse>({ |
||||
ownable: { |
||||
get_owner: {}, |
||||
}, |
||||
}); |
||||
return response.owner; |
||||
} |
||||
|
||||
async beneficiary(): Promise<string> { |
||||
const beneficiaryResponse: BeneficiaryResponse = await this.queryIgp({ |
||||
igp: { |
||||
beneficiary: {}, |
||||
}, |
||||
}); |
||||
return beneficiaryResponse.beneficiary; |
||||
} |
||||
|
||||
async getOracles(): Promise<ChainMap<Address>> { |
||||
const domainResponse: RoutesResponseForAddr = await this.queryIgp({ |
||||
router: { |
||||
list_routes: {}, |
||||
}, |
||||
}); |
||||
|
||||
return Object.fromEntries( |
||||
domainResponse.routes.map((_) => [ |
||||
this.multiProvider.getChainName(_.domain), |
||||
_.route ?? '', |
||||
]), |
||||
); |
||||
} |
||||
|
||||
async defaultGas(): Promise<number> { |
||||
const defaultGas = await this.queryIgp<DefaultGasResponse>({ |
||||
igp: { |
||||
default_gas: {}, |
||||
}, |
||||
}); |
||||
return defaultGas.gas; |
||||
} |
||||
|
||||
async getOracleData( |
||||
chain: ChainName, |
||||
): Promise<GetExchangeRateAndGasPriceResponse> { |
||||
const provider = await this.getProvider(); |
||||
const domain = this.multiProvider.getDomainId(chain); |
||||
const oracles = await this.getOracles(); |
||||
const oracle = oracles[chain]; |
||||
const oracleResponse: GetExchangeRateAndGasPriceResponse = |
||||
await provider.queryContractSmart(oracle, { |
||||
oracle: { |
||||
get_exchange_rate_and_gas_price: { |
||||
dest_domain: domain, |
||||
}, |
||||
}, |
||||
}); |
||||
return oracleResponse; |
||||
} |
||||
|
||||
async quoteGasPayment( |
||||
domain: number, |
||||
destinationGasAmount: number, |
||||
): Promise<number> { |
||||
const quote: QuoteGasPaymentResponse = await this.queryIgp({ |
||||
igp: { |
||||
quote_gas_payment: { |
||||
dest_domain: domain, |
||||
gas_amount: destinationGasAmount.toString(), |
||||
}, |
||||
}, |
||||
}); |
||||
return Number(quote.gas_needed); |
||||
} |
||||
|
||||
setOracleForDomain( |
||||
domain: number, |
||||
oracle: string, |
||||
oracleData: GetExchangeRateAndGasPriceResponse, |
||||
): ExecuteInstruction { |
||||
return { |
||||
contractAddress: oracle, |
||||
msg: { |
||||
set_remote_gas_data: { |
||||
config: { |
||||
gas_price: oracleData.gas_price, |
||||
token_exchange_rate: oracleData.exchange_rate, |
||||
remote_domain: domain, |
||||
}, |
||||
}, |
||||
}, |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,228 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export type Uint128 = string; |
||||
export type Logo = |
||||
| { |
||||
url: string; |
||||
} |
||||
| { |
||||
embedded: EmbeddedLogo; |
||||
}; |
||||
export type EmbeddedLogo = |
||||
| { |
||||
svg: Binary; |
||||
} |
||||
| { |
||||
png: Binary; |
||||
}; |
||||
export type Binary = string; |
||||
export interface InstantiateMsg { |
||||
decimals: number; |
||||
initial_balances: Cw20Coin[]; |
||||
marketing?: InstantiateMarketingInfo | null; |
||||
mint?: MinterResponse | null; |
||||
name: string; |
||||
symbol: string; |
||||
} |
||||
export interface Cw20Coin { |
||||
address: string; |
||||
amount: Uint128; |
||||
} |
||||
export interface InstantiateMarketingInfo { |
||||
description?: string | null; |
||||
logo?: Logo | null; |
||||
marketing?: string | null; |
||||
project?: string | null; |
||||
} |
||||
export interface MinterResponse { |
||||
cap?: Uint128 | null; |
||||
minter: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
transfer: { |
||||
amount: Uint128; |
||||
recipient: string; |
||||
}; |
||||
} |
||||
| { |
||||
burn: { |
||||
amount: Uint128; |
||||
}; |
||||
} |
||||
| { |
||||
send: { |
||||
amount: Uint128; |
||||
contract: string; |
||||
msg: Binary; |
||||
}; |
||||
} |
||||
| { |
||||
increase_allowance: { |
||||
amount: Uint128; |
||||
expires?: Expiration | null; |
||||
spender: string; |
||||
}; |
||||
} |
||||
| { |
||||
decrease_allowance: { |
||||
amount: Uint128; |
||||
expires?: Expiration | null; |
||||
spender: string; |
||||
}; |
||||
} |
||||
| { |
||||
transfer_from: { |
||||
amount: Uint128; |
||||
owner: string; |
||||
recipient: string; |
||||
}; |
||||
} |
||||
| { |
||||
send_from: { |
||||
amount: Uint128; |
||||
contract: string; |
||||
msg: Binary; |
||||
owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
burn_from: { |
||||
amount: Uint128; |
||||
owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
mint: { |
||||
amount: Uint128; |
||||
recipient: string; |
||||
}; |
||||
} |
||||
| { |
||||
update_minter: { |
||||
new_minter?: string | null; |
||||
}; |
||||
} |
||||
| { |
||||
update_marketing: { |
||||
description?: string | null; |
||||
marketing?: string | null; |
||||
project?: string | null; |
||||
}; |
||||
} |
||||
| { |
||||
upload_logo: Logo; |
||||
}; |
||||
export type Expiration = |
||||
| { |
||||
at_height: number; |
||||
} |
||||
| { |
||||
at_time: Timestamp; |
||||
} |
||||
| { |
||||
never: {}; |
||||
}; |
||||
export type Timestamp = Uint64; |
||||
export type Uint64 = string; |
||||
export type QueryMsg = |
||||
| { |
||||
balance: { |
||||
address: string; |
||||
}; |
||||
} |
||||
| { |
||||
token_info: {}; |
||||
} |
||||
| { |
||||
minter: {}; |
||||
} |
||||
| { |
||||
allowance: { |
||||
owner: string; |
||||
spender: string; |
||||
}; |
||||
} |
||||
| { |
||||
all_allowances: { |
||||
limit?: number | null; |
||||
owner: string; |
||||
start_after?: string | null; |
||||
}; |
||||
} |
||||
| { |
||||
all_spender_allowances: { |
||||
limit?: number | null; |
||||
spender: string; |
||||
start_after?: string | null; |
||||
}; |
||||
} |
||||
| { |
||||
all_accounts: { |
||||
limit?: number | null; |
||||
start_after?: string | null; |
||||
}; |
||||
} |
||||
| { |
||||
marketing_info: {}; |
||||
} |
||||
| { |
||||
download_logo: {}; |
||||
}; |
||||
export interface AllAccountsResponse { |
||||
accounts: string[]; |
||||
[k: string]: unknown; |
||||
} |
||||
export interface AllAllowancesResponse { |
||||
allowances: AllowanceInfo[]; |
||||
[k: string]: unknown; |
||||
} |
||||
export interface AllowanceInfo { |
||||
allowance: Uint128; |
||||
expires: Expiration; |
||||
spender: string; |
||||
} |
||||
export interface AllSpenderAllowancesResponse { |
||||
allowances: SpenderAllowanceInfo[]; |
||||
[k: string]: unknown; |
||||
} |
||||
export interface SpenderAllowanceInfo { |
||||
allowance: Uint128; |
||||
expires: Expiration; |
||||
owner: string; |
||||
} |
||||
export interface AllowanceResponse { |
||||
allowance: Uint128; |
||||
expires: Expiration; |
||||
[k: string]: unknown; |
||||
} |
||||
export interface BalanceResponse { |
||||
balance: Uint128; |
||||
} |
||||
export interface DownloadLogoResponse { |
||||
data: Binary; |
||||
mime_type: string; |
||||
} |
||||
export type LogoInfo = |
||||
| { |
||||
url: string; |
||||
} |
||||
| 'embedded'; |
||||
export type Addr = string; |
||||
export interface MarketingInfoResponse { |
||||
description?: string | null; |
||||
logo?: LogoInfo | null; |
||||
marketing?: Addr | null; |
||||
project?: string | null; |
||||
[k: string]: unknown; |
||||
} |
||||
export interface TokenInfoResponse { |
||||
decimals: number; |
||||
name: string; |
||||
symbol: string; |
||||
total_supply: Uint128; |
||||
} |
@ -0,0 +1,92 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
hooks: string[]; |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
post_dispatch: PostDispatchMsg; |
||||
} |
||||
| { |
||||
set_hooks: { |
||||
hooks: string[]; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export interface PostDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
hook: HookQueryMsg; |
||||
} |
||||
| { |
||||
aggregate_hook: AggregateHookQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type HookQueryMsg = |
||||
| { |
||||
quote_dispatch: QuoteDispatchMsg; |
||||
} |
||||
| { |
||||
mailbox: {}; |
||||
}; |
||||
export type AggregateHookQueryMsg = { |
||||
hooks: {}; |
||||
}; |
||||
export interface QuoteDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface HooksResponse { |
||||
hooks: string[]; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox: string; |
||||
} |
||||
export type Uint128 = string; |
||||
export interface QuoteDispatchResponse { |
||||
gas_amount?: Coin | null; |
||||
} |
||||
export interface Coin { |
||||
amount: Uint128; |
||||
denom: string; |
||||
[k: string]: unknown; |
||||
} |
@ -0,0 +1,180 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
mailbox: string; |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
post_dispatch: PostDispatchMsg; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export interface PostDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
hook: HookQueryMsg; |
||||
} |
||||
| { |
||||
merkle_hook: MerkleHookQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type HookQueryMsg = |
||||
| { |
||||
quote_dispatch: QuoteDispatchMsg; |
||||
} |
||||
| { |
||||
mailbox: {}; |
||||
}; |
||||
export type MerkleHookQueryMsg = |
||||
| { |
||||
count: {}; |
||||
} |
||||
| { |
||||
root: {}; |
||||
} |
||||
| { |
||||
branch: {}; |
||||
} |
||||
| { |
||||
tree: {}; |
||||
} |
||||
| { |
||||
check_point: {}; |
||||
}; |
||||
export interface QuoteDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export interface BranchResponse { |
||||
branch: [ |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
]; |
||||
} |
||||
export interface CheckPointResponse { |
||||
count: number; |
||||
root: HexBinary; |
||||
} |
||||
export interface CountResponse { |
||||
count: number; |
||||
} |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox: string; |
||||
} |
||||
export type Uint128 = string; |
||||
export interface QuoteDispatchResponse { |
||||
gas_amount?: Coin | null; |
||||
} |
||||
export interface Coin { |
||||
amount: Uint128; |
||||
denom: string; |
||||
[k: string]: unknown; |
||||
} |
||||
export interface RootResponse { |
||||
root: HexBinary; |
||||
} |
||||
export interface TreeResponse { |
||||
branch: [ |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
HexBinary, |
||||
]; |
||||
count: number; |
||||
} |
@ -0,0 +1,97 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
owner: string; |
||||
paused: boolean; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
pausable: PausableMsg; |
||||
} |
||||
| { |
||||
post_dispatch: PostDispatchMsg; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type PausableMsg = |
||||
| { |
||||
pause: {}; |
||||
} |
||||
| { |
||||
release: {}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export interface PostDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
pausable: PausableQueryMsg; |
||||
} |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
hook: HookQueryMsg; |
||||
}; |
||||
export type PausableQueryMsg = { |
||||
pause_info: {}; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type HookQueryMsg = |
||||
| { |
||||
quote_dispatch: QuoteDispatchMsg; |
||||
} |
||||
| { |
||||
mailbox: {}; |
||||
}; |
||||
export interface QuoteDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox: string; |
||||
} |
||||
export interface PauseInfoResponse { |
||||
paused: boolean; |
||||
} |
||||
export type Uint128 = string; |
||||
export interface QuoteDispatchResponse { |
||||
gas_amount?: Coin | null; |
||||
} |
||||
export interface Coin { |
||||
amount: Uint128; |
||||
denom: string; |
||||
[k: string]: unknown; |
||||
} |
@ -0,0 +1,127 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
post_dispatch: PostDispatchMsg; |
||||
} |
||||
| { |
||||
router: RouterMsgForAddr; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export type RouterMsgForAddr = |
||||
| { |
||||
set_route: { |
||||
set: DomainRouteSetForAddr; |
||||
}; |
||||
} |
||||
| { |
||||
set_routes: { |
||||
set: DomainRouteSetForAddr[]; |
||||
}; |
||||
}; |
||||
export type Addr = string; |
||||
export interface PostDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export interface DomainRouteSetForAddr { |
||||
domain: number; |
||||
route?: Addr | null; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
router: RouterQueryForAddr; |
||||
} |
||||
| { |
||||
hook: HookQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type RouterQueryForAddr = |
||||
| { |
||||
domains: {}; |
||||
} |
||||
| { |
||||
get_route: { |
||||
domain: number; |
||||
}; |
||||
} |
||||
| { |
||||
list_routes: { |
||||
limit?: number | null; |
||||
offset?: number | null; |
||||
order?: Order | null; |
||||
}; |
||||
}; |
||||
export type Order = 'asc' | 'desc'; |
||||
export type HookQueryMsg = |
||||
| { |
||||
quote_dispatch: QuoteDispatchMsg; |
||||
} |
||||
| { |
||||
mailbox: {}; |
||||
}; |
||||
export interface QuoteDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export interface DomainsResponse { |
||||
domains: number[]; |
||||
} |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface RouteResponseForAddr { |
||||
route: DomainRouteSetForAddr; |
||||
} |
||||
export interface RoutesResponseForAddr { |
||||
routes: DomainRouteSetForAddr[]; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox: string; |
||||
} |
||||
export interface Empty { |
||||
[k: string]: unknown; |
||||
} |
||||
export type Uint128 = string; |
||||
export interface QuoteDispatchResponse { |
||||
gas_amount?: Coin | null; |
||||
} |
||||
export interface Coin { |
||||
amount: Uint128; |
||||
denom: string; |
||||
[k: string]: unknown; |
||||
} |
@ -0,0 +1,174 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
post_dispatch: PostDispatchMsg; |
||||
} |
||||
| { |
||||
router: RouterMsgForAddr; |
||||
} |
||||
| { |
||||
register_custom_hook: RegisterCustomHookMsg; |
||||
} |
||||
| { |
||||
register_custom_hooks: RegisterCustomHookMsg[]; |
||||
} |
||||
| { |
||||
clear_custom_hook: ClearCustomHookMsg; |
||||
} |
||||
| { |
||||
clear_custom_hooks: ClearCustomHookMsg[]; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export type RouterMsgForAddr = |
||||
| { |
||||
set_route: { |
||||
set: DomainRouteSetForAddr; |
||||
}; |
||||
} |
||||
| { |
||||
set_routes: { |
||||
set: DomainRouteSetForAddr[]; |
||||
}; |
||||
}; |
||||
export type Addr = string; |
||||
export interface PostDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export interface DomainRouteSetForAddr { |
||||
domain: number; |
||||
route?: Addr | null; |
||||
} |
||||
export interface RegisterCustomHookMsg { |
||||
dest_domain: number; |
||||
hook: string; |
||||
recipient: string; |
||||
} |
||||
export interface ClearCustomHookMsg { |
||||
dest_domain: number; |
||||
recipient: string; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
router: RouterQueryForAddr; |
||||
} |
||||
| { |
||||
hook: HookQueryMsg; |
||||
} |
||||
| { |
||||
custom_routing_hook: CustomRoutingHookQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type RouterQueryForAddr = |
||||
| { |
||||
domains: {}; |
||||
} |
||||
| { |
||||
get_route: { |
||||
domain: number; |
||||
}; |
||||
} |
||||
| { |
||||
list_routes: { |
||||
limit?: number | null; |
||||
offset?: number | null; |
||||
order?: Order | null; |
||||
}; |
||||
}; |
||||
export type Order = 'asc' | 'desc'; |
||||
export type HookQueryMsg = |
||||
| { |
||||
quote_dispatch: QuoteDispatchMsg; |
||||
} |
||||
| { |
||||
mailbox: {}; |
||||
}; |
||||
export type CustomRoutingHookQueryMsg = |
||||
| { |
||||
custom_hook: { |
||||
dest_domain: number; |
||||
recipient: string; |
||||
}; |
||||
} |
||||
| { |
||||
custom_hooks: { |
||||
dest_domain: number; |
||||
limit?: number | null; |
||||
offset?: string | null; |
||||
order?: Order | null; |
||||
}; |
||||
}; |
||||
export interface QuoteDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export interface CustomHookResponse { |
||||
dest_domain: number; |
||||
hook: string; |
||||
recipient: string; |
||||
} |
||||
export interface CustomHooksResponse { |
||||
custom_hooks: CustomHookResponse[]; |
||||
} |
||||
export interface DomainsResponse { |
||||
domains: number[]; |
||||
} |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface RouteResponseForAddr { |
||||
route: DomainRouteSetForAddr; |
||||
} |
||||
export interface RoutesResponseForAddr { |
||||
routes: DomainRouteSetForAddr[]; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox: string; |
||||
} |
||||
export interface Empty { |
||||
[k: string]: unknown; |
||||
} |
||||
export type Uint128 = string; |
||||
export interface QuoteDispatchResponse { |
||||
gas_amount?: Coin | null; |
||||
} |
||||
export interface Coin { |
||||
amount: Uint128; |
||||
denom: string; |
||||
[k: string]: unknown; |
||||
} |
@ -0,0 +1,132 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
post_dispatch: PostDispatchMsg; |
||||
} |
||||
| { |
||||
router: RouterMsgForAddr; |
||||
} |
||||
| { |
||||
set_fallback_hook: { |
||||
hook: string; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export type RouterMsgForAddr = |
||||
| { |
||||
set_route: { |
||||
set: DomainRouteSetForAddr; |
||||
}; |
||||
} |
||||
| { |
||||
set_routes: { |
||||
set: DomainRouteSetForAddr[]; |
||||
}; |
||||
}; |
||||
export type Addr = string; |
||||
export interface PostDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export interface DomainRouteSetForAddr { |
||||
domain: number; |
||||
route?: Addr | null; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
router: RouterQueryForAddr; |
||||
} |
||||
| { |
||||
hook: HookQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type RouterQueryForAddr = |
||||
| { |
||||
domains: {}; |
||||
} |
||||
| { |
||||
get_route: { |
||||
domain: number; |
||||
}; |
||||
} |
||||
| { |
||||
list_routes: { |
||||
limit?: number | null; |
||||
offset?: number | null; |
||||
order?: Order | null; |
||||
}; |
||||
}; |
||||
export type Order = 'asc' | 'desc'; |
||||
export type HookQueryMsg = |
||||
| { |
||||
quote_dispatch: QuoteDispatchMsg; |
||||
} |
||||
| { |
||||
mailbox: {}; |
||||
}; |
||||
export interface QuoteDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export interface DomainsResponse { |
||||
domains: number[]; |
||||
} |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface RouteResponseForAddr { |
||||
route: DomainRouteSetForAddr; |
||||
} |
||||
export interface RoutesResponseForAddr { |
||||
routes: DomainRouteSetForAddr[]; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox: string; |
||||
} |
||||
export interface Empty { |
||||
[k: string]: unknown; |
||||
} |
||||
export type Uint128 = string; |
||||
export interface QuoteDispatchResponse { |
||||
gas_amount?: Coin | null; |
||||
} |
||||
export interface Coin { |
||||
amount: Uint128; |
||||
denom: string; |
||||
[k: string]: unknown; |
||||
} |
@ -0,0 +1,215 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
beneficiary: string; |
||||
default_gas_usage: number; |
||||
gas_token: string; |
||||
hrp: string; |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
router: RouterMsgForAddr; |
||||
} |
||||
| { |
||||
post_dispatch: PostDispatchMsg; |
||||
} |
||||
| { |
||||
set_default_gas: { |
||||
gas: number; |
||||
}; |
||||
} |
||||
| { |
||||
set_gas_for_domain: { |
||||
config: [number, number][]; |
||||
}; |
||||
} |
||||
| { |
||||
unset_gas_for_domain: { |
||||
domains: number[]; |
||||
}; |
||||
} |
||||
| { |
||||
set_beneficiary: { |
||||
beneficiary: string; |
||||
}; |
||||
} |
||||
| { |
||||
pay_for_gas: { |
||||
dest_domain: number; |
||||
gas_amount: Uint256; |
||||
message_id: HexBinary; |
||||
refund_address: string; |
||||
}; |
||||
} |
||||
| { |
||||
claim: {}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type RouterMsgForAddr = |
||||
| { |
||||
set_route: { |
||||
set: DomainRouteSetForAddr; |
||||
}; |
||||
} |
||||
| { |
||||
set_routes: { |
||||
set: DomainRouteSetForAddr[]; |
||||
}; |
||||
}; |
||||
export type Addr = string; |
||||
export type HexBinary = string; |
||||
export type Uint256 = string; |
||||
export interface DomainRouteSetForAddr { |
||||
domain: number; |
||||
route?: Addr | null; |
||||
} |
||||
export interface PostDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
hook: HookQueryMsg; |
||||
} |
||||
| { |
||||
router: RouterQueryForAddr; |
||||
} |
||||
| { |
||||
oracle: IgpGasOracleQueryMsg; |
||||
} |
||||
| { |
||||
igp: IgpQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type HookQueryMsg = |
||||
| { |
||||
quote_dispatch: QuoteDispatchMsg; |
||||
} |
||||
| { |
||||
mailbox: {}; |
||||
}; |
||||
export type RouterQueryForAddr = |
||||
| { |
||||
domains: {}; |
||||
} |
||||
| { |
||||
get_route: { |
||||
domain: number; |
||||
}; |
||||
} |
||||
| { |
||||
list_routes: { |
||||
limit?: number | null; |
||||
offset?: number | null; |
||||
order?: Order | null; |
||||
}; |
||||
}; |
||||
export type Order = 'asc' | 'desc'; |
||||
export type IgpGasOracleQueryMsg = { |
||||
get_exchange_rate_and_gas_price: { |
||||
dest_domain: number; |
||||
}; |
||||
}; |
||||
export type IgpQueryMsg = |
||||
| { |
||||
default_gas: {}; |
||||
} |
||||
| { |
||||
gas_for_domain: { |
||||
domains: number[]; |
||||
}; |
||||
} |
||||
| { |
||||
list_gas_for_domains: { |
||||
limit?: number | null; |
||||
offset?: number | null; |
||||
order?: Order | null; |
||||
}; |
||||
} |
||||
| { |
||||
beneficiary: {}; |
||||
} |
||||
| { |
||||
quote_gas_payment: { |
||||
dest_domain: number; |
||||
gas_amount: Uint256; |
||||
}; |
||||
}; |
||||
export interface QuoteDispatchMsg { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
} |
||||
export interface BeneficiaryResponse { |
||||
beneficiary: string; |
||||
} |
||||
export interface DefaultGasResponse { |
||||
gas: number; |
||||
} |
||||
export interface DomainsResponse { |
||||
domains: number[]; |
||||
} |
||||
export interface GasForDomainResponse { |
||||
gas: [number, number][]; |
||||
} |
||||
export type Uint128 = string; |
||||
export interface GetExchangeRateAndGasPriceResponse { |
||||
exchange_rate: Uint128; |
||||
gas_price: Uint128; |
||||
} |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface RouteResponseForAddr { |
||||
route: DomainRouteSetForAddr; |
||||
} |
||||
export interface RoutesResponseForAddr { |
||||
routes: DomainRouteSetForAddr[]; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox: string; |
||||
} |
||||
export interface Empty { |
||||
[k: string]: unknown; |
||||
} |
||||
export interface QuoteDispatchResponse { |
||||
gas_amount?: Coin | null; |
||||
} |
||||
export interface Coin { |
||||
amount: Uint128; |
||||
denom: string; |
||||
[k: string]: unknown; |
||||
} |
||||
export interface QuoteGasPaymentResponse { |
||||
gas_needed: Uint256; |
||||
} |
@ -0,0 +1,71 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownership: OwnableMsg; |
||||
} |
||||
| { |
||||
set_remote_gas_data_configs: { |
||||
configs: RemoteGasDataConfig[]; |
||||
}; |
||||
} |
||||
| { |
||||
set_remote_gas_data: { |
||||
config: RemoteGasDataConfig; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type Uint128 = string; |
||||
export interface RemoteGasDataConfig { |
||||
gas_price: Uint128; |
||||
remote_domain: number; |
||||
token_exchange_rate: Uint128; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
oracle: IgpGasOracleQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type IgpGasOracleQueryMsg = { |
||||
get_exchange_rate_and_gas_price: { |
||||
dest_domain: number; |
||||
}; |
||||
}; |
||||
export interface GetExchangeRateAndGasPriceResponse { |
||||
exchange_rate: Uint128; |
||||
gas_price: Uint128; |
||||
} |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
@ -0,0 +1,97 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
isms: string[]; |
||||
owner: string; |
||||
threshold: number; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
set_isms: { |
||||
isms: string[]; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
ism: IsmQueryMsg; |
||||
} |
||||
| { |
||||
aggregate_ism: AggregateIsmQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type IsmQueryMsg = |
||||
| { |
||||
module_type: {}; |
||||
} |
||||
| { |
||||
verify: { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
}; |
||||
} |
||||
| { |
||||
verify_info: { |
||||
message: HexBinary; |
||||
}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export type AggregateIsmQueryMsg = { |
||||
isms: {}; |
||||
}; |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface IsmsResponse { |
||||
isms: string[]; |
||||
} |
||||
export type IsmType = |
||||
| 'unused' |
||||
| 'routing' |
||||
| 'aggregation' |
||||
| 'legacy_multisig' |
||||
| 'merkle_root_multisig' |
||||
| 'message_id_multisig' |
||||
| 'null' |
||||
| 'ccip_read'; |
||||
export interface ModuleTypeResponse { |
||||
type: IsmType; |
||||
} |
||||
export interface VerifyResponse { |
||||
verified: boolean; |
||||
} |
||||
export interface VerifyInfoResponse { |
||||
threshold: number; |
||||
validators: HexBinary[]; |
||||
} |
@ -0,0 +1,127 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
enroll_validator: { |
||||
set: ValidatorSet; |
||||
}; |
||||
} |
||||
| { |
||||
enroll_validators: { |
||||
set: ValidatorSet[]; |
||||
}; |
||||
} |
||||
| { |
||||
unenroll_validator: { |
||||
domain: number; |
||||
validator: HexBinary; |
||||
}; |
||||
} |
||||
| { |
||||
set_threshold: { |
||||
set: ThresholdSet; |
||||
}; |
||||
} |
||||
| { |
||||
set_thresholds: { |
||||
set: ThresholdSet[]; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export interface ValidatorSet { |
||||
domain: number; |
||||
validator: HexBinary; |
||||
} |
||||
export interface ThresholdSet { |
||||
domain: number; |
||||
threshold: number; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
ism: IsmQueryMsg; |
||||
} |
||||
| { |
||||
multisig_ism: MultisigIsmQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type IsmQueryMsg = |
||||
| { |
||||
module_type: {}; |
||||
} |
||||
| { |
||||
verify: { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
}; |
||||
} |
||||
| { |
||||
verify_info: { |
||||
message: HexBinary; |
||||
}; |
||||
}; |
||||
export type MultisigIsmQueryMsg = { |
||||
enrolled_validators: { |
||||
domain: number; |
||||
}; |
||||
}; |
||||
export interface EnrolledValidatorsResponse { |
||||
threshold: number; |
||||
validators: HexBinary[]; |
||||
} |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export type IsmType = |
||||
| 'unused' |
||||
| 'routing' |
||||
| 'aggregation' |
||||
| 'legacy_multisig' |
||||
| 'merkle_root_multisig' |
||||
| 'message_id_multisig' |
||||
| 'null' |
||||
| 'ccip_read'; |
||||
export interface ModuleTypeResponse { |
||||
type: IsmType; |
||||
} |
||||
export interface VerifyResponse { |
||||
verified: boolean; |
||||
} |
||||
export interface VerifyInfoResponse { |
||||
threshold: number; |
||||
validators: HexBinary[]; |
||||
} |
@ -0,0 +1,102 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
isms: IsmSet[]; |
||||
owner: string; |
||||
} |
||||
export interface IsmSet { |
||||
address: string; |
||||
domain: number; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
set: { |
||||
ism: IsmSet; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
ism: IsmQueryMsg; |
||||
} |
||||
| { |
||||
routing_ism: RoutingIsmQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type IsmQueryMsg = |
||||
| { |
||||
module_type: {}; |
||||
} |
||||
| { |
||||
verify: { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
}; |
||||
} |
||||
| { |
||||
verify_info: { |
||||
message: HexBinary; |
||||
}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export type RoutingIsmQueryMsg = { |
||||
route: { |
||||
message: HexBinary; |
||||
}; |
||||
}; |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export type IsmType = |
||||
| 'unused' |
||||
| 'routing' |
||||
| 'aggregation' |
||||
| 'legacy_multisig' |
||||
| 'merkle_root_multisig' |
||||
| 'message_id_multisig' |
||||
| 'null' |
||||
| 'ccip_read'; |
||||
export interface ModuleTypeResponse { |
||||
type: IsmType; |
||||
} |
||||
export interface RouteResponse { |
||||
ism: string; |
||||
} |
||||
export interface VerifyResponse { |
||||
verified: boolean; |
||||
} |
||||
export interface VerifyInfoResponse { |
||||
threshold: number; |
||||
validators: HexBinary[]; |
||||
} |
@ -0,0 +1,154 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
domain: number; |
||||
hrp: string; |
||||
owner: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
set_default_ism: { |
||||
ism: string; |
||||
}; |
||||
} |
||||
| { |
||||
set_default_hook: { |
||||
hook: string; |
||||
}; |
||||
} |
||||
| { |
||||
set_required_hook: { |
||||
hook: string; |
||||
}; |
||||
} |
||||
| { |
||||
dispatch: DispatchMsg; |
||||
} |
||||
| { |
||||
process: { |
||||
message: HexBinary; |
||||
metadata: HexBinary; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export interface DispatchMsg { |
||||
dest_domain: number; |
||||
hook?: string | null; |
||||
metadata?: HexBinary | null; |
||||
msg_body: HexBinary; |
||||
recipient_addr: HexBinary; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
hook: MailboxHookQueryMsg; |
||||
} |
||||
| { |
||||
mailbox: MailboxQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type MailboxHookQueryMsg = { |
||||
quote_dispatch: DispatchMsg; |
||||
}; |
||||
export type MailboxQueryMsg = |
||||
| { |
||||
hrp: {}; |
||||
} |
||||
| { |
||||
local_domain: {}; |
||||
} |
||||
| { |
||||
message_delivered: { |
||||
id: HexBinary; |
||||
}; |
||||
} |
||||
| { |
||||
default_ism: {}; |
||||
} |
||||
| { |
||||
default_hook: {}; |
||||
} |
||||
| { |
||||
required_hook: {}; |
||||
} |
||||
| { |
||||
nonce: {}; |
||||
} |
||||
| { |
||||
recipient_ism: { |
||||
recipient_addr: string; |
||||
}; |
||||
} |
||||
| { |
||||
latest_dispatch_id: {}; |
||||
}; |
||||
export interface DefaultHookResponse { |
||||
default_hook: string; |
||||
} |
||||
export interface DefaultIsmResponse { |
||||
default_ism: string; |
||||
} |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface HrpResponse { |
||||
hrp: string; |
||||
} |
||||
export interface LatestDispatchedIdResponse { |
||||
message_id: HexBinary; |
||||
} |
||||
export interface LocalDomainResponse { |
||||
local_domain: number; |
||||
} |
||||
export interface MessageDeliveredResponse { |
||||
delivered: boolean; |
||||
} |
||||
export interface NonceResponse { |
||||
nonce: number; |
||||
} |
||||
export type Uint128 = string; |
||||
export interface QuoteDispatchResponse { |
||||
gas_amount?: Coin | null; |
||||
} |
||||
export interface Coin { |
||||
amount: Uint128; |
||||
denom: string; |
||||
[k: string]: unknown; |
||||
} |
||||
export interface RecipientIsmResponse { |
||||
ism: string; |
||||
} |
||||
export interface RequiredHookResponse { |
||||
required_hook: string; |
||||
} |
@ -0,0 +1,33 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export interface InstantiateMsg { |
||||
hrp: string; |
||||
mailbox: string; |
||||
} |
||||
export type ExecuteMsg = { |
||||
announce: { |
||||
signature: HexBinary; |
||||
storage_location: string; |
||||
validator: HexBinary; |
||||
}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export type QueryMsg = |
||||
| { |
||||
get_announce_storage_locations: { |
||||
validators: HexBinary[]; |
||||
}; |
||||
} |
||||
| { |
||||
get_announced_validators: {}; |
||||
}; |
||||
export interface GetAnnounceStorageLocationsResponse { |
||||
storage_locations: [string, string[]][]; |
||||
} |
||||
export interface GetAnnouncedValidatorsResponse { |
||||
validators: string[]; |
||||
} |
@ -0,0 +1,256 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export type TokenModeMsgForCw20ModeBridgedAndCw20ModeCollateral = |
||||
| { |
||||
bridged: Cw20ModeBridged; |
||||
} |
||||
| { |
||||
collateral: Cw20ModeCollateral; |
||||
}; |
||||
export type Uint128 = string; |
||||
export type Logo = |
||||
| { |
||||
url: string; |
||||
} |
||||
| { |
||||
embedded: EmbeddedLogo; |
||||
}; |
||||
export type EmbeddedLogo = |
||||
| { |
||||
svg: Binary; |
||||
} |
||||
| { |
||||
png: Binary; |
||||
}; |
||||
export type Binary = string; |
||||
export interface InstantiateMsg { |
||||
hrp: string; |
||||
mailbox: string; |
||||
owner: string; |
||||
token: TokenModeMsgForCw20ModeBridgedAndCw20ModeCollateral; |
||||
} |
||||
export interface Cw20ModeBridged { |
||||
code_id: number; |
||||
init_msg: InstantiateMsg1; |
||||
} |
||||
export interface InstantiateMsg1 { |
||||
decimals: number; |
||||
initial_balances: Cw20Coin[]; |
||||
marketing?: InstantiateMarketingInfo | null; |
||||
mint?: MinterResponse | null; |
||||
name: string; |
||||
symbol: string; |
||||
} |
||||
export interface Cw20Coin { |
||||
address: string; |
||||
amount: Uint128; |
||||
} |
||||
export interface InstantiateMarketingInfo { |
||||
description?: string | null; |
||||
logo?: Logo | null; |
||||
marketing?: string | null; |
||||
project?: string | null; |
||||
} |
||||
export interface MinterResponse { |
||||
cap?: Uint128 | null; |
||||
minter: string; |
||||
} |
||||
export interface Cw20ModeCollateral { |
||||
address: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
router: RouterMsgForHexBinary; |
||||
} |
||||
| { |
||||
connection: ConnectionMsg; |
||||
} |
||||
| { |
||||
handle: HandleMsg; |
||||
} |
||||
| { |
||||
transfer_remote: { |
||||
amount: Uint128; |
||||
dest_domain: number; |
||||
recipient: HexBinary; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type RouterMsgForHexBinary = |
||||
| { |
||||
set_route: { |
||||
set: DomainRouteSetForHexBinary; |
||||
}; |
||||
} |
||||
| { |
||||
set_routes: { |
||||
set: DomainRouteSetForHexBinary[]; |
||||
}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export type ConnectionMsg = |
||||
| { |
||||
set_mailbox: { |
||||
mailbox: string; |
||||
}; |
||||
} |
||||
| { |
||||
set_hook: { |
||||
hook: string; |
||||
}; |
||||
} |
||||
| { |
||||
set_ism: { |
||||
ism: string; |
||||
}; |
||||
}; |
||||
export interface DomainRouteSetForHexBinary { |
||||
domain: number; |
||||
route?: HexBinary | null; |
||||
} |
||||
export interface HandleMsg { |
||||
body: HexBinary; |
||||
origin: number; |
||||
sender: HexBinary; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
router: RouterQueryForHexBinary; |
||||
} |
||||
| { |
||||
connection: ConnectionQueryMsg; |
||||
} |
||||
| { |
||||
token_default: TokenWarpDefaultQueryMsg; |
||||
} |
||||
| { |
||||
ism_specifier: IsmSpecifierQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type RouterQueryForHexBinary = |
||||
| { |
||||
domains: {}; |
||||
} |
||||
| { |
||||
get_route: { |
||||
domain: number; |
||||
}; |
||||
} |
||||
| { |
||||
list_routes: { |
||||
limit?: number | null; |
||||
offset?: number | null; |
||||
order?: Order | null; |
||||
}; |
||||
}; |
||||
export type Order = 'asc' | 'desc'; |
||||
export type ConnectionQueryMsg = |
||||
| { |
||||
get_mailbox: {}; |
||||
} |
||||
| { |
||||
get_hook: {}; |
||||
} |
||||
| { |
||||
get_ism: {}; |
||||
}; |
||||
export type TokenWarpDefaultQueryMsg = |
||||
| { |
||||
token_type: {}; |
||||
} |
||||
| { |
||||
token_mode: {}; |
||||
}; |
||||
export type IsmSpecifierQueryMsg = { |
||||
interchain_security_module: []; |
||||
}; |
||||
export interface DomainsResponse { |
||||
domains: number[]; |
||||
} |
||||
export interface HookResponse { |
||||
hook?: string | null; |
||||
} |
||||
export interface IsmResponse { |
||||
ism?: string | null; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox?: string | null; |
||||
} |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface RouteResponseForHexBinary { |
||||
route: DomainRouteSetForHexBinary; |
||||
} |
||||
export interface InterchainSecurityModuleResponse { |
||||
ism?: Addr | null; |
||||
} |
||||
export interface RoutesResponseForHexBinary { |
||||
routes: DomainRouteSetForHexBinary[]; |
||||
} |
||||
export interface Empty { |
||||
[k: string]: unknown; |
||||
} |
||||
export type TokenMode = 'bridged' | 'collateral'; |
||||
export interface TokenModeResponse { |
||||
mode: TokenMode; |
||||
} |
||||
export type TokenType = |
||||
| { |
||||
native: TokenTypeNative; |
||||
} |
||||
| { |
||||
c_w20: { |
||||
contract: string; |
||||
}; |
||||
} |
||||
| { |
||||
c_w721: { |
||||
contract: string; |
||||
}; |
||||
}; |
||||
export type TokenTypeNative = |
||||
| { |
||||
fungible: { |
||||
denom: string; |
||||
}; |
||||
} |
||||
| { |
||||
non_fungible: { |
||||
class: string; |
||||
}; |
||||
}; |
||||
export interface TokenTypeResponse { |
||||
type: TokenType; |
||||
} |
@ -0,0 +1,232 @@ |
||||
/** |
||||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. |
||||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
||||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. |
||||
*/ |
||||
|
||||
export type TokenModeMsgForNativeModeBrigedAndNativeModeCollateral = |
||||
| { |
||||
bridged: NativeModeBriged; |
||||
} |
||||
| { |
||||
collateral: NativeModeCollateral; |
||||
}; |
||||
export interface InstantiateMsg { |
||||
hrp: string; |
||||
mailbox: string; |
||||
owner: string; |
||||
token: TokenModeMsgForNativeModeBrigedAndNativeModeCollateral; |
||||
} |
||||
export interface NativeModeBriged { |
||||
denom: string; |
||||
metadata?: Metadata | null; |
||||
} |
||||
export interface Metadata { |
||||
base: string; |
||||
denom_units: DenomUnit[]; |
||||
description: string; |
||||
display: string; |
||||
name: string; |
||||
symbol: string; |
||||
} |
||||
export interface DenomUnit { |
||||
aliases: string[]; |
||||
denom: string; |
||||
exponent: number; |
||||
} |
||||
export interface NativeModeCollateral { |
||||
denom: string; |
||||
} |
||||
export type ExecuteMsg = |
||||
| { |
||||
ownable: OwnableMsg; |
||||
} |
||||
| { |
||||
router: RouterMsgForHexBinary; |
||||
} |
||||
| { |
||||
connection: ConnectionMsg; |
||||
} |
||||
| { |
||||
handle: HandleMsg; |
||||
} |
||||
| { |
||||
transfer_remote: { |
||||
amount: Uint128; |
||||
dest_domain: number; |
||||
recipient: HexBinary; |
||||
}; |
||||
}; |
||||
export type OwnableMsg = |
||||
| { |
||||
init_ownership_transfer: { |
||||
next_owner: string; |
||||
}; |
||||
} |
||||
| { |
||||
revoke_ownership_transfer: {}; |
||||
} |
||||
| { |
||||
claim_ownership: {}; |
||||
}; |
||||
export type RouterMsgForHexBinary = |
||||
| { |
||||
set_route: { |
||||
set: DomainRouteSetForHexBinary; |
||||
}; |
||||
} |
||||
| { |
||||
set_routes: { |
||||
set: DomainRouteSetForHexBinary[]; |
||||
}; |
||||
}; |
||||
export type HexBinary = string; |
||||
export type ConnectionMsg = |
||||
| { |
||||
set_mailbox: { |
||||
mailbox: string; |
||||
}; |
||||
} |
||||
| { |
||||
set_hook: { |
||||
hook: string; |
||||
}; |
||||
} |
||||
| { |
||||
set_ism: { |
||||
ism: string; |
||||
}; |
||||
}; |
||||
export type Uint128 = string; |
||||
export interface DomainRouteSetForHexBinary { |
||||
domain: number; |
||||
route?: HexBinary | null; |
||||
} |
||||
export interface HandleMsg { |
||||
body: HexBinary; |
||||
origin: number; |
||||
sender: HexBinary; |
||||
} |
||||
export type QueryMsg = |
||||
| { |
||||
ownable: OwnableQueryMsg; |
||||
} |
||||
| { |
||||
router: RouterQueryForHexBinary; |
||||
} |
||||
| { |
||||
connection: ConnectionQueryMsg; |
||||
} |
||||
| { |
||||
token_default: TokenWarpDefaultQueryMsg; |
||||
} |
||||
| { |
||||
ism_specifier: IsmSpecifierQueryMsg; |
||||
}; |
||||
export type OwnableQueryMsg = |
||||
| { |
||||
get_owner: {}; |
||||
} |
||||
| { |
||||
get_pending_owner: {}; |
||||
}; |
||||
export type RouterQueryForHexBinary = |
||||
| { |
||||
domains: {}; |
||||
} |
||||
| { |
||||
get_route: { |
||||
domain: number; |
||||
}; |
||||
} |
||||
| { |
||||
list_routes: { |
||||
limit?: number | null; |
||||
offset?: number | null; |
||||
order?: Order | null; |
||||
}; |
||||
}; |
||||
export type Order = 'asc' | 'desc'; |
||||
export type ConnectionQueryMsg = |
||||
| { |
||||
get_mailbox: {}; |
||||
} |
||||
| { |
||||
get_hook: {}; |
||||
} |
||||
| { |
||||
get_ism: {}; |
||||
}; |
||||
export type TokenWarpDefaultQueryMsg = |
||||
| { |
||||
token_type: {}; |
||||
} |
||||
| { |
||||
token_mode: {}; |
||||
}; |
||||
export type IsmSpecifierQueryMsg = { |
||||
interchain_security_module: []; |
||||
}; |
||||
export interface DomainsResponse { |
||||
domains: number[]; |
||||
} |
||||
export interface HookResponse { |
||||
hook?: string | null; |
||||
} |
||||
export interface IsmResponse { |
||||
ism?: string | null; |
||||
} |
||||
export interface MailboxResponse { |
||||
mailbox?: string | null; |
||||
} |
||||
export type Addr = string; |
||||
export interface OwnerResponse { |
||||
owner: Addr; |
||||
} |
||||
export interface PendingOwnerResponse { |
||||
pending_owner?: Addr | null; |
||||
} |
||||
export interface RouteResponseForHexBinary { |
||||
route: DomainRouteSetForHexBinary; |
||||
} |
||||
export interface InterchainSecurityModuleResponse { |
||||
ism?: Addr | null; |
||||
} |
||||
export interface RoutesResponseForHexBinary { |
||||
routes: DomainRouteSetForHexBinary[]; |
||||
} |
||||
export interface Empty { |
||||
[k: string]: unknown; |
||||
} |
||||
export type TokenMode = 'bridged' | 'collateral'; |
||||
export interface TokenModeResponse { |
||||
mode: TokenMode; |
||||
} |
||||
export type TokenType = |
||||
| { |
||||
native: TokenTypeNative; |
||||
} |
||||
| { |
||||
c_w20: { |
||||
contract: string; |
||||
}; |
||||
} |
||||
| { |
||||
c_w721: { |
||||
contract: string; |
||||
}; |
||||
}; |
||||
export type TokenTypeNative = |
||||
| { |
||||
fungible: { |
||||
denom: string; |
||||
}; |
||||
} |
||||
| { |
||||
non_fungible: { |
||||
class: string; |
||||
}; |
||||
}; |
||||
export interface TokenTypeResponse { |
||||
type: TokenType; |
||||
} |
@ -0,0 +1,122 @@ |
||||
import { ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; |
||||
|
||||
import { |
||||
Address, |
||||
difference, |
||||
objMap, |
||||
promiseObjAll, |
||||
} from '@hyperlane-xyz/utils'; |
||||
|
||||
import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp'; |
||||
import { |
||||
EnrolledValidatorsResponse, |
||||
ExecuteMsg as MultisigExecute, |
||||
QueryMsg as MultisigQuery, |
||||
} from '../../cw-types/IsmMultisig.types'; |
||||
import { MultisigConfig } from '../../ism/types'; |
||||
import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; |
||||
import { ChainMap, ChainName } from '../../types'; |
||||
|
||||
type MultisigResponse = EnrolledValidatorsResponse; |
||||
|
||||
export class CosmWasmMultisigAdapter extends BaseCosmWasmAdapter { |
||||
constructor( |
||||
public readonly chainName: ChainName, |
||||
public readonly multiProvider: MultiProtocolProvider<any>, |
||||
public readonly addresses: { multisig: Address }, |
||||
) { |
||||
super(chainName, multiProvider, addresses); |
||||
} |
||||
|
||||
async queryMultisig<R extends MultisigResponse>( |
||||
msg: MultisigQuery, |
||||
): Promise<R> { |
||||
const provider = await this.getProvider(); |
||||
const response: R = await provider.queryContractSmart( |
||||
this.addresses.multisig, |
||||
msg, |
||||
); |
||||
return response; |
||||
} |
||||
|
||||
async getConfig(chain: ChainName): Promise<MultisigConfig> { |
||||
return this.queryMultisig<EnrolledValidatorsResponse>({ |
||||
multisig_ism: { |
||||
enrolled_validators: { |
||||
domain: this.multiProvider.getDomainId(chain), |
||||
}, |
||||
}, |
||||
}); |
||||
} |
||||
|
||||
prepareMultisig(msg: MultisigExecute): ExecuteInstruction { |
||||
return { |
||||
contractAddress: this.addresses.multisig, |
||||
msg, |
||||
}; |
||||
} |
||||
|
||||
async configureMultisig( |
||||
configMap: ChainMap<MultisigConfig>, |
||||
): Promise<ExecuteInstruction[]> { |
||||
const configuredMap = await promiseObjAll( |
||||
objMap(configMap, (origin, _) => this.getConfig(origin)), |
||||
); |
||||
|
||||
const validatorInstructions = Object.entries(configMap).flatMap( |
||||
([origin, config]) => { |
||||
const domain = this.multiProvider.getDomainId(origin); |
||||
const configuredSet = new Set(configuredMap[origin].validators); |
||||
const configSet = new Set(config.validators); |
||||
const unenrollList = Array.from( |
||||
difference(configuredSet, configSet).values(), |
||||
); |
||||
const enrollList = Array.from( |
||||
difference(configSet, configuredSet).values(), |
||||
); |
||||
return unenrollList |
||||
.map((validator) => |
||||
this.prepareMultisig({ |
||||
unenroll_validator: { |
||||
domain, |
||||
validator, |
||||
}, |
||||
}), |
||||
) |
||||
.concat( |
||||
enrollList.map((validator) => |
||||
this.prepareMultisig({ |
||||
enroll_validator: { |
||||
set: { |
||||
domain, |
||||
validator, |
||||
}, |
||||
}, |
||||
}), |
||||
), |
||||
); |
||||
}, |
||||
); |
||||
|
||||
const setThresholds = Object.entries(configMap) |
||||
.filter( |
||||
([origin, { threshold }]) => |
||||
threshold !== configuredMap[origin].threshold, |
||||
) |
||||
.map(([origin, config]) => ({ |
||||
domain: this.multiProvider.getDomainId(origin), |
||||
threshold: config.threshold, |
||||
})); |
||||
|
||||
if (setThresholds.length > 0) { |
||||
const thresholdInstruction = this.prepareMultisig({ |
||||
set_thresholds: { |
||||
set: setThresholds, |
||||
}, |
||||
}); |
||||
return [...validatorInstructions, thresholdInstruction]; |
||||
} |
||||
|
||||
return validatorInstructions; |
||||
} |
||||
} |
@ -0,0 +1,398 @@ |
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ |
||||
|
||||
/* eslint-disable no-console */ |
||||
import { |
||||
CosmWasmClient, |
||||
ExecuteInstruction, |
||||
SigningCosmWasmClient, |
||||
} from '@cosmjs/cosmwasm-stargate'; |
||||
import { Secp256k1, keccak256 } from '@cosmjs/crypto'; |
||||
import { DirectSecp256k1Wallet } from '@cosmjs/proto-signing'; |
||||
import { GasPrice, SigningStargateClient } from '@cosmjs/stargate'; |
||||
import { Tendermint37Client } from '@cosmjs/tendermint-rpc'; |
||||
|
||||
import { Address } from '@hyperlane-xyz/utils'; |
||||
|
||||
import { chainMetadata } from '../../consts/chainMetadata'; |
||||
import { Chains } from '../../consts/chains'; |
||||
import { CosmWasmCoreAdapter } from '../../core/adapters/CosmWasmCoreAdapter'; |
||||
import { |
||||
MailboxResponse, |
||||
QueryMsg as MerkleQuery, |
||||
OwnerResponse, |
||||
} from '../../cw-types/HookMerkle.types'; |
||||
import { CosmWasmMultisigAdapter } from '../../ism/adapters/CosmWasmMultisigAdapter'; |
||||
import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; |
||||
|
||||
const neutronAddresses = { |
||||
mailbox: 'neutron1sjzzd4gwkggy6hrrs8kxxatexzcuz3jecsxm3wqgregkulzj8r7qlnuef4', |
||||
validatorAnnounce: |
||||
'neutron17w4q6efzym3p4c6umyp4cjf2ustjtmwfqdhd7rt2fpcpk9fmjzsq0kj0f8', |
||||
}; |
||||
|
||||
const neutron = chainMetadata.neutron; |
||||
const mantapacific = chainMetadata.mantapacific; |
||||
|
||||
const multiProtocolProvider = new MultiProtocolProvider(); |
||||
|
||||
const adapter = new CosmWasmCoreAdapter( |
||||
Chains.neutron, |
||||
multiProtocolProvider, |
||||
neutronAddresses, |
||||
); |
||||
|
||||
export async function getSigningClient(pkey: string) { |
||||
const wallet = await DirectSecp256k1Wallet.fromKey( |
||||
Buffer.from(pkey, 'hex'), |
||||
neutron.bech32Prefix!, |
||||
); |
||||
|
||||
const [account] = await wallet.getAccounts(); |
||||
|
||||
const clientBase = await Tendermint37Client.connect(neutron.rpcUrls[0].http); |
||||
|
||||
const gasPrice = GasPrice.fromString('0.1untrn'); |
||||
|
||||
const wasm = await SigningCosmWasmClient.createWithSigner( |
||||
clientBase, |
||||
wallet, |
||||
{ |
||||
gasPrice, |
||||
}, |
||||
); |
||||
const stargate = await SigningStargateClient.createWithSigner( |
||||
clientBase, |
||||
wallet, |
||||
{ |
||||
gasPrice, |
||||
}, |
||||
); |
||||
|
||||
const pubkey = Secp256k1.uncompressPubkey(account.pubkey); |
||||
const ethaddr = keccak256(pubkey.slice(1)).slice(-20); |
||||
|
||||
return { |
||||
wasm, |
||||
stargate, |
||||
signer: account.address, |
||||
signer_addr: Buffer.from(ethaddr).toString('hex'), |
||||
signer_pubkey: Buffer.from(account.pubkey).toString('hex'), |
||||
}; |
||||
} |
||||
|
||||
const initTransferOwner = ( |
||||
address: Address, |
||||
newOwner: Address, |
||||
key = 'ownable', |
||||
): ExecuteInstruction => { |
||||
return { |
||||
contractAddress: address, |
||||
msg: { |
||||
[key]: { |
||||
init_ownership_transfer: { |
||||
next_owner: newOwner, |
||||
}, |
||||
}, |
||||
}, |
||||
}; |
||||
}; |
||||
|
||||
const claimTransferOwner = ( |
||||
address: Address, |
||||
key = 'ownable', |
||||
): ExecuteInstruction => { |
||||
return { |
||||
contractAddress: address, |
||||
msg: { |
||||
[key]: { |
||||
claim_ownership: {}, |
||||
}, |
||||
}, |
||||
}; |
||||
}; |
||||
|
||||
const getOwner = async ( |
||||
provider: CosmWasmClient, |
||||
address: Address, |
||||
): Promise<Address> => { |
||||
const ownableQuery = { |
||||
ownable: { get_owner: {} }, |
||||
}; |
||||
const ownerResponse: OwnerResponse = await provider.queryContractSmart( |
||||
address, |
||||
ownableQuery, |
||||
); |
||||
return ownerResponse.owner; |
||||
}; |
||||
|
||||
export async function rotateHooks() { |
||||
const desiredDefault = |
||||
'neutron1e5c2qqquc86rd3q77aj2wyht40z6z3q5pclaq040ue9f5f8yuf7qnpvkzk'; |
||||
|
||||
const desiredRequired = |
||||
'neutron19qjplhq7jsmk7haneafqxyyhltgllvvag8c4g7jkmxw6mvd4h8sq7rqh02'; |
||||
|
||||
const safe = await getSigningClient( |
||||
'2ac7230628b8b4a587c4005798184735471b9240fc57fc75d97824e1fb6b5409', |
||||
); |
||||
|
||||
const tx = await safe.wasm.executeMultiple( |
||||
safe.signer, |
||||
[ |
||||
adapter.setDefaultHook(desiredDefault), |
||||
adapter.setRequiredHook(desiredRequired), |
||||
], |
||||
'auto', |
||||
); |
||||
|
||||
console.log(tx); |
||||
} |
||||
|
||||
export async function rotateAuth() { |
||||
const safe = await getSigningClient( |
||||
'2ac7230628b8b4a587c4005798184735471b9240fc57fc75d97824e1fb6b5409', |
||||
); |
||||
|
||||
const desiredOwner = |
||||
'neutron1fqf5mprg3f5hytvzp3t7spmsum6rjrw80mq8zgkc0h6rxga0dtzqws3uu7'; |
||||
|
||||
const addresses: string[] = [ |
||||
'neutron1sjzzd4gwkggy6hrrs8kxxatexzcuz3jecsxm3wqgregkulzj8r7qlnuef4', // mailbox
|
||||
'neutron17w4q6efzym3p4c6umyp4cjf2ustjtmwfqdhd7rt2fpcpk9fmjzsq0kj0f8', // validator announce
|
||||
'neutron1q75ky8reksqzh0lkhk9k3csvjwv74jjquahrj233xc7dvzz5fv4qtvw0qg', // multisig ISM
|
||||
'neutron1e5c2qqquc86rd3q77aj2wyht40z6z3q5pclaq040ue9f5f8yuf7qnpvkzk', // merkle
|
||||
'neutron19qjplhq7jsmk7haneafqxyyhltgllvvag8c4g7jkmxw6mvd4h8sq7rqh02', // pausable
|
||||
'neutron1ch7x3xgpnj62weyes8vfada35zff6z59kt2psqhnx9gjnt2ttqdqtva3pa', // warp route
|
||||
]; |
||||
|
||||
const transferInstructions: ExecuteInstruction[] = []; |
||||
const claimInstructions: ExecuteInstruction[] = []; |
||||
|
||||
for (const address of addresses) { |
||||
const info = await safe.wasm.getContract(address); |
||||
console.log({ address, info }); |
||||
try { |
||||
await getOwner(safe.wasm, address); |
||||
|
||||
const transferInstruction = initTransferOwner(address, desiredOwner); |
||||
transferInstructions.push(transferInstruction); |
||||
|
||||
const claimInstruction = claimTransferOwner(address); |
||||
claimInstructions.push(claimInstruction); |
||||
} catch (e: any) { |
||||
if (e.message.includes('unknown variant `ownable`')) { |
||||
console.log( |
||||
`Skipping ${info.label} (${address}) because it is not ownable`, |
||||
); |
||||
} else { |
||||
throw e; |
||||
} |
||||
} |
||||
// }
|
||||
|
||||
console.log(JSON.stringify({ transferInstructions, claimInstructions })); |
||||
|
||||
// const tx = await safe.wasm.executeMultiple(
|
||||
// safe.signer,
|
||||
// transferInstructions,
|
||||
// 'auto',
|
||||
// );
|
||||
// console.log(tx);
|
||||
|
||||
// const claimTx = await safe.wasm.execute(
|
||||
// safe.signer,
|
||||
// address,
|
||||
// claimInstruction.msg,
|
||||
// 'auto',
|
||||
// );
|
||||
// console.log(claimTx);
|
||||
|
||||
const res = await safe.wasm.updateAdmin( |
||||
safe.signer, |
||||
address, |
||||
desiredOwner, |
||||
'auto', |
||||
); |
||||
console.log(res); |
||||
} |
||||
} |
||||
|
||||
export async function summary() { |
||||
const summary: any = {}; |
||||
|
||||
const provider = await adapter.getProvider(); |
||||
|
||||
const getOwner = async (address: Address): Promise<Address> => { |
||||
const ownableQuery = { |
||||
ownable: { get_owner: {} }, |
||||
}; |
||||
const ownerResponse: OwnerResponse = await provider.queryContractSmart( |
||||
address, |
||||
ownableQuery, |
||||
); |
||||
return ownerResponse.owner; |
||||
}; |
||||
|
||||
const owner = await getOwner(neutronAddresses.mailbox); |
||||
const info = await provider.getContract(neutronAddresses.mailbox); |
||||
const defaultHook = await adapter.defaultHook(); |
||||
const requiredHook = await adapter.requiredHook(); |
||||
const defaultIsm = await adapter.defaultIsm(); |
||||
|
||||
summary.mailbox = { |
||||
owner, |
||||
...info, |
||||
defaultHook, |
||||
requiredHook, |
||||
defaultIsm, |
||||
}; |
||||
|
||||
const router = |
||||
'neutron1ch7x3xgpnj62weyes8vfada35zff6z59kt2psqhnx9gjnt2ttqdqtva3pa'; |
||||
summary.warproute = { |
||||
owner: await getOwner(router), |
||||
...(await provider.getContract(router)), |
||||
}; |
||||
|
||||
summary.validatorAnnounce = { |
||||
// owner: await getOwner(neutronAddresses.validatorAnnounce),
|
||||
...(await provider.getContract(neutronAddresses.validatorAnnounce)), |
||||
}; |
||||
|
||||
const defaultIsmContract = await provider.getContract(defaultIsm); |
||||
|
||||
if (defaultIsmContract.label === 'hpl_ism_multisig') { |
||||
const multisigAdapter = new CosmWasmMultisigAdapter( |
||||
neutron.name, |
||||
multiProtocolProvider, |
||||
{ multisig: defaultIsm }, |
||||
); |
||||
const multisigConfig = await multisigAdapter.getConfig(mantapacific.name); |
||||
const owner = await getOwner(defaultIsm); |
||||
summary.defaultIsm = { |
||||
...multisigConfig, |
||||
...defaultIsmContract, |
||||
owner, |
||||
}; |
||||
} |
||||
|
||||
const getMailbox = async (hook: Address): Promise<Address> => { |
||||
const merkleMailboxQuery: MerkleQuery = { |
||||
hook: { |
||||
mailbox: {}, |
||||
}, |
||||
}; |
||||
const merkleMailboxResponse: MailboxResponse = |
||||
await provider.queryContractSmart(hook, merkleMailboxQuery); |
||||
return merkleMailboxResponse.mailbox; |
||||
}; |
||||
|
||||
const requiredHookContract = await provider.getContract(requiredHook); |
||||
if (requiredHookContract.label === 'hpl_hook_pausable') { |
||||
summary.requiredHook = { |
||||
...requiredHookContract, |
||||
owner: await getOwner(requiredHook), |
||||
mailbox: await getMailbox(requiredHook), |
||||
}; |
||||
} |
||||
// else if (requiredHookContract.label === 'hpl_hook_aggregate') {
|
||||
// const aggregateHookQuery: AggregateQuery = {
|
||||
// aggregate_hook: {
|
||||
// hooks: {},
|
||||
// },
|
||||
// };
|
||||
// const hooksResponse: HooksResponse = await provider.queryContractSmart(
|
||||
// requiredHook,
|
||||
// aggregateHookQuery,
|
||||
// );
|
||||
// summary.requiredHook = {
|
||||
// ...requiredHookContract,
|
||||
// hooks: hooksResponse.hooks,
|
||||
// owner: await getOwner(requiredHook),
|
||||
// mailbox: await getMailbox(requiredHook),
|
||||
// };
|
||||
|
||||
const defaultHookContract = await provider.getContract(defaultHook); |
||||
if (defaultHookContract.label === 'hpl_hook_merkle') { |
||||
summary.defaultHook = defaultHookContract; |
||||
} |
||||
|
||||
// for (const hook of hooksResponse.hooks) {
|
||||
// const hook = defaultHook;
|
||||
// const hookContract = await provider.getContract(hook);
|
||||
// if (hookContract.label === 'hpl_hook_merkle') {
|
||||
// // summary.requiredHook.merkleHook = {
|
||||
// summary.merkleHook = {
|
||||
// ...hookContract,
|
||||
// mailbox: await getMailbox(hook),
|
||||
// owner: await getOwner(hook),
|
||||
// };
|
||||
// }
|
||||
// } else if (hookContract.label === 'hpl_igp') {
|
||||
// const igpAdapter = new CosmWasmIgpAdapter(
|
||||
// neutron.name,
|
||||
// multiProtocolProvider,
|
||||
// { igp: hook },
|
||||
// );
|
||||
// const oracles = await igpAdapter.getOracles();
|
||||
// const defaultGas = await igpAdapter.defaultGas();
|
||||
// const beneficiary = await igpAdapter.beneficiary();
|
||||
|
||||
// const mantaData = await igpAdapter.getOracleData(mantapacific.name);
|
||||
// const igpOracle = oracles[mantapacific.name];
|
||||
|
||||
// summary.requiredHook.igpHook = {
|
||||
// oracles,
|
||||
// mantaOracle: {
|
||||
// ...mantaData,
|
||||
// owner: await getOwner(igpOracle),
|
||||
// ...(await provider.getContract(igpOracle)),
|
||||
// },
|
||||
// defaultGas,
|
||||
// beneficiary,
|
||||
// mailbox: await getMailbox(hook),
|
||||
// owner: await getOwner(hook),
|
||||
// ...hookContract,
|
||||
// };
|
||||
// }
|
||||
// }
|
||||
|
||||
console.log(JSON.stringify(summary)); |
||||
} |
||||
|
||||
export async function rotateValidators() { |
||||
const multisigAdapter = new CosmWasmMultisigAdapter( |
||||
neutron.name, |
||||
multiProtocolProvider, |
||||
{ |
||||
multisig: |
||||
'neutron1q75ky8reksqzh0lkhk9k3csvjwv74jjquahrj233xc7dvzz5fv4qtvw0qg', |
||||
}, |
||||
); |
||||
const instructions = await multisigAdapter.configureMultisig({ |
||||
[mantapacific.name]: { |
||||
threshold: 5, |
||||
validators: [ |
||||
'8e668c97ad76d0e28375275c41ece4972ab8a5bc', // hyperlane
|
||||
'521a3e6bf8d24809fde1c1fd3494a859a16f132c', // cosmosstation
|
||||
'25b9a0961c51e74fd83295293bc029131bf1e05a', // neutron (pablo)
|
||||
'14025fe092f5f8a401dd9819704d9072196d2125', // p2p
|
||||
'a0ee95e280d46c14921e524b075d0c341e7ad1c8', // cosmos spaces
|
||||
'cc9a0b6de7fe314bd99223687d784730a75bb957', // dsrv
|
||||
'42b6de2edbaa62c2ea2309ad85d20b3e37d38acf', // sg-1
|
||||
], |
||||
}, |
||||
}); |
||||
|
||||
console.log(JSON.stringify(instructions)); |
||||
|
||||
// const safe = await getSigningClient(
|
||||
// '2ac7230628b8b4a587c4005798184735471b9240fc57fc75d97824e1fb6b5409',
|
||||
// );
|
||||
|
||||
// const tx = await safe.wasm.executeMultiple(safe.signer, instructions, 'auto');
|
||||
|
||||
// console.log(tx);
|
||||
} |
||||
|
||||
summary().catch(console.error); |
@ -0,0 +1,409 @@ |
||||
import { ExecuteInstruction } from '@cosmjs/cosmwasm-stargate'; |
||||
import { Coin } from '@cosmjs/stargate'; |
||||
|
||||
import { |
||||
Address, |
||||
Domain, |
||||
addressToBytes32, |
||||
strip0x, |
||||
} from '@hyperlane-xyz/utils'; |
||||
|
||||
import { BaseCosmWasmAdapter } from '../../app/MultiProtocolApp'; |
||||
import { |
||||
BalanceResponse, |
||||
ExecuteMsg as Cw20Execute, |
||||
QueryMsg as Cw20Query, |
||||
TokenInfoResponse, |
||||
} from '../../cw-types/Cw20Base.types'; |
||||
import { |
||||
DomainsResponse, |
||||
InterchainSecurityModuleResponse, |
||||
OwnerResponse, |
||||
RouteResponseForHexBinary, |
||||
RoutesResponseForHexBinary, |
||||
TokenType, |
||||
TokenTypeResponse, |
||||
ExecuteMsg as WarpCw20Execute, |
||||
QueryMsg as WarpCw20Query, |
||||
} from '../../cw-types/WarpCw20.types'; |
||||
import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; |
||||
import { ChainName } from '../../types'; |
||||
import { ERC20Metadata } from '../config'; |
||||
|
||||
import { |
||||
IHypTokenAdapter, |
||||
ITokenAdapter, |
||||
TransferParams, |
||||
TransferRemoteParams, |
||||
} from './ITokenAdapter'; |
||||
|
||||
// Interacts with IBC denom tokens in CosmWasm
|
||||
export class CwNativeTokenAdapter |
||||
extends BaseCosmWasmAdapter |
||||
implements ITokenAdapter |
||||
{ |
||||
constructor( |
||||
public readonly chainName: string, |
||||
public readonly multiProvider: MultiProtocolProvider, |
||||
public readonly addresses: Record<string, Address>, |
||||
public readonly ibcDenom: string = 'untrn', |
||||
) { |
||||
super(chainName, multiProvider, addresses); |
||||
} |
||||
|
||||
async getBalance(address: Address): Promise<string> { |
||||
const provider = await this.getProvider(); |
||||
const balance = await provider.getBalance(address, this.ibcDenom); |
||||
return balance.amount; |
||||
} |
||||
|
||||
async getMetadata(): Promise<CW20Metadata> { |
||||
throw new Error('Metadata not available to native tokens'); |
||||
} |
||||
|
||||
async populateApproveTx( |
||||
_params: TransferParams, |
||||
): Promise<ExecuteInstruction> { |
||||
throw new Error('Approve not required for native tokens'); |
||||
} |
||||
|
||||
async populateTransferTx({ |
||||
recipient, |
||||
weiAmountOrId, |
||||
}: TransferParams): Promise<ExecuteInstruction> { |
||||
// TODO: check if this works with execute instruction? (contract type, empty message)
|
||||
return { |
||||
contractAddress: recipient, |
||||
msg: {}, |
||||
funds: [ |
||||
{ |
||||
amount: weiAmountOrId.toString(), |
||||
denom: this.ibcDenom, |
||||
}, |
||||
], |
||||
}; |
||||
} |
||||
} |
||||
|
||||
export type CW20Metadata = ERC20Metadata; |
||||
type CW20Response = TokenInfoResponse | BalanceResponse; |
||||
|
||||
// Interacts with CW20/721 contracts
|
||||
export class CwTokenAdapter |
||||
extends BaseCosmWasmAdapter |
||||
implements ITokenAdapter |
||||
{ |
||||
constructor( |
||||
public readonly chainName: string, |
||||
public readonly multiProvider: MultiProtocolProvider, |
||||
public readonly addresses: { token: Address }, |
||||
public readonly denom = 'untrn', |
||||
) { |
||||
super(chainName, multiProvider, addresses); |
||||
} |
||||
|
||||
async queryToken<R extends CW20Response>(msg: Cw20Query): Promise<R> { |
||||
const provider = await this.getProvider(); |
||||
const response: R = await provider.queryContractSmart( |
||||
this.addresses.token, |
||||
msg, |
||||
); |
||||
return response; |
||||
} |
||||
|
||||
prepareToken(msg: Cw20Execute, funds?: Coin[]): ExecuteInstruction { |
||||
return { |
||||
contractAddress: this.addresses.token, |
||||
msg, |
||||
funds, |
||||
}; |
||||
} |
||||
|
||||
async getBalance(address: Address): Promise<string> { |
||||
const resp = await this.queryToken<BalanceResponse>({ |
||||
balance: { |
||||
address, |
||||
}, |
||||
}); |
||||
return resp.balance; |
||||
} |
||||
|
||||
async getMetadata(): Promise<CW20Metadata> { |
||||
const resp = await this.queryToken<TokenInfoResponse>({ |
||||
token_info: {}, |
||||
}); |
||||
return { |
||||
...resp, |
||||
totalSupply: resp.total_supply, |
||||
}; |
||||
} |
||||
|
||||
async populateApproveTx({ |
||||
weiAmountOrId, |
||||
recipient, |
||||
}: TransferParams): Promise<ExecuteInstruction> { |
||||
// TODO: check existing allowance
|
||||
return this.prepareToken({ |
||||
increase_allowance: { |
||||
spender: recipient, |
||||
amount: weiAmountOrId.toString(), |
||||
expires: { |
||||
never: {}, |
||||
}, |
||||
}, |
||||
}); |
||||
} |
||||
|
||||
async populateTransferTx({ |
||||
weiAmountOrId, |
||||
recipient, |
||||
}: TransferParams): Promise<ExecuteInstruction> { |
||||
return this.prepareToken({ |
||||
transfer: { |
||||
recipient, |
||||
amount: weiAmountOrId.toString(), |
||||
}, |
||||
}); |
||||
} |
||||
} |
||||
|
||||
type TokenRouterResponse = |
||||
| TokenTypeResponse |
||||
| InterchainSecurityModuleResponse |
||||
| DomainsResponse |
||||
| OwnerResponse |
||||
| RouteResponseForHexBinary |
||||
| RoutesResponseForHexBinary; |
||||
|
||||
export class CwHypSyntheticAdapter |
||||
extends CwTokenAdapter |
||||
implements IHypTokenAdapter |
||||
{ |
||||
constructor( |
||||
public readonly chainName: ChainName, |
||||
public readonly multiProvider: MultiProtocolProvider<any>, |
||||
public readonly addresses: { token: Address; warpRouter: Address }, |
||||
public readonly gasDenom = 'untrn', |
||||
) { |
||||
super(chainName, multiProvider, addresses); |
||||
} |
||||
|
||||
async queryRouter<R extends TokenRouterResponse>( |
||||
msg: WarpCw20Query, |
||||
): Promise<R> { |
||||
const provider = await this.getProvider(); |
||||
const response: R = await provider.queryContractSmart( |
||||
this.addresses.warpRouter, |
||||
msg, |
||||
); |
||||
return response; |
||||
} |
||||
|
||||
prepareRouter(msg: WarpCw20Execute, funds?: Coin[]): ExecuteInstruction { |
||||
return { |
||||
contractAddress: this.addresses.warpRouter, |
||||
msg, |
||||
funds, |
||||
}; |
||||
} |
||||
|
||||
async tokenType(): Promise<TokenType> { |
||||
const resp = await this.queryRouter<TokenTypeResponse>({ |
||||
token_default: { |
||||
token_type: {}, |
||||
}, |
||||
}); |
||||
return resp.type; |
||||
} |
||||
|
||||
async interchainSecurityModule(): Promise<Address> { |
||||
throw new Error('Router does not support ISM config yet.'); |
||||
} |
||||
|
||||
async owner(): Promise<Address> { |
||||
const resp = await this.queryRouter<OwnerResponse>({ |
||||
ownable: { |
||||
get_owner: {}, |
||||
}, |
||||
}); |
||||
return resp.owner; |
||||
} |
||||
|
||||
async getDomains(): Promise<Domain[]> { |
||||
const resp = await this.queryRouter<DomainsResponse>({ |
||||
router: { |
||||
domains: {}, |
||||
}, |
||||
}); |
||||
return resp.domains; |
||||
} |
||||
|
||||
async getRouterAddress(domain: Domain): Promise<Buffer> { |
||||
const resp = await this.queryRouter<RouteResponseForHexBinary>({ |
||||
router: { |
||||
get_route: { |
||||
domain, |
||||
}, |
||||
}, |
||||
}); |
||||
const route = resp.route.route; |
||||
if (!route) { |
||||
throw new Error(`No route found for domain ${domain}`); |
||||
} |
||||
return Buffer.from(route, 'hex'); |
||||
} |
||||
|
||||
async getAllRouters(): Promise<Array<{ domain: Domain; address: Buffer }>> { |
||||
const resp = await this.queryRouter<RoutesResponseForHexBinary>({ |
||||
router: { |
||||
list_routes: {}, |
||||
}, |
||||
}); |
||||
return resp.routes |
||||
.filter((r) => r.route != null) |
||||
.map((r) => ({ |
||||
domain: r.domain, |
||||
address: Buffer.from(r.route!, 'hex'), |
||||
})); |
||||
} |
||||
|
||||
quoteGasPayment(_destination: number): Promise<string> { |
||||
throw new Error('Method not implemented.'); |
||||
} |
||||
|
||||
populateTransferRemoteTx({ |
||||
destination, |
||||
recipient, |
||||
weiAmountOrId, |
||||
txValue, |
||||
}: TransferRemoteParams): ExecuteInstruction { |
||||
if (!txValue) { |
||||
throw new Error('txValue is required for native tokens'); |
||||
} |
||||
return this.prepareRouter( |
||||
{ |
||||
transfer_remote: { |
||||
dest_domain: destination, |
||||
recipient: strip0x(addressToBytes32(recipient)), |
||||
amount: weiAmountOrId.toString(), |
||||
}, |
||||
}, |
||||
[ |
||||
{ |
||||
amount: txValue.toString(), |
||||
denom: this.gasDenom, |
||||
}, |
||||
], |
||||
); |
||||
} |
||||
} |
||||
|
||||
export class CwHypNativeAdapter |
||||
extends CwNativeTokenAdapter |
||||
implements IHypTokenAdapter |
||||
{ |
||||
private readonly cw20adapter: CwHypSyntheticAdapter; |
||||
|
||||
constructor( |
||||
public readonly chainName: ChainName, |
||||
public readonly multiProvider: MultiProtocolProvider<any>, |
||||
public readonly addresses: { warpRouter: Address }, |
||||
public readonly gasDenom = 'untrn', |
||||
) { |
||||
super(chainName, multiProvider, addresses, gasDenom); |
||||
this.cw20adapter = new CwHypSyntheticAdapter( |
||||
chainName, |
||||
multiProvider, |
||||
{ token: '', warpRouter: addresses.warpRouter }, |
||||
gasDenom, |
||||
); |
||||
} |
||||
|
||||
async getBalance(address: string): Promise<string> { |
||||
const provider = await this.getProvider(); |
||||
const denom = await this.denom(); |
||||
const balance = await provider.getBalance(address, denom); |
||||
return balance.amount; |
||||
} |
||||
|
||||
async interchainSecurityModule(): Promise<Address> { |
||||
return this.cw20adapter.interchainSecurityModule(); |
||||
} |
||||
|
||||
async owner(): Promise<Address> { |
||||
return this.cw20adapter.owner(); |
||||
} |
||||
|
||||
async getDomains(): Promise<Domain[]> { |
||||
return this.cw20adapter.getDomains(); |
||||
} |
||||
|
||||
async getRouterAddress(domain: Domain): Promise<Buffer> { |
||||
return this.cw20adapter.getRouterAddress(domain); |
||||
} |
||||
|
||||
async getAllRouters(): Promise<Array<{ domain: Domain; address: Buffer }>> { |
||||
return this.cw20adapter.getAllRouters(); |
||||
} |
||||
|
||||
quoteGasPayment(destination: number): Promise<string> { |
||||
return this.cw20adapter.quoteGasPayment(destination); |
||||
} |
||||
|
||||
async denom(): Promise<string> { |
||||
const tokenType = await this.cw20adapter.tokenType(); |
||||
if ('native' in tokenType) { |
||||
if ('fungible' in tokenType.native) { |
||||
return tokenType.native.fungible.denom; |
||||
} |
||||
} |
||||
|
||||
throw new Error(`Token type not supported: ${tokenType}`); |
||||
} |
||||
|
||||
async populateTransferRemoteTx({ |
||||
destination, |
||||
recipient, |
||||
weiAmountOrId, |
||||
txValue, |
||||
}: TransferRemoteParams): Promise<ExecuteInstruction> { |
||||
if (!txValue) { |
||||
throw new Error('txValue is required for native tokens'); |
||||
} |
||||
|
||||
const collateralDenom = await this.denom(); |
||||
return this.cw20adapter.prepareRouter( |
||||
{ |
||||
transfer_remote: { |
||||
dest_domain: destination, |
||||
recipient: strip0x(addressToBytes32(recipient)), |
||||
amount: weiAmountOrId.toString(), |
||||
}, |
||||
}, |
||||
[ |
||||
{ |
||||
amount: weiAmountOrId.toString(), |
||||
denom: collateralDenom, |
||||
}, |
||||
{ |
||||
amount: txValue.toString(), |
||||
denom: this.gasDenom, |
||||
}, |
||||
], |
||||
); |
||||
} |
||||
} |
||||
|
||||
export class CwHypCollateralAdapter |
||||
extends CwHypNativeAdapter |
||||
implements IHypTokenAdapter |
||||
{ |
||||
constructor( |
||||
public readonly chainName: ChainName, |
||||
public readonly multiProvider: MultiProtocolProvider<any>, |
||||
public readonly addresses: { warpRouter: Address; token: Address }, |
||||
public readonly gasDenom = 'untrn', |
||||
) { |
||||
super(chainName, multiProvider, addresses, gasDenom); |
||||
} |
||||
} |
@ -0,0 +1,65 @@ |
||||
import { MsgTransferEncodeObject } from '@cosmjs/stargate'; |
||||
import { MsgTransfer } from 'cosmjs-types/ibc/applications/transfer/v1/tx'; |
||||
|
||||
import { Address } from '@hyperlane-xyz/utils'; |
||||
|
||||
import { BaseCosmosAdapter } from '../../app/MultiProtocolApp'; |
||||
import { MultiProtocolProvider } from '../../providers/MultiProtocolProvider'; |
||||
import { MinimalTokenMetadata } from '../config'; |
||||
|
||||
import { ITokenAdapter, TransferParams } from './ITokenAdapter'; |
||||
|
||||
// Interacts with IBC denom tokens
|
||||
export class NativeTokenAdapter |
||||
extends BaseCosmosAdapter |
||||
implements ITokenAdapter |
||||
{ |
||||
constructor( |
||||
public readonly chainName: string, |
||||
public readonly multiProvider: MultiProtocolProvider, |
||||
public readonly addresses: Record<string, Address>, |
||||
public readonly ibcDenom: string = 'untrn', |
||||
) { |
||||
super(chainName, multiProvider, addresses); |
||||
} |
||||
|
||||
async getBalance(address: string): Promise<string> { |
||||
const provider = await this.getProvider(); |
||||
const coin = await provider.getBalance(address, this.ibcDenom); |
||||
return coin.amount; |
||||
} |
||||
|
||||
getMetadata(): Promise<MinimalTokenMetadata> { |
||||
throw new Error('Metadata not available to native tokens'); |
||||
} |
||||
|
||||
populateApproveTx(_transferParams: TransferParams): unknown { |
||||
throw new Error('Approve not required for native tokens'); |
||||
} |
||||
|
||||
async populateTransferTx( |
||||
transferParams: TransferParams, |
||||
): Promise<MsgTransferEncodeObject> { |
||||
const transfer: MsgTransfer = { |
||||
sourcePort: '', |
||||
sourceChannel: '', |
||||
token: { |
||||
denom: this.ibcDenom, |
||||
amount: transferParams.weiAmountOrId.toString(), |
||||
}, |
||||
sender: '', |
||||
receiver: '', |
||||
timeoutHeight: { |
||||
revisionNumber: 0n, |
||||
revisionHeight: 0n, |
||||
}, |
||||
timeoutTimestamp: 0n, |
||||
memo: '', // how to encode this?
|
||||
}; |
||||
return { |
||||
typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', |
||||
// @ts-ignore
|
||||
value: transfer, |
||||
}; |
||||
} |
||||
} |
Loading…
Reference in new issue