@m0-foundation/ntt-sdk-route 0.0.20 → 0.0.21
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.js +5 -12
- package/dist/index.mjs +5 -10
- package/package.json +1 -1
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,
|
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,
|