@m0-foundation/ntt-sdk-route 0.0.20 → 0.0.22
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/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +8 -13
- package/dist/index.mjs +8 -11
- package/package.json +14 -6
package/dist/index.d.mts
CHANGED
|
@@ -20,6 +20,7 @@ type Contracts = Ntt.Contracts & {
|
|
|
20
20
|
};
|
|
21
21
|
declare class M0AutomaticRoute<N extends Network> extends routes.AutomaticRoute<N, Op, Vp, R> implements routes.StaticRouteMethods<typeof M0AutomaticRoute> {
|
|
22
22
|
static NATIVE_GAS_DROPOFF_SUPPORTED: boolean;
|
|
23
|
+
static EVM_USDZ_TOKEN: string;
|
|
23
24
|
static EVM_WRAPPED_M_TOKEN: string;
|
|
24
25
|
static EXECUTOR_ENTRYPOINT: string;
|
|
25
26
|
static EVM_CONTRACTS: Contracts;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ type Contracts = Ntt.Contracts & {
|
|
|
20
20
|
};
|
|
21
21
|
declare class M0AutomaticRoute<N extends Network> extends routes.AutomaticRoute<N, Op, Vp, R> implements routes.StaticRouteMethods<typeof M0AutomaticRoute> {
|
|
22
22
|
static NATIVE_GAS_DROPOFF_SUPPORTED: boolean;
|
|
23
|
+
static EVM_USDZ_TOKEN: string;
|
|
23
24
|
static EVM_WRAPPED_M_TOKEN: string;
|
|
24
25
|
static EXECUTOR_ENTRYPOINT: string;
|
|
25
26
|
static EVM_CONTRACTS: Contracts;
|
package/dist/index.js
CHANGED
|
@@ -11,14 +11,10 @@ var splToken = require('@solana/spl-token');
|
|
|
11
11
|
var sdkSolanaNtt = require('@wormhole-foundation/sdk-solana-ntt');
|
|
12
12
|
var BN = require('bn.js');
|
|
13
13
|
var sha2 = require('@noble/hashes/sha2');
|
|
14
|
-
var evm = require('@wormhole-foundation/sdk/platforms/evm');
|
|
15
|
-
var solana = require('@wormhole-foundation/sdk/platforms/solana');
|
|
16
14
|
|
|
17
15
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
16
|
|
|
19
17
|
var BN__default = /*#__PURE__*/_interopDefault(BN);
|
|
20
|
-
var evm__default = /*#__PURE__*/_interopDefault(evm);
|
|
21
|
-
var solana__default = /*#__PURE__*/_interopDefault(solana);
|
|
22
18
|
|
|
23
19
|
// src/m0AutomaticRoute.ts
|
|
24
20
|
var SolanaRoutes = class _SolanaRoutes {
|
|
@@ -945,7 +941,6 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
|
|
|
945
941
|
const receiver = sdkConnect.universalAddress(destination);
|
|
946
942
|
if (this.requiresExecutor(destination.chain)) {
|
|
947
943
|
const quote = await this.getExecutorQuote(
|
|
948
|
-
ntt.network,
|
|
949
944
|
ntt.chain,
|
|
950
945
|
destination.chain,
|
|
951
946
|
amount2
|
|
@@ -1037,7 +1032,6 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
|
|
|
1037
1032
|
tx.add(...ixs);
|
|
1038
1033
|
if (this.requiresExecutor(recipient.chain)) {
|
|
1039
1034
|
const quote = await this.getExecutorQuote(
|
|
1040
|
-
ntt.network,
|
|
1041
1035
|
ntt.chain,
|
|
1042
1036
|
recipient.chain,
|
|
1043
1037
|
amount2
|
|
@@ -1137,18 +1131,17 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
|
|
|
1137
1131
|
}
|
|
1138
1132
|
yield receipt;
|
|
1139
1133
|
}
|
|
1140
|
-
async getExecutorQuote(
|
|
1141
|
-
const
|
|
1142
|
-
const
|
|
1143
|
-
const routeInstance = new executorRoute(wh);
|
|
1134
|
+
async getExecutorQuote(sourceChain, destinationChain, amount2) {
|
|
1135
|
+
const executorRoute = sdkRouteNtt.nttExecutorRoute(getExecutorConfig(this.wh.network));
|
|
1136
|
+
const routeInstance = new executorRoute(this.wh);
|
|
1144
1137
|
const resolveM = (chain) => {
|
|
1145
1138
|
if (sdkConnect.chainToPlatform(chain) === "Solana") {
|
|
1146
1139
|
const c = chain;
|
|
1147
|
-
return SolanaRoutes.getSolanaContracts(network, c).token;
|
|
1140
|
+
return SolanaRoutes.getSolanaContracts(this.wh.network, c).token;
|
|
1148
1141
|
}
|
|
1149
1142
|
return _M0AutomaticRoute.EVM_CONTRACTS.token;
|
|
1150
1143
|
};
|
|
1151
|
-
const transferRequest = await sdkConnect.routes.RouteTransferRequest.create(wh, {
|
|
1144
|
+
const transferRequest = await sdkConnect.routes.RouteTransferRequest.create(this.wh, {
|
|
1152
1145
|
source: sdkConnect.Wormhole.tokenId(sourceChain, resolveM(sourceChain)),
|
|
1153
1146
|
destination: sdkConnect.Wormhole.tokenId(
|
|
1154
1147
|
destinationChain,
|
|
@@ -1172,6 +1165,8 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
|
|
|
1172
1165
|
};
|
|
1173
1166
|
// ntt does not support gas drop-off currently
|
|
1174
1167
|
_M0AutomaticRoute.NATIVE_GAS_DROPOFF_SUPPORTED = false;
|
|
1168
|
+
// USDZ token address is the same across Ethereum and Arbitrum
|
|
1169
|
+
_M0AutomaticRoute.EVM_USDZ_TOKEN = "0xA4B6DF229AEe22b4252dc578FEB2720E8A2C4A56";
|
|
1175
1170
|
// Wrapped M token address is the same on EVM chains
|
|
1176
1171
|
_M0AutomaticRoute.EVM_WRAPPED_M_TOKEN = "0x437cc33344a0B27A429f795ff6B469C72698B291";
|
|
1177
1172
|
_M0AutomaticRoute.EXECUTOR_ENTRYPOINT = "0x22f04a6cd935bfa3b4d000a4e3d4079adb148198";
|
|
@@ -1180,7 +1175,7 @@ _M0AutomaticRoute.EVM_CONTRACTS = {
|
|
|
1180
1175
|
// M token address is the same on EVM chains
|
|
1181
1176
|
token: "0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b",
|
|
1182
1177
|
// Wrapped $M and Extension Tokens that can bridged by unwrapping to $M
|
|
1183
|
-
mLikeTokens: [_M0AutomaticRoute.EVM_WRAPPED_M_TOKEN],
|
|
1178
|
+
mLikeTokens: [_M0AutomaticRoute.EVM_WRAPPED_M_TOKEN, _M0AutomaticRoute.EVM_USDZ_TOKEN],
|
|
1184
1179
|
// M0 Portal address is the same on EVM chains
|
|
1185
1180
|
manager: "0xD925C84b55E4e44a53749fF5F2a5A13F63D128fd",
|
|
1186
1181
|
// Wormhole transceiver address is the same on EVM chains
|
package/dist/index.mjs
CHANGED
|
@@ -9,8 +9,6 @@ import { TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, getAssociatedTokenAddressSync,
|
|
|
9
9
|
import { NTT } from '@wormhole-foundation/sdk-solana-ntt';
|
|
10
10
|
import BN from 'bn.js';
|
|
11
11
|
import { sha256 } from '@noble/hashes/sha2';
|
|
12
|
-
import evm from '@wormhole-foundation/sdk/platforms/evm';
|
|
13
|
-
import solana from '@wormhole-foundation/sdk/platforms/solana';
|
|
14
12
|
|
|
15
13
|
// src/m0AutomaticRoute.ts
|
|
16
14
|
var SolanaRoutes = class _SolanaRoutes {
|
|
@@ -937,7 +935,6 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
|
|
|
937
935
|
const receiver = universalAddress(destination);
|
|
938
936
|
if (this.requiresExecutor(destination.chain)) {
|
|
939
937
|
const quote = await this.getExecutorQuote(
|
|
940
|
-
ntt.network,
|
|
941
938
|
ntt.chain,
|
|
942
939
|
destination.chain,
|
|
943
940
|
amount2
|
|
@@ -1029,7 +1026,6 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
|
|
|
1029
1026
|
tx.add(...ixs);
|
|
1030
1027
|
if (this.requiresExecutor(recipient.chain)) {
|
|
1031
1028
|
const quote = await this.getExecutorQuote(
|
|
1032
|
-
ntt.network,
|
|
1033
1029
|
ntt.chain,
|
|
1034
1030
|
recipient.chain,
|
|
1035
1031
|
amount2
|
|
@@ -1129,18 +1125,17 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
|
|
|
1129
1125
|
}
|
|
1130
1126
|
yield receipt;
|
|
1131
1127
|
}
|
|
1132
|
-
async getExecutorQuote(
|
|
1133
|
-
const
|
|
1134
|
-
const
|
|
1135
|
-
const routeInstance = new executorRoute(wh);
|
|
1128
|
+
async getExecutorQuote(sourceChain, destinationChain, amount2) {
|
|
1129
|
+
const executorRoute = nttExecutorRoute(getExecutorConfig(this.wh.network));
|
|
1130
|
+
const routeInstance = new executorRoute(this.wh);
|
|
1136
1131
|
const resolveM = (chain) => {
|
|
1137
1132
|
if (chainToPlatform(chain) === "Solana") {
|
|
1138
1133
|
const c = chain;
|
|
1139
|
-
return SolanaRoutes.getSolanaContracts(network, c).token;
|
|
1134
|
+
return SolanaRoutes.getSolanaContracts(this.wh.network, c).token;
|
|
1140
1135
|
}
|
|
1141
1136
|
return _M0AutomaticRoute.EVM_CONTRACTS.token;
|
|
1142
1137
|
};
|
|
1143
|
-
const transferRequest = await routes.RouteTransferRequest.create(wh, {
|
|
1138
|
+
const transferRequest = await routes.RouteTransferRequest.create(this.wh, {
|
|
1144
1139
|
source: Wormhole.tokenId(sourceChain, resolveM(sourceChain)),
|
|
1145
1140
|
destination: Wormhole.tokenId(
|
|
1146
1141
|
destinationChain,
|
|
@@ -1164,6 +1159,8 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
|
|
|
1164
1159
|
};
|
|
1165
1160
|
// ntt does not support gas drop-off currently
|
|
1166
1161
|
_M0AutomaticRoute.NATIVE_GAS_DROPOFF_SUPPORTED = false;
|
|
1162
|
+
// USDZ token address is the same across Ethereum and Arbitrum
|
|
1163
|
+
_M0AutomaticRoute.EVM_USDZ_TOKEN = "0xA4B6DF229AEe22b4252dc578FEB2720E8A2C4A56";
|
|
1167
1164
|
// Wrapped M token address is the same on EVM chains
|
|
1168
1165
|
_M0AutomaticRoute.EVM_WRAPPED_M_TOKEN = "0x437cc33344a0B27A429f795ff6B469C72698B291";
|
|
1169
1166
|
_M0AutomaticRoute.EXECUTOR_ENTRYPOINT = "0x22f04a6cd935bfa3b4d000a4e3d4079adb148198";
|
|
@@ -1172,7 +1169,7 @@ _M0AutomaticRoute.EVM_CONTRACTS = {
|
|
|
1172
1169
|
// M token address is the same on EVM chains
|
|
1173
1170
|
token: "0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b",
|
|
1174
1171
|
// Wrapped $M and Extension Tokens that can bridged by unwrapping to $M
|
|
1175
|
-
mLikeTokens: [_M0AutomaticRoute.EVM_WRAPPED_M_TOKEN],
|
|
1172
|
+
mLikeTokens: [_M0AutomaticRoute.EVM_WRAPPED_M_TOKEN, _M0AutomaticRoute.EVM_USDZ_TOKEN],
|
|
1176
1173
|
// M0 Portal address is the same on EVM chains
|
|
1177
1174
|
manager: "0xD925C84b55E4e44a53749fF5F2a5A13F63D128fd",
|
|
1178
1175
|
// Wormhole transceiver address is the same on EVM chains
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m0-foundation/ntt-sdk-route",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -20,6 +20,11 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist"
|
|
22
22
|
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "$npm_execpath tsup --clean",
|
|
25
|
+
"clean": "rm -rf dist",
|
|
26
|
+
"test-bridge": "node --env-file=.env -r ts-node/register scripts/bridge.ts"
|
|
27
|
+
},
|
|
23
28
|
"devDependencies": {
|
|
24
29
|
"@changesets/cli": "^2.28.1",
|
|
25
30
|
"@types/bn.js": "^5.2.0",
|
|
@@ -31,6 +36,7 @@
|
|
|
31
36
|
"publishConfig": {
|
|
32
37
|
"access": "public"
|
|
33
38
|
},
|
|
39
|
+
"packageManager": "pnpm@10.18.3",
|
|
34
40
|
"dependencies": {
|
|
35
41
|
"@noble/hashes": "^1.8.0",
|
|
36
42
|
"@solana/spl-token": "^0.4.13",
|
|
@@ -46,9 +52,11 @@
|
|
|
46
52
|
"bn.js": "^5.2.2",
|
|
47
53
|
"ethers": "^6.5.1"
|
|
48
54
|
},
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
"pnpm": {
|
|
56
|
+
"overrides": {
|
|
57
|
+
"@wormhole-foundation/sdk": "3.4.7",
|
|
58
|
+
"@wormhole-foundation/sdk-base": "3.4.7",
|
|
59
|
+
"@wormhole-foundation/sdk-definitions": "3.4.7"
|
|
60
|
+
}
|
|
53
61
|
}
|
|
54
|
-
}
|
|
62
|
+
}
|