@wormhole-foundation/sdk-connect 0.5.0-alpha.0
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/dist/cjs/circle-api.d.ts +16 -0
- package/dist/cjs/circle-api.d.ts.map +1 -0
- package/dist/cjs/circle-api.js +47 -0
- package/dist/cjs/circle-api.js.map +1 -0
- package/dist/cjs/common.d.ts +4 -0
- package/dist/cjs/common.d.ts.map +1 -0
- package/dist/cjs/common.js +40 -0
- package/dist/cjs/common.js.map +1 -0
- package/dist/cjs/config.d.ts +34 -0
- package/dist/cjs/config.d.ts.map +1 -0
- package/dist/cjs/config.js +52 -0
- package/dist/cjs/config.js.map +1 -0
- package/dist/cjs/index.d.ts +15 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +45 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/protocols/cctpTransfer.d.ts +41 -0
- package/dist/cjs/protocols/cctpTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/cctpTransfer.js +459 -0
- package/dist/cjs/protocols/cctpTransfer.js.map +1 -0
- package/dist/cjs/protocols/gatewayTransfer.d.ts +40 -0
- package/dist/cjs/protocols/gatewayTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/gatewayTransfer.js +406 -0
- package/dist/cjs/protocols/gatewayTransfer.js.map +1 -0
- package/dist/cjs/protocols/tokenTransfer.d.ts +40 -0
- package/dist/cjs/protocols/tokenTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/tokenTransfer.js +472 -0
- package/dist/cjs/protocols/tokenTransfer.js.map +1 -0
- package/dist/cjs/protocols/wormholeTransfer.d.ts +20 -0
- package/dist/cjs/protocols/wormholeTransfer.d.ts.map +1 -0
- package/dist/cjs/protocols/wormholeTransfer.js +3 -0
- package/dist/cjs/protocols/wormholeTransfer.js.map +1 -0
- package/dist/cjs/routes/cctp/automatic.d.ts +46 -0
- package/dist/cjs/routes/cctp/automatic.d.ts.map +1 -0
- package/dist/cjs/routes/cctp/automatic.js +135 -0
- package/dist/cjs/routes/cctp/automatic.js.map +1 -0
- package/dist/cjs/routes/cctp/index.d.ts +3 -0
- package/dist/cjs/routes/cctp/index.d.ts.map +1 -0
- package/dist/cjs/routes/cctp/index.js +19 -0
- package/dist/cjs/routes/cctp/index.js.map +1 -0
- package/dist/cjs/routes/cctp/manual.d.ts +43 -0
- package/dist/cjs/routes/cctp/manual.d.ts.map +1 -0
- package/dist/cjs/routes/cctp/manual.js +113 -0
- package/dist/cjs/routes/cctp/manual.js.map +1 -0
- package/dist/cjs/routes/common.d.ts +13 -0
- package/dist/cjs/routes/common.d.ts.map +1 -0
- package/dist/cjs/routes/common.js +45 -0
- package/dist/cjs/routes/common.js.map +1 -0
- package/dist/cjs/routes/index.d.ts +9 -0
- package/dist/cjs/routes/index.d.ts.map +1 -0
- package/dist/cjs/routes/index.js +25 -0
- package/dist/cjs/routes/index.js.map +1 -0
- package/dist/cjs/routes/portico/automatic.d.ts +68 -0
- package/dist/cjs/routes/portico/automatic.d.ts.map +1 -0
- package/dist/cjs/routes/portico/automatic.js +208 -0
- package/dist/cjs/routes/portico/automatic.js.map +1 -0
- package/dist/cjs/routes/portico/index.d.ts +2 -0
- package/dist/cjs/routes/portico/index.d.ts.map +1 -0
- package/dist/cjs/routes/portico/index.js +18 -0
- package/dist/cjs/routes/portico/index.js.map +1 -0
- package/dist/cjs/routes/portico/utils.d.ts +1 -0
- package/dist/cjs/routes/portico/utils.d.ts.map +1 -0
- package/dist/cjs/routes/portico/utils.js +2 -0
- package/dist/cjs/routes/portico/utils.js.map +1 -0
- package/dist/cjs/routes/request.d.ts +25 -0
- package/dist/cjs/routes/request.d.ts.map +1 -0
- package/dist/cjs/routes/request.js +65 -0
- package/dist/cjs/routes/request.js.map +1 -0
- package/dist/cjs/routes/resolver.d.ts +15 -0
- package/dist/cjs/routes/resolver.d.ts.map +1 -0
- package/dist/cjs/routes/resolver.js +87 -0
- package/dist/cjs/routes/resolver.js.map +1 -0
- package/dist/cjs/routes/route.d.ts +46 -0
- package/dist/cjs/routes/route.d.ts.map +1 -0
- package/dist/cjs/routes/route.js +34 -0
- package/dist/cjs/routes/route.js.map +1 -0
- package/dist/cjs/routes/token.d.ts +12 -0
- package/dist/cjs/routes/token.d.ts.map +1 -0
- package/dist/cjs/routes/token.js +37 -0
- package/dist/cjs/routes/token.js.map +1 -0
- package/dist/cjs/routes/tokenBridge/automatic.d.ts +46 -0
- package/dist/cjs/routes/tokenBridge/automatic.d.ts.map +1 -0
- package/dist/cjs/routes/tokenBridge/automatic.js +145 -0
- package/dist/cjs/routes/tokenBridge/automatic.js.map +1 -0
- package/dist/cjs/routes/tokenBridge/index.d.ts +3 -0
- package/dist/cjs/routes/tokenBridge/index.d.ts.map +1 -0
- package/dist/cjs/routes/tokenBridge/index.js +19 -0
- package/dist/cjs/routes/tokenBridge/index.js.map +1 -0
- package/dist/cjs/routes/tokenBridge/manual.d.ts +42 -0
- package/dist/cjs/routes/tokenBridge/manual.d.ts.map +1 -0
- package/dist/cjs/routes/tokenBridge/manual.js +87 -0
- package/dist/cjs/routes/tokenBridge/manual.js.map +1 -0
- package/dist/cjs/routes/types.d.ts +44 -0
- package/dist/cjs/routes/types.d.ts.map +1 -0
- package/dist/cjs/routes/types.js +3 -0
- package/dist/cjs/routes/types.js.map +1 -0
- package/dist/cjs/tasks.d.ts +7 -0
- package/dist/cjs/tasks.d.ts.map +1 -0
- package/dist/cjs/tasks.js +65 -0
- package/dist/cjs/tasks.js.map +1 -0
- package/dist/cjs/types.d.ts +73 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +35 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/whscan-api.d.ts +172 -0
- package/dist/cjs/whscan-api.d.ts.map +1 -0
- package/dist/cjs/whscan-api.js +243 -0
- package/dist/cjs/whscan-api.js.map +1 -0
- package/dist/cjs/wormhole.d.ts +198 -0
- package/dist/cjs/wormhole.d.ts.map +1 -0
- package/dist/cjs/wormhole.js +324 -0
- package/dist/cjs/wormhole.js.map +1 -0
- package/dist/esm/circle-api.d.ts +16 -0
- package/dist/esm/circle-api.d.ts.map +1 -0
- package/dist/esm/circle-api.js +39 -0
- package/dist/esm/circle-api.js.map +1 -0
- package/dist/esm/common.d.ts +4 -0
- package/dist/esm/common.d.ts.map +1 -0
- package/dist/esm/common.js +36 -0
- package/dist/esm/common.js.map +1 -0
- package/dist/esm/config.d.ts +34 -0
- package/dist/esm/config.d.ts.map +1 -0
- package/dist/esm/config.js +47 -0
- package/dist/esm/config.js.map +1 -0
- package/dist/esm/index.d.ts +15 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/protocols/cctpTransfer.d.ts +41 -0
- package/dist/esm/protocols/cctpTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/cctpTransfer.js +455 -0
- package/dist/esm/protocols/cctpTransfer.js.map +1 -0
- package/dist/esm/protocols/gatewayTransfer.d.ts +40 -0
- package/dist/esm/protocols/gatewayTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/gatewayTransfer.js +402 -0
- package/dist/esm/protocols/gatewayTransfer.js.map +1 -0
- package/dist/esm/protocols/tokenTransfer.d.ts +40 -0
- package/dist/esm/protocols/tokenTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/tokenTransfer.js +468 -0
- package/dist/esm/protocols/tokenTransfer.js.map +1 -0
- package/dist/esm/protocols/wormholeTransfer.d.ts +20 -0
- package/dist/esm/protocols/wormholeTransfer.d.ts.map +1 -0
- package/dist/esm/protocols/wormholeTransfer.js +2 -0
- package/dist/esm/protocols/wormholeTransfer.js.map +1 -0
- package/dist/esm/routes/cctp/automatic.d.ts +46 -0
- package/dist/esm/routes/cctp/automatic.d.ts.map +1 -0
- package/dist/esm/routes/cctp/automatic.js +131 -0
- package/dist/esm/routes/cctp/automatic.js.map +1 -0
- package/dist/esm/routes/cctp/index.d.ts +3 -0
- package/dist/esm/routes/cctp/index.d.ts.map +1 -0
- package/dist/esm/routes/cctp/index.js +3 -0
- package/dist/esm/routes/cctp/index.js.map +1 -0
- package/dist/esm/routes/cctp/manual.d.ts +43 -0
- package/dist/esm/routes/cctp/manual.d.ts.map +1 -0
- package/dist/esm/routes/cctp/manual.js +109 -0
- package/dist/esm/routes/cctp/manual.js.map +1 -0
- package/dist/esm/routes/common.d.ts +13 -0
- package/dist/esm/routes/common.d.ts.map +1 -0
- package/dist/esm/routes/common.js +41 -0
- package/dist/esm/routes/common.js.map +1 -0
- package/dist/esm/routes/index.d.ts +9 -0
- package/dist/esm/routes/index.d.ts.map +1 -0
- package/dist/esm/routes/index.js +9 -0
- package/dist/esm/routes/index.js.map +1 -0
- package/dist/esm/routes/portico/automatic.d.ts +68 -0
- package/dist/esm/routes/portico/automatic.d.ts.map +1 -0
- package/dist/esm/routes/portico/automatic.js +204 -0
- package/dist/esm/routes/portico/automatic.js.map +1 -0
- package/dist/esm/routes/portico/index.d.ts +2 -0
- package/dist/esm/routes/portico/index.d.ts.map +1 -0
- package/dist/esm/routes/portico/index.js +2 -0
- package/dist/esm/routes/portico/index.js.map +1 -0
- package/dist/esm/routes/portico/utils.d.ts +1 -0
- package/dist/esm/routes/portico/utils.d.ts.map +1 -0
- package/dist/esm/routes/portico/utils.js +2 -0
- package/dist/esm/routes/portico/utils.js.map +1 -0
- package/dist/esm/routes/request.d.ts +25 -0
- package/dist/esm/routes/request.d.ts.map +1 -0
- package/dist/esm/routes/request.js +61 -0
- package/dist/esm/routes/request.js.map +1 -0
- package/dist/esm/routes/resolver.d.ts +15 -0
- package/dist/esm/routes/resolver.d.ts.map +1 -0
- package/dist/esm/routes/resolver.js +83 -0
- package/dist/esm/routes/resolver.js.map +1 -0
- package/dist/esm/routes/route.d.ts +46 -0
- package/dist/esm/routes/route.d.ts.map +1 -0
- package/dist/esm/routes/route.js +26 -0
- package/dist/esm/routes/route.js.map +1 -0
- package/dist/esm/routes/token.d.ts +12 -0
- package/dist/esm/routes/token.d.ts.map +1 -0
- package/dist/esm/routes/token.js +31 -0
- package/dist/esm/routes/token.js.map +1 -0
- package/dist/esm/routes/tokenBridge/automatic.d.ts +46 -0
- package/dist/esm/routes/tokenBridge/automatic.d.ts.map +1 -0
- package/dist/esm/routes/tokenBridge/automatic.js +141 -0
- package/dist/esm/routes/tokenBridge/automatic.js.map +1 -0
- package/dist/esm/routes/tokenBridge/index.d.ts +3 -0
- package/dist/esm/routes/tokenBridge/index.d.ts.map +1 -0
- package/dist/esm/routes/tokenBridge/index.js +3 -0
- package/dist/esm/routes/tokenBridge/index.js.map +1 -0
- package/dist/esm/routes/tokenBridge/manual.d.ts +42 -0
- package/dist/esm/routes/tokenBridge/manual.d.ts.map +1 -0
- package/dist/esm/routes/tokenBridge/manual.js +83 -0
- package/dist/esm/routes/tokenBridge/manual.js.map +1 -0
- package/dist/esm/routes/types.d.ts +44 -0
- package/dist/esm/routes/types.d.ts.map +1 -0
- package/dist/esm/routes/types.js +2 -0
- package/dist/esm/routes/types.js.map +1 -0
- package/dist/esm/tasks.d.ts +7 -0
- package/dist/esm/tasks.d.ts.map +1 -0
- package/dist/esm/tasks.js +59 -0
- package/dist/esm/tasks.js.map +1 -0
- package/dist/esm/types.d.ts +73 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +27 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/whscan-api.d.ts +172 -0
- package/dist/esm/whscan-api.d.ts.map +1 -0
- package/dist/esm/whscan-api.js +222 -0
- package/dist/esm/whscan-api.js.map +1 -0
- package/dist/esm/wormhole.d.ts +198 -0
- package/dist/esm/wormhole.d.ts.map +1 -0
- package/dist/esm/wormhole.js +320 -0
- package/dist/esm/wormhole.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { chainToPlatform, circle } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
import { canonicalAddress, isNative, nativeTokenId, toNative, } from "@wormhole-foundation/sdk-definitions";
|
|
3
|
+
import { getCircleAttestationWithRetry } from "./circle-api";
|
|
4
|
+
import { DEFAULT_TASK_TIMEOUT, applyOverrides } from "./config";
|
|
5
|
+
import { CircleTransfer } from "./protocols/cctpTransfer";
|
|
6
|
+
import { TokenTransfer } from "./protocols/tokenTransfer";
|
|
7
|
+
import { RouteResolver } from "./routes/resolver";
|
|
8
|
+
import { retry } from "./tasks";
|
|
9
|
+
import { getTransactionStatusWithRetry, getTxsByAddress, getVaaByTxHashWithRetry, getVaaBytesWithRetry, getVaaWithRetry, } from "./whscan-api";
|
|
10
|
+
export class Wormhole {
|
|
11
|
+
_network;
|
|
12
|
+
_platforms;
|
|
13
|
+
_chains;
|
|
14
|
+
config;
|
|
15
|
+
constructor(network, platforms, config) {
|
|
16
|
+
this._network = network;
|
|
17
|
+
this.config = applyOverrides(network, config);
|
|
18
|
+
this._chains = new Map();
|
|
19
|
+
this._platforms = new Map();
|
|
20
|
+
for (const p of platforms) {
|
|
21
|
+
this._platforms.set(p._platform, new p(network));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
get network() {
|
|
25
|
+
return this._network;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates a CircleTransfer object to move Native USDC from one chain to another
|
|
29
|
+
* @param amount the amount to transfer
|
|
30
|
+
* @param from the address to transfer from
|
|
31
|
+
* @param to the address to transfer to
|
|
32
|
+
* @param automatic whether to use automatic delivery
|
|
33
|
+
* @param payload the payload to send with the transfer
|
|
34
|
+
* @param nativeGas the amount of native gas to send with the transfer
|
|
35
|
+
* @returns the CircleTransfer object
|
|
36
|
+
* @throws Errors if the chain or protocol is not supported
|
|
37
|
+
*/
|
|
38
|
+
async circleTransfer(amount, from, to, automatic, payload, nativeGas) {
|
|
39
|
+
if (automatic && payload)
|
|
40
|
+
throw new Error("Payload with automatic delivery is not supported");
|
|
41
|
+
if (!circle.isCircleChain(this.network, from.chain) ||
|
|
42
|
+
!circle.isCircleChain(this.network, to.chain) ||
|
|
43
|
+
!circle.isCircleSupported(this.network, from.chain) ||
|
|
44
|
+
!circle.isCircleSupported(this.network, to.chain))
|
|
45
|
+
throw new Error(`Network and chain not supported: ${this.network} ${from.chain} `);
|
|
46
|
+
// ensure the amount is > fee + native gas
|
|
47
|
+
if (automatic) {
|
|
48
|
+
const acb = await this.getChain(from.chain).getAutomaticCircleBridge();
|
|
49
|
+
const relayerFee = await acb.getRelayerFee(to.chain);
|
|
50
|
+
const minAmount = relayerFee + (nativeGas ? nativeGas : 0n);
|
|
51
|
+
if (amount < minAmount)
|
|
52
|
+
throw new Error(`Amount must be > ${minAmount} (relayerFee + nativeGas)`);
|
|
53
|
+
}
|
|
54
|
+
return await CircleTransfer.from(this, {
|
|
55
|
+
amount,
|
|
56
|
+
from,
|
|
57
|
+
to,
|
|
58
|
+
automatic,
|
|
59
|
+
payload,
|
|
60
|
+
nativeGas,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Creates a TokenTransfer object to move a token from one chain to another
|
|
65
|
+
* @param token the token to transfer
|
|
66
|
+
* @param amount the amount to transfer
|
|
67
|
+
* @param from the address to transfer from
|
|
68
|
+
* @param to the address to transfer to
|
|
69
|
+
* @param automatic whether to use automatic delivery
|
|
70
|
+
* @param payload the payload to send with the transfer
|
|
71
|
+
* @param nativeGas the amount of native gas to send with the transfer
|
|
72
|
+
* @returns the TokenTransfer object
|
|
73
|
+
* @throws Errors if the chain or protocol is not supported
|
|
74
|
+
*/
|
|
75
|
+
async tokenTransfer(token, amount, from, to, automatic, payload, nativeGas) {
|
|
76
|
+
return await TokenTransfer.from(this, {
|
|
77
|
+
token,
|
|
78
|
+
amount,
|
|
79
|
+
from,
|
|
80
|
+
to,
|
|
81
|
+
automatic,
|
|
82
|
+
payload,
|
|
83
|
+
nativeGas,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Gets a RouteResolver configured with the routes passed
|
|
88
|
+
* @param routes the list RouteConstructors to use
|
|
89
|
+
* @returns the RouteResolver
|
|
90
|
+
*/
|
|
91
|
+
resolver(routes) {
|
|
92
|
+
return new RouteResolver(this, routes);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets the contract addresses for a given chain
|
|
96
|
+
* @param chain the chain name
|
|
97
|
+
* @returns the contract addresses
|
|
98
|
+
*/
|
|
99
|
+
getContracts(chain) {
|
|
100
|
+
return this.config.chains[chain]?.contracts;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Returns the platform object, i.e. the class with platform-specific logic and methods
|
|
104
|
+
* @param chain the platform name
|
|
105
|
+
* @returns the platform context class
|
|
106
|
+
* @throws Errors if platform is not found
|
|
107
|
+
*/
|
|
108
|
+
getPlatform(platformName) {
|
|
109
|
+
const platform = this._platforms.get(platformName);
|
|
110
|
+
if (!platform)
|
|
111
|
+
throw new Error(`Not able to retrieve platform ${platform}`);
|
|
112
|
+
return platform;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns the chain "context", i.e. the class with chain-specific logic and methods
|
|
116
|
+
* @param chain the chain name
|
|
117
|
+
* @returns the chain context class
|
|
118
|
+
* @throws Errors if context is not found
|
|
119
|
+
*/
|
|
120
|
+
getChain(chain) {
|
|
121
|
+
const platform = chainToPlatform(chain);
|
|
122
|
+
if (!this._chains.has(chain))
|
|
123
|
+
this._chains.set(chain, this.getPlatform(platform).getChain(chain));
|
|
124
|
+
return this._chains.get(chain);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Gets the TokenId for a token representation on any chain
|
|
128
|
+
* These are the Wormhole wrapped token addresses, not necessarily
|
|
129
|
+
* the cannonical version of that token
|
|
130
|
+
*
|
|
131
|
+
* @param chain The chain name to get the wrapped token address
|
|
132
|
+
* @param tokenId The Token ID (chain/address) of the original token
|
|
133
|
+
* @returns The TokenId on the given chain, null if it does not exist
|
|
134
|
+
* @throws Errors if the chain is not supported or the token does not exist
|
|
135
|
+
*/
|
|
136
|
+
async getWrappedAsset(chain, token) {
|
|
137
|
+
const ctx = this.getChain(chain);
|
|
138
|
+
const tb = await ctx.getTokenBridge();
|
|
139
|
+
return { chain, address: await tb.getWrappedAsset(token) };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Taking the original TokenId for some wrapped token chain
|
|
143
|
+
* These are the Wormhole wrapped token addresses, not necessarily
|
|
144
|
+
* the cannonical version of that token
|
|
145
|
+
*
|
|
146
|
+
* @param tokenId The Token ID of the token we're looking up the original asset for
|
|
147
|
+
* @returns The Original TokenId corresponding to the token id passed,
|
|
148
|
+
* @throws Errors if the chain is not supported or the token does not exist
|
|
149
|
+
*/
|
|
150
|
+
async getOriginalAsset(token) {
|
|
151
|
+
const ctx = this.getChain(token.chain);
|
|
152
|
+
const tb = await ctx.getTokenBridge();
|
|
153
|
+
return await tb.getOriginalAsset(token.address);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Gets the number of decimals for a token on a given chain
|
|
157
|
+
*
|
|
158
|
+
* @param chain The chain name or id of the token/representation
|
|
159
|
+
* @param token The token address
|
|
160
|
+
* @returns The number of decimals
|
|
161
|
+
*/
|
|
162
|
+
async getDecimals(chain, token) {
|
|
163
|
+
const ctx = this.getChain(chain);
|
|
164
|
+
return await ctx.getDecimals(token);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Fetches the balance of a given token for a wallet
|
|
168
|
+
*
|
|
169
|
+
* @param walletAddress The wallet address
|
|
170
|
+
* @param tokenId The token ID (its home chain and address on the home chain)
|
|
171
|
+
* @param chain The chain name or id
|
|
172
|
+
* @returns The token balance of the wormhole asset as a BigNumber
|
|
173
|
+
*/
|
|
174
|
+
async getBalance(chain, token, walletAddress) {
|
|
175
|
+
const ctx = this.getChain(chain);
|
|
176
|
+
return ctx.getBalance(walletAddress, token);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Gets the associated token account for chains that require it (only Solana currently).
|
|
180
|
+
*
|
|
181
|
+
* @param token the TokenId of the token to get the token account for
|
|
182
|
+
* @param recipient the address of the primary account that may require a separate token account
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
185
|
+
async getTokenAccount(recipient, token) {
|
|
186
|
+
return this.getChain(recipient.chain).getTokenAccount(recipient.address, token.address);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Gets the Raw VAA Bytes from the API or Guardian RPC, finality must be met before the VAA will be available.
|
|
190
|
+
*
|
|
191
|
+
* @param wormholeMessageId The WormholeMessageId corresponding to the VAA to be fetched
|
|
192
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
193
|
+
* @returns The VAA bytes if available
|
|
194
|
+
* @throws Errors if the VAA is not available after the retries
|
|
195
|
+
*/
|
|
196
|
+
async getVaaBytes(wormholeMessageId, timeout = DEFAULT_TASK_TIMEOUT) {
|
|
197
|
+
return await getVaaBytesWithRetry(this.config.api, wormholeMessageId, timeout);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Gets a VAA from the API or Guardian RPC, finality must be met before the VAA will be available.
|
|
201
|
+
*
|
|
202
|
+
* @param id The WormholeMessageId or Transaction hash corresponding to the VAA to be fetched
|
|
203
|
+
* @param decodeAs The VAA type to decode the bytes as
|
|
204
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
205
|
+
* @returns The VAA if available
|
|
206
|
+
* @throws Errors if the VAA is not available after the retries
|
|
207
|
+
*/
|
|
208
|
+
async getVaa(id, decodeAs, timeout = DEFAULT_TASK_TIMEOUT) {
|
|
209
|
+
if (typeof id === "string")
|
|
210
|
+
return await getVaaByTxHashWithRetry(this.config.api, id, decodeAs, timeout);
|
|
211
|
+
return await getVaaWithRetry(this.config.api, id, decodeAs, timeout);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Gets the CircleAttestation corresponding to the message hash logged in the transfer transaction.
|
|
215
|
+
* @param msgHash The keccak256 hash of the message emitted by the circle contract
|
|
216
|
+
* @param timeout The total amount of time to wait for the VAA to be available
|
|
217
|
+
* @returns The CircleAttestation as a string, if available
|
|
218
|
+
* @throws Errors if the CircleAttestation is not available after the retries
|
|
219
|
+
*/
|
|
220
|
+
async getCircleAttestation(msgHash, timeout = DEFAULT_TASK_TIMEOUT) {
|
|
221
|
+
return getCircleAttestationWithRetry(this.config.circleAPI, msgHash, timeout);
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Get the status of a transaction, identified by the chain, emitter address, and sequence number
|
|
225
|
+
*
|
|
226
|
+
* @param id the message id for the Wormhole Message to get transaction status for or originating Transaction hash
|
|
227
|
+
* @returns the TransactionStatus
|
|
228
|
+
*/
|
|
229
|
+
async getTransactionStatus(id, timeout = DEFAULT_TASK_TIMEOUT) {
|
|
230
|
+
let msgid;
|
|
231
|
+
// No txid endpoint exists to get the status by txhash yet
|
|
232
|
+
if (typeof id === "string") {
|
|
233
|
+
const vaa = await getVaaByTxHashWithRetry(this.config.api, id, "Uint8Array", timeout);
|
|
234
|
+
if (!vaa)
|
|
235
|
+
return null;
|
|
236
|
+
msgid = { emitter: vaa.emitterAddress, chain: vaa.emitterChain, sequence: vaa.sequence };
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
msgid = id;
|
|
240
|
+
}
|
|
241
|
+
return await getTransactionStatusWithRetry(this.config.api, msgid, timeout);
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Get recent transactions for an address
|
|
245
|
+
*
|
|
246
|
+
* @param address the string formatted address to get transactions for
|
|
247
|
+
* @returns the TransactionStatus
|
|
248
|
+
*/
|
|
249
|
+
async getTransactionsForAddress(address, pageSize = 50, page = 0) {
|
|
250
|
+
return getTxsByAddress(this.config.api, address, pageSize, page);
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
254
|
+
*
|
|
255
|
+
* @param chain The chain the address is for
|
|
256
|
+
* @param address The address in canonical string format
|
|
257
|
+
* @returns The address in the NativeAddress format
|
|
258
|
+
*/
|
|
259
|
+
static parseAddress(chain, address) {
|
|
260
|
+
return toNative(chain, address);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Return a string in the canonical chain format representing the address
|
|
264
|
+
* of a token or account
|
|
265
|
+
*
|
|
266
|
+
* @param chainAddress The ChainAddress or TokenId to get a string address
|
|
267
|
+
* @returns The string address in canonical format for the chain
|
|
268
|
+
*/
|
|
269
|
+
static canonicalAddress(chainAddress) {
|
|
270
|
+
return canonicalAddress(chainAddress);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
274
|
+
*
|
|
275
|
+
* @param chain The chain the address is for
|
|
276
|
+
* @param address The native address in canonical string format
|
|
277
|
+
* @returns The ChainAddress
|
|
278
|
+
*/
|
|
279
|
+
static chainAddress(chain, address) {
|
|
280
|
+
return { chain, address: Wormhole.parseAddress(chain, address) };
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Parse an address from its canonincal string format to a NativeAddress
|
|
284
|
+
*
|
|
285
|
+
* @param chain The chain the address is for
|
|
286
|
+
* @param address The native address in canonical string format or the string "native"
|
|
287
|
+
* @returns The ChainAddress
|
|
288
|
+
*/
|
|
289
|
+
static tokenId(chain, address) {
|
|
290
|
+
return isNative(address) ? nativeTokenId(chain) : this.chainAddress(chain, address);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Parses all relevant information from a transaction given the sending tx hash and sending chain
|
|
294
|
+
*
|
|
295
|
+
* @param chain The sending chain name or context
|
|
296
|
+
* @param tx The sending transaction hash
|
|
297
|
+
* @returns The parsed WormholeMessageId
|
|
298
|
+
*/
|
|
299
|
+
static async parseMessageFromTx(chain, txid, timeout = DEFAULT_TASK_TIMEOUT) {
|
|
300
|
+
const task = async () => {
|
|
301
|
+
try {
|
|
302
|
+
const msgs = await chain.parseTransaction(txid);
|
|
303
|
+
// possible the node we hit does not have this data yet
|
|
304
|
+
// return null to signal retry
|
|
305
|
+
if (msgs.length === 0)
|
|
306
|
+
return null;
|
|
307
|
+
return msgs;
|
|
308
|
+
}
|
|
309
|
+
catch (e) {
|
|
310
|
+
console.error(e);
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
};
|
|
314
|
+
const parsed = await retry(task, chain.config.blockTime, timeout, "WormholeCore:ParseMessageFromTransaction");
|
|
315
|
+
if (!parsed)
|
|
316
|
+
throw new Error(`No WormholeMessageId found for ${txid}`);
|
|
317
|
+
return parsed;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=wormhole.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wormhole.js","sourceRoot":"","sources":["../../src/wormhole.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,eAAe,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAaL,gBAAgB,EAEhB,QAAQ,EACR,aAAa,EACb,QAAQ,GACT,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAmB,oBAAoB,EAAkB,cAAc,EAAE,MAAM,UAAU,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAEL,6BAA6B,EAC7B,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAKtB,MAAM,OAAO,QAAQ;IACA,QAAQ,CAAI;IACrB,UAAU,CAAiB;IAC3B,OAAO,CAAc;IAEtB,MAAM,CAAiB;IAEhC,YA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OAMG;IACH,MAAM,CAAC,OAAO,CAAkB,KAAQ,EAAE,OAAe;QACvD,OAAO,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAC7B,KAAyB,EACzB,IAAY,EACZ,UAAkB,oBAAoB;QAEtC,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;YACtB,IAAI;gBACF,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;gBAChD,uDAAuD;gBACvD,8BAA8B;gBAC9B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;oBAAE,OAAO,IAAI,CAAC;gBACnC,OAAO,IAAI,CAAC;aACb;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,OAAO,IAAI,CAAC;aACb;QACH,CAAC,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,KAAK,CACxB,IAAI,EACJ,KAAK,CAAC,MAAM,CAAC,SAAS,EACtB,OAAO,EACP,0CAA0C,CAC3C,CAAC;QAEF,IAAI,CAAC,MAAM;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,IAAI,EAAE,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wormhole-foundation/sdk-connect",
|
|
3
|
+
"version": "0.5.0-alpha.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/wormhole-foundation/connect-sdk.git"
|
|
7
|
+
},
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/wormhole-foundation/connect-sdk/issues"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/wormhole-foundation/connect-sdk#readme",
|
|
12
|
+
"directories": {
|
|
13
|
+
"test": "__tests__"
|
|
14
|
+
},
|
|
15
|
+
"license": "Apache-2.0",
|
|
16
|
+
"main": "./dist/cjs/index.js",
|
|
17
|
+
"types": "./dist/cjs/index.d.ts",
|
|
18
|
+
"module": "./dist/esm/index.js",
|
|
19
|
+
"author": "",
|
|
20
|
+
"description": "The core package for the Connect SDK, used in conjunction with 1 or more of the chain packages",
|
|
21
|
+
"files": [
|
|
22
|
+
"dist/cjs",
|
|
23
|
+
"dist/esm"
|
|
24
|
+
],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"wormhole",
|
|
27
|
+
"sdk",
|
|
28
|
+
"typescript",
|
|
29
|
+
"connect"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=16"
|
|
33
|
+
},
|
|
34
|
+
"sideEffects": false,
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build:cjs": "tsc -p ./tsconfig.cjs.json",
|
|
37
|
+
"build:esm": "tsc -p ./tsconfig.esm.json",
|
|
38
|
+
"build": "npm run build:cjs && npm run build:esm",
|
|
39
|
+
"rebuild": "npm run clean && npm run build",
|
|
40
|
+
"clean": "rm -rf ./dist && rm -rf ./.turbo",
|
|
41
|
+
"lint": "npm run prettier && eslint --fix",
|
|
42
|
+
"prettier": "prettier --write ./src",
|
|
43
|
+
"test": "jest --config ./jest.config.ts __tests__/*.ts",
|
|
44
|
+
"coverage": "jest --config ./jest.config.ts --coverage",
|
|
45
|
+
"docs": "typedoc"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"axios": "^1.4.0",
|
|
49
|
+
"@wormhole-foundation/sdk-base": "0.5.0-alpha.0",
|
|
50
|
+
"@wormhole-foundation/sdk-definitions": "0.5.0-alpha.0"
|
|
51
|
+
}
|
|
52
|
+
}
|