@hyperlane-xyz/radix-sdk 0.0.0-beta-20251201221151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/dist/clients/protocol.d.ts +9 -0
- package/dist/clients/protocol.d.ts.map +1 -0
- package/dist/clients/protocol.js +23 -0
- package/dist/clients/protocol.js.map +1 -0
- package/dist/clients/provider.d.ts +77 -0
- package/dist/clients/provider.d.ts.map +1 -0
- package/dist/clients/provider.js +486 -0
- package/dist/clients/provider.js.map +1 -0
- package/dist/clients/signer.d.ts +49 -0
- package/dist/clients/signer.d.ts.map +1 -0
- package/dist/clients/signer.js +319 -0
- package/dist/clients/signer.js.map +1 -0
- package/dist/core/populate.d.ts +100 -0
- package/dist/core/populate.d.ts.map +1 -0
- package/dist/core/populate.js +100 -0
- package/dist/core/populate.js.map +1 -0
- package/dist/core/query.d.ts +69 -0
- package/dist/core/query.d.ts.map +1 -0
- package/dist/core/query.js +187 -0
- package/dist/core/query.js.map +1 -0
- package/dist/core/tx.d.ts +84 -0
- package/dist/core/tx.d.ts.map +1 -0
- package/dist/core/tx.js +164 -0
- package/dist/core/tx.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/base.d.ts +65 -0
- package/dist/utils/base.d.ts.map +1 -0
- package/dist/utils/base.js +369 -0
- package/dist/utils/base.js.map +1 -0
- package/dist/utils/signer.d.ts +16 -0
- package/dist/utils/signer.d.ts.map +1 -0
- package/dist/utils/signer.js +56 -0
- package/dist/utils/signer.js.map +1 -0
- package/dist/utils/types.d.ts +93 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +23 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/utils.d.ts +8 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +47 -0
- package/dist/utils/utils.js.map +1 -0
- package/dist/utils/utils.test.d.ts +2 -0
- package/dist/utils/utils.test.d.ts.map +1 -0
- package/dist/utils/utils.test.js +27 -0
- package/dist/utils/utils.test.js.map +1 -0
- package/dist/warp/populate.d.ts +71 -0
- package/dist/warp/populate.d.ts.map +1 -0
- package/dist/warp/populate.js +107 -0
- package/dist/warp/populate.js.map +1 -0
- package/dist/warp/query.d.ts +44 -0
- package/dist/warp/query.d.ts.map +1 -0
- package/dist/warp/query.js +154 -0
- package/dist/warp/query.js.map +1 -0
- package/dist/warp/tx.d.ts +54 -0
- package/dist/warp/tx.d.ts.map +1 -0
- package/dist/warp/tx.js +85 -0
- package/dist/warp/tx.js.map +1 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Hyperlane Radix SDK
|
|
2
|
+
|
|
3
|
+
The Hyperlane Radix SDK is a fully typed TypeScript SDK for the [Radix Implementation](https://github.com/hyperlane-xyz/hyperlane-radix).
|
|
4
|
+
It can be used as a standalone SDK for frontend or in backend applications which want to connect to a Radix chain which has the Hyperlane blueprint installed.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Install with NPM
|
|
10
|
+
npm install @hyperlane-xyz/radix-sdk
|
|
11
|
+
|
|
12
|
+
# Or with Yarn
|
|
13
|
+
yarn add @hyperlane-xyz/radix-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { RadixSDK, RadixSigningSDK } from "@hyperlane-xyz/radix-sdk";
|
|
20
|
+
|
|
21
|
+
const signingSdk = await RadixSigningSDK.fromPrivateKey(
|
|
22
|
+
PRIV_KEY,
|
|
23
|
+
{
|
|
24
|
+
networkId: NetworkId.Stokenet,
|
|
25
|
+
},
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const mailboxAddress = await signingSdk.tx.createMailbox({ domain_id: 75898670 });
|
|
29
|
+
|
|
30
|
+
const mailbox = await signingSdk.query.getMailbox({ mailbox: mailboxAddress });
|
|
31
|
+
...
|
|
32
|
+
|
|
33
|
+
// performing queries without signer
|
|
34
|
+
const sdk = new RadixSDK({
|
|
35
|
+
networkId: NetworkId.Stokenet,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const mailbox = await signingSdk.query.getMailbox({ mailbox: mailboxAddress });
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Setup
|
|
42
|
+
|
|
43
|
+
Node 18 or newer is required.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AltVM, ChainMetadataForAltVM, ITransactionSubmitter, ProtocolProvider, SignerConfig, TransactionSubmitterConfig } from '@hyperlane-xyz/provider-sdk';
|
|
2
|
+
import { IProvider } from '@hyperlane-xyz/provider-sdk/altvm';
|
|
3
|
+
import { AnnotatedTx, TxReceipt } from '@hyperlane-xyz/provider-sdk/module';
|
|
4
|
+
export declare class RadixProtocolProvider implements ProtocolProvider {
|
|
5
|
+
createProvider(chainMetadata: ChainMetadataForAltVM): Promise<IProvider>;
|
|
6
|
+
createSigner(chainMetadata: ChainMetadataForAltVM, config: SignerConfig): Promise<AltVM.ISigner<AnnotatedTx, TxReceipt>>;
|
|
7
|
+
createSubmitter<TConfig extends TransactionSubmitterConfig>(_chainMetadata: ChainMetadataForAltVM, _config: TConfig): Promise<ITransactionSubmitter>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/clients/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAM5E,qBAAa,qBAAsB,YAAW,gBAAgB;IAC5D,cAAc,CAAC,aAAa,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IAQlE,YAAY,CAChB,aAAa,EAAE,qBAAqB,EACpC,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAQjD,eAAe,CAAC,OAAO,SAAS,0BAA0B,EACxD,cAAc,EAAE,qBAAqB,EACrC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC;CAIlC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { assert } from '@hyperlane-xyz/utils';
|
|
2
|
+
import { RadixProvider } from './provider.js';
|
|
3
|
+
import { RadixSigner } from './signer.js';
|
|
4
|
+
export class RadixProtocolProvider {
|
|
5
|
+
createProvider(chainMetadata) {
|
|
6
|
+
assert(chainMetadata.rpcUrls, 'rpc urls undefined');
|
|
7
|
+
const rpcUrls = chainMetadata.rpcUrls.map((rpc) => rpc.http);
|
|
8
|
+
return RadixProvider.connect(rpcUrls, chainMetadata.chainId, {
|
|
9
|
+
metadata: chainMetadata,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
async createSigner(chainMetadata, config) {
|
|
13
|
+
assert(chainMetadata.rpcUrls, 'rpc urls undefined');
|
|
14
|
+
const rpcUrls = chainMetadata.rpcUrls.map((rpc) => rpc.http);
|
|
15
|
+
const { privateKey, ...extraParams } = config;
|
|
16
|
+
return RadixSigner.connectWithSigner(rpcUrls, privateKey, extraParams);
|
|
17
|
+
}
|
|
18
|
+
createSubmitter(_chainMetadata, _config) {
|
|
19
|
+
// @TODO Implement in a follow up PR
|
|
20
|
+
throw Error('Not implemented');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/clients/protocol.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,OAAO,qBAAqB;IAChC,cAAc,CAAC,aAAoC;QACjD,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC7D,OAAO,aAAa,CAAC,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE;YAC3D,QAAQ,EAAE,aAAa;SACxB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,aAAoC,EACpC,MAAoB;QAEpB,MAAM,CAAC,aAAa,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAE7D,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,EAAE,GAAG,MAAM,CAAC;QAC9C,OAAO,WAAW,CAAC,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IACzE,CAAC;IAED,eAAe,CACb,cAAqC,EACrC,OAAgB;QAEhB,oCAAoC;QACpC,MAAM,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { GatewayApiClient } from '@radixdlt/babylon-gateway-api-sdk';
|
|
2
|
+
import { AltVM } from '@hyperlane-xyz/provider-sdk';
|
|
3
|
+
import { RadixCorePopulate } from '../core/populate.js';
|
|
4
|
+
import { RadixCoreQuery } from '../core/query.js';
|
|
5
|
+
import { RadixBase } from '../utils/base.js';
|
|
6
|
+
import { RadixSDKOptions, RadixSDKTransaction } from '../utils/types.js';
|
|
7
|
+
import { RadixWarpPopulate } from '../warp/populate.js';
|
|
8
|
+
import { RadixWarpQuery } from '../warp/query.js';
|
|
9
|
+
export declare class RadixProvider implements AltVM.IProvider<RadixSDKTransaction> {
|
|
10
|
+
protected rpcUrls: string[];
|
|
11
|
+
protected networkId: number;
|
|
12
|
+
protected gateway: GatewayApiClient;
|
|
13
|
+
protected applicationName: string;
|
|
14
|
+
protected packageAddress: string;
|
|
15
|
+
protected base: RadixBase;
|
|
16
|
+
protected query: {
|
|
17
|
+
core: RadixCoreQuery;
|
|
18
|
+
warp: RadixWarpQuery;
|
|
19
|
+
};
|
|
20
|
+
protected populate: {
|
|
21
|
+
core: RadixCorePopulate;
|
|
22
|
+
warp: RadixWarpPopulate;
|
|
23
|
+
};
|
|
24
|
+
static connect(rpcUrls: string[], chainId: string | number, extraParams?: Record<string, any>): Promise<RadixProvider>;
|
|
25
|
+
constructor(options: RadixSDKOptions);
|
|
26
|
+
isHealthy(): Promise<boolean>;
|
|
27
|
+
getRpcUrls(): string[];
|
|
28
|
+
getHeight(): Promise<number>;
|
|
29
|
+
getBalance(req: AltVM.ReqGetBalance): Promise<bigint>;
|
|
30
|
+
getTotalSupply(req: AltVM.ReqGetTotalSupply): Promise<bigint>;
|
|
31
|
+
estimateTransactionFee(req: AltVM.ReqEstimateTransactionFee<RadixSDKTransaction>): Promise<AltVM.ResEstimateTransactionFee>;
|
|
32
|
+
getMailbox(req: AltVM.ReqGetMailbox): Promise<AltVM.ResGetMailbox>;
|
|
33
|
+
isMessageDelivered(req: AltVM.ReqIsMessageDelivered): Promise<boolean>;
|
|
34
|
+
getIsmType(req: AltVM.ReqGetIsmType): Promise<AltVM.IsmType>;
|
|
35
|
+
getMessageIdMultisigIsm(req: AltVM.ReqMessageIdMultisigIsm): Promise<AltVM.ResMessageIdMultisigIsm>;
|
|
36
|
+
getMerkleRootMultisigIsm(req: AltVM.ReqMerkleRootMultisigIsm): Promise<AltVM.ResMerkleRootMultisigIsm>;
|
|
37
|
+
getRoutingIsm(req: AltVM.ReqRoutingIsm): Promise<AltVM.ResRoutingIsm>;
|
|
38
|
+
getNoopIsm(req: AltVM.ReqNoopIsm): Promise<AltVM.ResNoopIsm>;
|
|
39
|
+
getHookType(req: AltVM.ReqGetHookType): Promise<AltVM.HookType>;
|
|
40
|
+
getInterchainGasPaymasterHook(req: AltVM.ReqGetInterchainGasPaymasterHook): Promise<AltVM.ResGetInterchainGasPaymasterHook>;
|
|
41
|
+
getMerkleTreeHook(req: AltVM.ReqGetMerkleTreeHook): Promise<AltVM.ResGetMerkleTreeHook>;
|
|
42
|
+
getNoopHook(_req: AltVM.ReqGetNoopHook): Promise<AltVM.ResGetNoopHook>;
|
|
43
|
+
getToken(req: AltVM.ReqGetToken): Promise<AltVM.ResGetToken>;
|
|
44
|
+
getRemoteRouters(req: AltVM.ReqGetRemoteRouters): Promise<AltVM.ResGetRemoteRouters>;
|
|
45
|
+
getBridgedSupply(req: AltVM.ReqGetBridgedSupply): Promise<bigint>;
|
|
46
|
+
quoteRemoteTransfer(req: AltVM.ReqQuoteRemoteTransfer): Promise<AltVM.ResQuoteRemoteTransfer>;
|
|
47
|
+
getCreateMailboxTransaction(req: AltVM.ReqCreateMailbox): Promise<RadixSDKTransaction>;
|
|
48
|
+
getSetDefaultIsmTransaction(req: AltVM.ReqSetDefaultIsm): Promise<RadixSDKTransaction>;
|
|
49
|
+
getSetDefaultHookTransaction(req: AltVM.ReqSetDefaultHook): Promise<RadixSDKTransaction>;
|
|
50
|
+
getSetRequiredHookTransaction(req: AltVM.ReqSetRequiredHook): Promise<RadixSDKTransaction>;
|
|
51
|
+
getSetMailboxOwnerTransaction(req: AltVM.ReqSetMailboxOwner): Promise<RadixSDKTransaction>;
|
|
52
|
+
getCreateMerkleRootMultisigIsmTransaction(req: AltVM.ReqCreateMerkleRootMultisigIsm): Promise<RadixSDKTransaction>;
|
|
53
|
+
getCreateMessageIdMultisigIsmTransaction(req: AltVM.ReqCreateMessageIdMultisigIsm): Promise<RadixSDKTransaction>;
|
|
54
|
+
getCreateRoutingIsmTransaction(req: AltVM.ReqCreateRoutingIsm): Promise<RadixSDKTransaction>;
|
|
55
|
+
getSetRoutingIsmRouteTransaction(req: AltVM.ReqSetRoutingIsmRoute): Promise<RadixSDKTransaction>;
|
|
56
|
+
getRemoveRoutingIsmRouteTransaction(req: AltVM.ReqRemoveRoutingIsmRoute): Promise<RadixSDKTransaction>;
|
|
57
|
+
getSetRoutingIsmOwnerTransaction(req: AltVM.ReqSetRoutingIsmOwner): Promise<RadixSDKTransaction>;
|
|
58
|
+
getCreateNoopIsmTransaction(req: AltVM.ReqCreateNoopIsm): Promise<RadixSDKTransaction>;
|
|
59
|
+
getCreateMerkleTreeHookTransaction(req: AltVM.ReqCreateMerkleTreeHook): Promise<RadixSDKTransaction>;
|
|
60
|
+
getCreateInterchainGasPaymasterHookTransaction(req: AltVM.ReqCreateInterchainGasPaymasterHook): Promise<RadixSDKTransaction>;
|
|
61
|
+
getSetInterchainGasPaymasterHookOwnerTransaction(req: AltVM.ReqSetInterchainGasPaymasterHookOwner): Promise<RadixSDKTransaction>;
|
|
62
|
+
getSetDestinationGasConfigTransaction(req: AltVM.ReqSetDestinationGasConfig): Promise<RadixSDKTransaction>;
|
|
63
|
+
getRemoveDestinationGasConfigTransaction(_req: AltVM.ReqRemoveDestinationGasConfig): Promise<RadixSDKTransaction>;
|
|
64
|
+
getCreateNoopHookTransaction(_req: AltVM.ReqCreateNoopHook): Promise<RadixSDKTransaction>;
|
|
65
|
+
getCreateValidatorAnnounceTransaction(req: AltVM.ReqCreateValidatorAnnounce): Promise<RadixSDKTransaction>;
|
|
66
|
+
getCreateNativeTokenTransaction(_req: AltVM.ReqCreateNativeToken): Promise<RadixSDKTransaction>;
|
|
67
|
+
getCreateCollateralTokenTransaction(req: AltVM.ReqCreateCollateralToken): Promise<RadixSDKTransaction>;
|
|
68
|
+
getCreateSyntheticTokenTransaction(req: AltVM.ReqCreateSyntheticToken): Promise<RadixSDKTransaction>;
|
|
69
|
+
getSetTokenOwnerTransaction(req: AltVM.ReqSetTokenOwner): Promise<RadixSDKTransaction>;
|
|
70
|
+
getSetTokenIsmTransaction(req: AltVM.ReqSetTokenIsm): Promise<RadixSDKTransaction>;
|
|
71
|
+
getSetTokenHookTransaction(_req: AltVM.ReqSetTokenHook): Promise<RadixSDKTransaction>;
|
|
72
|
+
getEnrollRemoteRouterTransaction(req: AltVM.ReqEnrollRemoteRouter): Promise<RadixSDKTransaction>;
|
|
73
|
+
getUnenrollRemoteRouterTransaction(req: AltVM.ReqUnenrollRemoteRouter): Promise<RadixSDKTransaction>;
|
|
74
|
+
getTransferTransaction(req: AltVM.ReqTransfer): Promise<RadixSDKTransaction>;
|
|
75
|
+
getRemoteTransferTransaction(req: AltVM.ReqRemoteTransfer): Promise<RadixSDKTransaction>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/clients/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAGpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAGL,eAAe,EACf,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,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EAAE,KAAK,CAAC,WAAW,GACrB,OAAO,CAAC,mBAAmB,CAAC;IAczB,4BAA4B,CAChC,GAAG,EAAE,KAAK,CAAC,iBAAiB,GAC3B,OAAO,CAAC,mBAAmB,CAAC;CAmBhC"}
|
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { GatewayApiClient } from '@radixdlt/babylon-gateway-api-sdk';
|
|
2
|
+
import { NetworkId } from '@radixdlt/radix-engine-toolkit';
|
|
3
|
+
import { AltVM } from '@hyperlane-xyz/provider-sdk';
|
|
4
|
+
import { assert } from '@hyperlane-xyz/utils';
|
|
5
|
+
import { RadixCorePopulate } from '../core/populate.js';
|
|
6
|
+
import { RadixCoreQuery } from '../core/query.js';
|
|
7
|
+
import { RadixBase } from '../utils/base.js';
|
|
8
|
+
import { RadixHookTypes, RadixIsmTypes, } from '../utils/types.js';
|
|
9
|
+
import { RadixWarpPopulate } from '../warp/populate.js';
|
|
10
|
+
import { RadixWarpQuery } from '../warp/query.js';
|
|
11
|
+
const DEFAULT_GAS_MULTIPLIER = 1.2;
|
|
12
|
+
const NETWORKS = {
|
|
13
|
+
[NetworkId.Stokenet]: {
|
|
14
|
+
applicationName: 'hyperlane',
|
|
15
|
+
packageAddress: 'package_tdx_2_1pkn2zdcw8q8rax6mxetdkgp7493mf379afhq7a7peh4wnftz3zej4h',
|
|
16
|
+
},
|
|
17
|
+
[NetworkId.Mainnet]: {
|
|
18
|
+
applicationName: 'hyperlane',
|
|
19
|
+
packageAddress: 'package_rdx1pkzmcj4mtal34ddx9jrt8um6u3yqheqpfvcj4s0ulmgyt094fw0jzh',
|
|
20
|
+
},
|
|
21
|
+
[NetworkId.LocalNet]: {
|
|
22
|
+
applicationName: 'hyperlane',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export class RadixProvider {
|
|
26
|
+
rpcUrls;
|
|
27
|
+
networkId;
|
|
28
|
+
gateway;
|
|
29
|
+
applicationName;
|
|
30
|
+
packageAddress;
|
|
31
|
+
base;
|
|
32
|
+
query;
|
|
33
|
+
populate;
|
|
34
|
+
static async connect(rpcUrls, chainId, extraParams) {
|
|
35
|
+
const networkId = parseInt(chainId.toString());
|
|
36
|
+
return new RadixProvider({
|
|
37
|
+
rpcUrls,
|
|
38
|
+
networkId,
|
|
39
|
+
gatewayUrls: extraParams?.metadata?.gatewayUrls?.map(({ http }) => http),
|
|
40
|
+
packageAddress: extraParams?.metadata?.packageAddress,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
constructor(options) {
|
|
44
|
+
this.rpcUrls = options.rpcUrls;
|
|
45
|
+
this.networkId = options.networkId ?? NetworkId.Mainnet;
|
|
46
|
+
const networkBaseConfig = NETWORKS[this.networkId];
|
|
47
|
+
assert(networkBaseConfig, `Network with id ${this.networkId} not supported with the Hyperlane RadixSDK. Supported network ids: ${Object.keys(NETWORKS).join(', ')}`);
|
|
48
|
+
this.applicationName = networkBaseConfig.applicationName;
|
|
49
|
+
const packageAddress = options.packageAddress ?? networkBaseConfig.packageAddress;
|
|
50
|
+
assert(packageAddress, `Expected package address to be defined for radix network with id ${this.networkId}`);
|
|
51
|
+
this.packageAddress = packageAddress;
|
|
52
|
+
this.gateway = GatewayApiClient.initialize({
|
|
53
|
+
applicationName: this.applicationName,
|
|
54
|
+
basePath: options.gatewayUrls?.[0],
|
|
55
|
+
networkId: this.networkId,
|
|
56
|
+
});
|
|
57
|
+
this.base = new RadixBase(this.networkId, this.gateway, options.gasMultiplier ?? DEFAULT_GAS_MULTIPLIER);
|
|
58
|
+
this.query = {
|
|
59
|
+
core: new RadixCoreQuery(this.networkId, this.gateway, this.base),
|
|
60
|
+
warp: new RadixWarpQuery(this.networkId, this.gateway, this.base),
|
|
61
|
+
};
|
|
62
|
+
this.populate = {
|
|
63
|
+
core: new RadixCorePopulate(this.gateway, this.base, this.packageAddress),
|
|
64
|
+
warp: new RadixWarpPopulate(this.gateway, this.base, this.query.warp, this.packageAddress),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
// ### QUERY BASE ###
|
|
68
|
+
async isHealthy() {
|
|
69
|
+
return this.base.isGatewayHealthy();
|
|
70
|
+
}
|
|
71
|
+
getRpcUrls() {
|
|
72
|
+
return this.rpcUrls;
|
|
73
|
+
}
|
|
74
|
+
// in RadixDLT there are no blocks, but we can use the ledger state version
|
|
75
|
+
// which has a similar concept
|
|
76
|
+
async getHeight() {
|
|
77
|
+
return this.base.getStateVersion();
|
|
78
|
+
}
|
|
79
|
+
async getBalance(req) {
|
|
80
|
+
assert(req.denom, `denom required by ${RadixProvider.name}`);
|
|
81
|
+
return this.base.getBalance({
|
|
82
|
+
address: req.address,
|
|
83
|
+
resource: req.denom,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async getTotalSupply(req) {
|
|
87
|
+
assert(req.denom, `denom required by ${RadixProvider.name}`);
|
|
88
|
+
return this.base.getTotalSupply({
|
|
89
|
+
resource: req.denom,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
async estimateTransactionFee(req) {
|
|
93
|
+
return this.base.estimateTransactionFee({
|
|
94
|
+
transactionManifest: req.transaction.manifest,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
// ### QUERY CORE ###
|
|
98
|
+
async getMailbox(req) {
|
|
99
|
+
return this.query.core.getMailbox({ mailbox: req.mailboxAddress });
|
|
100
|
+
}
|
|
101
|
+
async isMessageDelivered(req) {
|
|
102
|
+
return this.query.core.isMessageDelivered({
|
|
103
|
+
mailbox: req.mailboxAddress,
|
|
104
|
+
message_id: req.messageId,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async getIsmType(req) {
|
|
108
|
+
const ismType = await this.query.core.getIsmType({
|
|
109
|
+
ism: req.ismAddress,
|
|
110
|
+
});
|
|
111
|
+
switch (ismType) {
|
|
112
|
+
case RadixIsmTypes.MERKLE_ROOT_MULTISIG: {
|
|
113
|
+
return AltVM.IsmType.MERKLE_ROOT_MULTISIG;
|
|
114
|
+
}
|
|
115
|
+
case RadixIsmTypes.MESSAGE_ID_MULTISIG: {
|
|
116
|
+
return AltVM.IsmType.MESSAGE_ID_MULTISIG;
|
|
117
|
+
}
|
|
118
|
+
case RadixIsmTypes.ROUTING_ISM: {
|
|
119
|
+
return AltVM.IsmType.ROUTING;
|
|
120
|
+
}
|
|
121
|
+
case RadixIsmTypes.NOOP_ISM: {
|
|
122
|
+
return AltVM.IsmType.TEST_ISM;
|
|
123
|
+
}
|
|
124
|
+
default:
|
|
125
|
+
throw new Error(`Unknown ISM ModuleType: ${ismType}`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async getMessageIdMultisigIsm(req) {
|
|
129
|
+
const ism = await this.query.core.getMultisigIsm({ ism: req.ismAddress });
|
|
130
|
+
assert(ism.type === RadixIsmTypes.MESSAGE_ID_MULTISIG, `ism with address ${req.ismAddress} is no ${RadixIsmTypes.MESSAGE_ID_MULTISIG}`);
|
|
131
|
+
return {
|
|
132
|
+
address: ism.address,
|
|
133
|
+
validators: ism.validators,
|
|
134
|
+
threshold: ism.threshold,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
async getMerkleRootMultisigIsm(req) {
|
|
138
|
+
const ism = await this.query.core.getMultisigIsm({ ism: req.ismAddress });
|
|
139
|
+
assert(ism.type === RadixIsmTypes.MERKLE_ROOT_MULTISIG, `ism with address ${req.ismAddress} is no ${RadixIsmTypes.MERKLE_ROOT_MULTISIG}`);
|
|
140
|
+
return {
|
|
141
|
+
address: ism.address,
|
|
142
|
+
validators: ism.validators,
|
|
143
|
+
threshold: ism.threshold,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
async getRoutingIsm(req) {
|
|
147
|
+
return this.query.core.getRoutingIsm({
|
|
148
|
+
ism: req.ismAddress,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
async getNoopIsm(req) {
|
|
152
|
+
const ism = await this.query.core.getMultisigIsm({ ism: req.ismAddress });
|
|
153
|
+
assert(ism.type === RadixIsmTypes.NOOP_ISM, `ism with address ${req.ismAddress} is no ${RadixIsmTypes.NOOP_ISM}`);
|
|
154
|
+
return {
|
|
155
|
+
address: req.ismAddress,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
async getHookType(req) {
|
|
159
|
+
const hookType = await this.query.core.getHookType({
|
|
160
|
+
hook: req.hookAddress,
|
|
161
|
+
});
|
|
162
|
+
switch (hookType) {
|
|
163
|
+
case RadixHookTypes.IGP: {
|
|
164
|
+
return AltVM.HookType.INTERCHAIN_GAS_PAYMASTER;
|
|
165
|
+
}
|
|
166
|
+
case RadixHookTypes.MERKLE_TREE: {
|
|
167
|
+
return AltVM.HookType.MERKLE_TREE;
|
|
168
|
+
}
|
|
169
|
+
default:
|
|
170
|
+
throw new Error(`Unknown Hook Type: ${hookType}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
async getInterchainGasPaymasterHook(req) {
|
|
174
|
+
return this.query.core.getIgpHook({ hook: req.hookAddress });
|
|
175
|
+
}
|
|
176
|
+
async getMerkleTreeHook(req) {
|
|
177
|
+
return this.query.core.getMerkleTreeHook({ hook: req.hookAddress });
|
|
178
|
+
}
|
|
179
|
+
async getNoopHook(_req) {
|
|
180
|
+
throw new Error(`Noop Hook is currently not supported on Radix`);
|
|
181
|
+
}
|
|
182
|
+
// ### QUERY WARP ###
|
|
183
|
+
async getToken(req) {
|
|
184
|
+
const token = await this.query.warp.getToken({ token: req.tokenAddress });
|
|
185
|
+
switch (token.tokenType) {
|
|
186
|
+
case 'Collateral':
|
|
187
|
+
return {
|
|
188
|
+
...token,
|
|
189
|
+
tokenType: AltVM.TokenType.collateral,
|
|
190
|
+
};
|
|
191
|
+
case 'Synthetic':
|
|
192
|
+
return {
|
|
193
|
+
...token,
|
|
194
|
+
tokenType: AltVM.TokenType.synthetic,
|
|
195
|
+
};
|
|
196
|
+
default:
|
|
197
|
+
throw new Error(`Unknown Token Type: ${token.tokenType}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async getRemoteRouters(req) {
|
|
201
|
+
return this.query.warp.getRemoteRouters({ token: req.tokenAddress });
|
|
202
|
+
}
|
|
203
|
+
async getBridgedSupply(req) {
|
|
204
|
+
return this.query.warp.getBridgedSupply({ token: req.tokenAddress });
|
|
205
|
+
}
|
|
206
|
+
async quoteRemoteTransfer(req) {
|
|
207
|
+
return this.query.warp.quoteRemoteTransfer({
|
|
208
|
+
token: req.tokenAddress,
|
|
209
|
+
destination_domain: req.destinationDomainId,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
// ### GET CORE TXS ###
|
|
213
|
+
async getCreateMailboxTransaction(req) {
|
|
214
|
+
return {
|
|
215
|
+
networkId: this.networkId,
|
|
216
|
+
manifest: await this.populate.core.createMailbox({
|
|
217
|
+
from_address: req.signer,
|
|
218
|
+
domain_id: req.domainId,
|
|
219
|
+
}),
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
async getSetDefaultIsmTransaction(req) {
|
|
223
|
+
return {
|
|
224
|
+
networkId: this.networkId,
|
|
225
|
+
manifest: await this.populate.core.setDefaultIsm({
|
|
226
|
+
from_address: req.signer,
|
|
227
|
+
mailbox: req.mailboxAddress,
|
|
228
|
+
ism: req.ismAddress,
|
|
229
|
+
}),
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
async getSetDefaultHookTransaction(req) {
|
|
233
|
+
return {
|
|
234
|
+
networkId: this.networkId,
|
|
235
|
+
manifest: await this.populate.core.setDefaultHook({
|
|
236
|
+
from_address: req.signer,
|
|
237
|
+
mailbox: req.mailboxAddress,
|
|
238
|
+
hook: req.hookAddress,
|
|
239
|
+
}),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
async getSetRequiredHookTransaction(req) {
|
|
243
|
+
return {
|
|
244
|
+
networkId: this.networkId,
|
|
245
|
+
manifest: await this.populate.core.setRequiredHook({
|
|
246
|
+
from_address: req.signer,
|
|
247
|
+
mailbox: req.mailboxAddress,
|
|
248
|
+
hook: req.hookAddress,
|
|
249
|
+
}),
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
async getSetMailboxOwnerTransaction(req) {
|
|
253
|
+
return {
|
|
254
|
+
networkId: this.networkId,
|
|
255
|
+
manifest: await this.populate.core.setMailboxOwner({
|
|
256
|
+
from_address: req.signer,
|
|
257
|
+
mailbox: req.mailboxAddress,
|
|
258
|
+
new_owner: req.newOwner,
|
|
259
|
+
}),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
async getCreateMerkleRootMultisigIsmTransaction(req) {
|
|
263
|
+
return {
|
|
264
|
+
networkId: this.networkId,
|
|
265
|
+
manifest: await this.populate.core.createMerkleRootMultisigIsm({
|
|
266
|
+
from_address: req.signer,
|
|
267
|
+
validators: req.validators,
|
|
268
|
+
threshold: req.threshold,
|
|
269
|
+
}),
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
async getCreateMessageIdMultisigIsmTransaction(req) {
|
|
273
|
+
return {
|
|
274
|
+
networkId: this.networkId,
|
|
275
|
+
manifest: await this.populate.core.createMessageIdMultisigIsm({
|
|
276
|
+
from_address: req.signer,
|
|
277
|
+
validators: req.validators,
|
|
278
|
+
threshold: req.threshold,
|
|
279
|
+
}),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
async getCreateRoutingIsmTransaction(req) {
|
|
283
|
+
return {
|
|
284
|
+
networkId: this.networkId,
|
|
285
|
+
manifest: await this.populate.core.createRoutingIsm({
|
|
286
|
+
from_address: req.signer,
|
|
287
|
+
routes: req.routes,
|
|
288
|
+
}),
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
async getSetRoutingIsmRouteTransaction(req) {
|
|
292
|
+
return {
|
|
293
|
+
networkId: this.networkId,
|
|
294
|
+
manifest: await this.populate.core.setRoutingIsmRoute({
|
|
295
|
+
from_address: req.signer,
|
|
296
|
+
ism: req.ismAddress,
|
|
297
|
+
route: req.route,
|
|
298
|
+
}),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
async getRemoveRoutingIsmRouteTransaction(req) {
|
|
302
|
+
return {
|
|
303
|
+
networkId: this.networkId,
|
|
304
|
+
manifest: await this.populate.core.removeRoutingIsmRoute({
|
|
305
|
+
from_address: req.signer,
|
|
306
|
+
ism: req.ismAddress,
|
|
307
|
+
domain: req.domainId,
|
|
308
|
+
}),
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
async getSetRoutingIsmOwnerTransaction(req) {
|
|
312
|
+
return {
|
|
313
|
+
networkId: this.networkId,
|
|
314
|
+
manifest: await this.populate.core.setRoutingIsmOwner({
|
|
315
|
+
from_address: req.signer,
|
|
316
|
+
ism: req.ismAddress,
|
|
317
|
+
new_owner: req.newOwner,
|
|
318
|
+
}),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
async getCreateNoopIsmTransaction(req) {
|
|
322
|
+
return {
|
|
323
|
+
networkId: this.networkId,
|
|
324
|
+
manifest: await this.populate.core.createNoopIsm({
|
|
325
|
+
from_address: req.signer,
|
|
326
|
+
}),
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
async getCreateMerkleTreeHookTransaction(req) {
|
|
330
|
+
return {
|
|
331
|
+
networkId: this.networkId,
|
|
332
|
+
manifest: await this.populate.core.createMerkleTreeHook({
|
|
333
|
+
from_address: req.signer,
|
|
334
|
+
mailbox: req.mailboxAddress,
|
|
335
|
+
}),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
async getCreateInterchainGasPaymasterHookTransaction(req) {
|
|
339
|
+
assert(req.denom, `denom required by ${RadixProvider.name}`);
|
|
340
|
+
return {
|
|
341
|
+
networkId: this.networkId,
|
|
342
|
+
manifest: await this.populate.core.createIgp({
|
|
343
|
+
from_address: req.signer,
|
|
344
|
+
denom: req.denom,
|
|
345
|
+
}),
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
async getSetInterchainGasPaymasterHookOwnerTransaction(req) {
|
|
349
|
+
return {
|
|
350
|
+
networkId: this.networkId,
|
|
351
|
+
manifest: await this.populate.core.setIgpOwner({
|
|
352
|
+
from_address: req.signer,
|
|
353
|
+
igp: req.hookAddress,
|
|
354
|
+
new_owner: req.newOwner,
|
|
355
|
+
}),
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
async getSetDestinationGasConfigTransaction(req) {
|
|
359
|
+
return {
|
|
360
|
+
networkId: this.networkId,
|
|
361
|
+
manifest: await this.populate.core.setDestinationGasConfig({
|
|
362
|
+
from_address: req.signer,
|
|
363
|
+
igp: req.hookAddress,
|
|
364
|
+
destinationGasConfig: req.destinationGasConfig,
|
|
365
|
+
}),
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async getRemoveDestinationGasConfigTransaction(_req) {
|
|
369
|
+
throw new Error(`RemoveDestinationGasConfig is currently not supported on Radix`);
|
|
370
|
+
}
|
|
371
|
+
async getCreateNoopHookTransaction(_req) {
|
|
372
|
+
throw new Error(`CreateNoopHook is currently not supported on Radix`);
|
|
373
|
+
}
|
|
374
|
+
async getCreateValidatorAnnounceTransaction(req) {
|
|
375
|
+
return {
|
|
376
|
+
networkId: this.networkId,
|
|
377
|
+
manifest: await this.populate.core.createValidatorAnnounce({
|
|
378
|
+
from_address: req.signer,
|
|
379
|
+
mailbox: req.mailboxAddress,
|
|
380
|
+
}),
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
// ### GET WARP TXS ###
|
|
384
|
+
async getCreateNativeTokenTransaction(_req) {
|
|
385
|
+
throw new Error(`Native Token is not supported on Radix`);
|
|
386
|
+
}
|
|
387
|
+
async getCreateCollateralTokenTransaction(req) {
|
|
388
|
+
return {
|
|
389
|
+
networkId: this.networkId,
|
|
390
|
+
manifest: await this.populate.warp.createCollateralToken({
|
|
391
|
+
from_address: req.signer,
|
|
392
|
+
mailbox: req.mailboxAddress,
|
|
393
|
+
origin_denom: req.collateralDenom,
|
|
394
|
+
}),
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
async getCreateSyntheticTokenTransaction(req) {
|
|
398
|
+
return {
|
|
399
|
+
networkId: this.networkId,
|
|
400
|
+
manifest: await this.populate.warp.createSyntheticToken({
|
|
401
|
+
from_address: req.signer,
|
|
402
|
+
mailbox: req.mailboxAddress,
|
|
403
|
+
name: req.name,
|
|
404
|
+
symbol: req.denom,
|
|
405
|
+
divisibility: req.decimals,
|
|
406
|
+
}),
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
async getSetTokenOwnerTransaction(req) {
|
|
410
|
+
return {
|
|
411
|
+
networkId: this.networkId,
|
|
412
|
+
manifest: await this.populate.warp.setTokenOwner({
|
|
413
|
+
from_address: req.signer,
|
|
414
|
+
token: req.tokenAddress,
|
|
415
|
+
new_owner: req.newOwner,
|
|
416
|
+
}),
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
async getSetTokenIsmTransaction(req) {
|
|
420
|
+
return {
|
|
421
|
+
networkId: this.networkId,
|
|
422
|
+
manifest: await this.populate.warp.setTokenIsm({
|
|
423
|
+
from_address: req.signer,
|
|
424
|
+
token: req.tokenAddress,
|
|
425
|
+
ism: req.ismAddress,
|
|
426
|
+
}),
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
async getSetTokenHookTransaction(_req) {
|
|
430
|
+
throw new Error(`SetTokenHook is currently not supported on Radix`);
|
|
431
|
+
}
|
|
432
|
+
async getEnrollRemoteRouterTransaction(req) {
|
|
433
|
+
return {
|
|
434
|
+
networkId: this.networkId,
|
|
435
|
+
manifest: await this.populate.warp.enrollRemoteRouter({
|
|
436
|
+
from_address: req.signer,
|
|
437
|
+
token: req.tokenAddress,
|
|
438
|
+
receiver_domain: req.remoteRouter.receiverDomainId,
|
|
439
|
+
receiver_address: req.remoteRouter.receiverAddress,
|
|
440
|
+
gas: req.remoteRouter.gas,
|
|
441
|
+
}),
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
async getUnenrollRemoteRouterTransaction(req) {
|
|
445
|
+
return {
|
|
446
|
+
networkId: this.networkId,
|
|
447
|
+
manifest: await this.populate.warp.unenrollRemoteRouter({
|
|
448
|
+
from_address: req.signer,
|
|
449
|
+
token: req.tokenAddress,
|
|
450
|
+
receiver_domain: req.receiverDomainId,
|
|
451
|
+
}),
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
async getTransferTransaction(req) {
|
|
455
|
+
assert(req.denom, `denom required by ${RadixProvider.name}`);
|
|
456
|
+
return {
|
|
457
|
+
networkId: this.networkId,
|
|
458
|
+
manifest: await this.base.transfer({
|
|
459
|
+
from_address: req.signer,
|
|
460
|
+
to_address: req.recipient,
|
|
461
|
+
amount: req.amount,
|
|
462
|
+
resource_address: req.denom,
|
|
463
|
+
}),
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
async getRemoteTransferTransaction(req) {
|
|
467
|
+
return {
|
|
468
|
+
networkId: this.networkId,
|
|
469
|
+
manifest: await this.populate.warp.remoteTransfer({
|
|
470
|
+
from_address: req.signer,
|
|
471
|
+
token: req.tokenAddress,
|
|
472
|
+
destination_domain: req.destinationDomainId,
|
|
473
|
+
recipient: req.recipient,
|
|
474
|
+
amount: req.amount,
|
|
475
|
+
custom_hook_id: req.customHookAddress || '',
|
|
476
|
+
gas_limit: req.gasLimit,
|
|
477
|
+
custom_hook_metadata: req.customHookMetadata || '',
|
|
478
|
+
max_fee: {
|
|
479
|
+
amount: req.maxFee.amount,
|
|
480
|
+
denom: req.maxFee.denom,
|
|
481
|
+
},
|
|
482
|
+
}),
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
//# sourceMappingURL=provider.js.map
|