@m0-foundation/ntt-sdk-route 0.0.29 → 0.1.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/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { Network, routes, Chain, ChainContext, TokenId, Signer, ChainAddress, AccountAddress } from '@wormhole-foundation/sdk-connect';
1
+ import { Network, Chain, ChainContext, TokenId, Signer, ChainAddress, AccountAddress } from '@wormhole-foundation/sdk-connect';
2
+ import * as routes from '@wormhole-foundation/sdk-connect/routes';
2
3
  import { EvmChains, EvmUnsignedTransaction } from '@wormhole-foundation/sdk-evm';
3
4
  import { SolanaChains, SolanaUnsignedTransaction } from '@wormhole-foundation/sdk-solana';
4
5
  import { NttRoute } from '@wormhole-foundation/sdk-route-ntt';
@@ -12,6 +13,17 @@ type Vp = NttRoute.ValidatedParams;
12
13
  type QR = routes.QuoteResult<Op, Vp>;
13
14
  type Q = routes.Quote<Op, Vp>;
14
15
  type R = NttRoute.AutomaticTransferReceipt;
16
+ /**
17
+ * Factory for M0AutomaticRoute. Calling this is the supported way to obtain
18
+ * the route constructor — it ensures NTT protocol implementations are
19
+ * registered with the Wormhole SDK before any route construction. Idempotent.
20
+ *
21
+ * Add the result to your Wormhole Connect routes config:
22
+ *
23
+ * import { m0AutomaticRoute } from "@m0-foundation/ntt-sdk-route";
24
+ * const config = { routes: [m0AutomaticRoute(), ...] };
25
+ */
26
+ declare function m0AutomaticRoute(): routes.RouteConstructor;
15
27
  declare class M0AutomaticRoute<N extends Network> extends routes.AutomaticRoute<N, Op, Vp, R> implements routes.StaticRouteMethods<typeof M0AutomaticRoute> {
16
28
  static NATIVE_GAS_DROPOFF_SUPPORTED: boolean;
17
29
  static EXECUTOR_ENTRYPOINT: string;
@@ -71,4 +83,4 @@ declare class SvmRouter {
71
83
  static bytes32toHex(bytes: number[]): string;
72
84
  }
73
85
 
74
- export { M0AutomaticRoute, SvmRouter as SolanaRouter };
86
+ export { M0AutomaticRoute, SvmRouter as SolanaRouter, m0AutomaticRoute };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Network, routes, Chain, ChainContext, TokenId, Signer, ChainAddress, AccountAddress } from '@wormhole-foundation/sdk-connect';
1
+ import { Network, Chain, ChainContext, TokenId, Signer, ChainAddress, AccountAddress } from '@wormhole-foundation/sdk-connect';
2
+ import * as routes from '@wormhole-foundation/sdk-connect/routes';
2
3
  import { EvmChains, EvmUnsignedTransaction } from '@wormhole-foundation/sdk-evm';
3
4
  import { SolanaChains, SolanaUnsignedTransaction } from '@wormhole-foundation/sdk-solana';
4
5
  import { NttRoute } from '@wormhole-foundation/sdk-route-ntt';
@@ -12,6 +13,17 @@ type Vp = NttRoute.ValidatedParams;
12
13
  type QR = routes.QuoteResult<Op, Vp>;
13
14
  type Q = routes.Quote<Op, Vp>;
14
15
  type R = NttRoute.AutomaticTransferReceipt;
16
+ /**
17
+ * Factory for M0AutomaticRoute. Calling this is the supported way to obtain
18
+ * the route constructor — it ensures NTT protocol implementations are
19
+ * registered with the Wormhole SDK before any route construction. Idempotent.
20
+ *
21
+ * Add the result to your Wormhole Connect routes config:
22
+ *
23
+ * import { m0AutomaticRoute } from "@m0-foundation/ntt-sdk-route";
24
+ * const config = { routes: [m0AutomaticRoute(), ...] };
25
+ */
26
+ declare function m0AutomaticRoute(): routes.RouteConstructor;
15
27
  declare class M0AutomaticRoute<N extends Network> extends routes.AutomaticRoute<N, Op, Vp, R> implements routes.StaticRouteMethods<typeof M0AutomaticRoute> {
16
28
  static NATIVE_GAS_DROPOFF_SUPPORTED: boolean;
17
29
  static EXECUTOR_ENTRYPOINT: string;
@@ -71,4 +83,4 @@ declare class SvmRouter {
71
83
  static bytes32toHex(bytes: number[]): string;
72
84
  }
73
85
 
74
- export { M0AutomaticRoute, SvmRouter as SolanaRouter };
86
+ export { M0AutomaticRoute, SvmRouter as SolanaRouter, m0AutomaticRoute };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var sdkConnect = require('@wormhole-foundation/sdk-connect');
4
+ var routes = require('@wormhole-foundation/sdk-connect/routes');
4
5
  var sdkDefinitionsNtt = require('@wormhole-foundation/sdk-definitions-ntt');
5
6
  var sdkEvmNtt = require('@wormhole-foundation/sdk-evm-ntt');
6
7
  var sdkSolanaNtt = require('@wormhole-foundation/sdk-solana-ntt');
@@ -15,6 +16,25 @@ var BN = require('bn.js');
15
16
 
16
17
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
18
 
19
+ function _interopNamespace(e) {
20
+ if (e && e.__esModule) return e;
21
+ var n = Object.create(null);
22
+ if (e) {
23
+ Object.keys(e).forEach(function (k) {
24
+ if (k !== 'default') {
25
+ var d = Object.getOwnPropertyDescriptor(e, k);
26
+ Object.defineProperty(n, k, d.get ? d : {
27
+ enumerable: true,
28
+ get: function () { return e[k]; }
29
+ });
30
+ }
31
+ });
32
+ }
33
+ n.default = e;
34
+ return Object.freeze(n);
35
+ }
36
+
37
+ var routes__namespace = /*#__PURE__*/_interopNamespace(routes);
18
38
  var BN__default = /*#__PURE__*/_interopDefault(BN);
19
39
 
20
40
  // src/m0AutomaticRoute.ts
@@ -56,7 +76,13 @@ function getExecutorConfig(network = "Mainnet") {
56
76
  perTokenOverrides: {
57
77
  Solana: {
58
78
  ["mzerojk9tg56ebsrEAhfkyc9VgKjTW2zDqp6C5mhjzH"]: {
59
- msgValue: 15000000n
79
+ msgValue: 4500000n,
80
+ gasLimit: 450000n
81
+ }
82
+ },
83
+ Ethereum: {
84
+ ["0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b"]: {
85
+ gasLimit: 600000n
60
86
  }
61
87
  }
62
88
  }
@@ -8530,7 +8556,19 @@ _EvmRouter.PORTAL_ADDRESS = "0xD925C84b55E4e44a53749fF5F2a5A13F63D128fd";
8530
8556
  var EvmRouter = _EvmRouter;
8531
8557
 
8532
8558
  // src/m0AutomaticRoute.ts
8533
- var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.AutomaticRoute {
8559
+ var registered = false;
8560
+ function ensureM0Registered() {
8561
+ if (registered) return;
8562
+ registered = true;
8563
+ sdkDefinitionsNtt.register();
8564
+ sdkEvmNtt.register();
8565
+ sdkSolanaNtt.register();
8566
+ }
8567
+ function m0AutomaticRoute() {
8568
+ ensureM0Registered();
8569
+ return M0AutomaticRoute;
8570
+ }
8571
+ var _M0AutomaticRoute = class _M0AutomaticRoute extends routes__namespace.AutomaticRoute {
8534
8572
  static supportedNetworks() {
8535
8573
  return ["Mainnet", "Testnet"];
8536
8574
  }
@@ -8866,7 +8904,7 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
8866
8904
  return "mzerojk9tg56ebsrEAhfkyc9VgKjTW2zDqp6C5mhjzH";
8867
8905
  return "0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b";
8868
8906
  };
8869
- const transferRequest = await sdkConnect.routes.RouteTransferRequest.create(this.wh, {
8907
+ const transferRequest = await routes__namespace.RouteTransferRequest.create(this.wh, {
8870
8908
  source: sdkConnect.Wormhole.tokenId(sourceChain, resolveM(sourceChain)),
8871
8909
  destination: sdkConnect.Wormhole.tokenId(
8872
8910
  destinationChain,
@@ -8885,9 +8923,6 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
8885
8923
  );
8886
8924
  }
8887
8925
  };
8888
- sdkDefinitionsNtt.register();
8889
- sdkEvmNtt.register();
8890
- sdkSolanaNtt.register();
8891
8926
  _M0AutomaticRoute.NATIVE_GAS_DROPOFF_SUPPORTED = false;
8892
8927
  _M0AutomaticRoute.EXECUTOR_ENTRYPOINT = "0x22f04a6cd935bfa3b4d000a4e3d4079adb148198";
8893
8928
  _M0AutomaticRoute.meta = { name: "M0AutomaticRoute", provider: "M0" };
@@ -8895,3 +8930,4 @@ var M0AutomaticRoute = _M0AutomaticRoute;
8895
8930
 
8896
8931
  exports.M0AutomaticRoute = M0AutomaticRoute;
8897
8932
  exports.SolanaRouter = SvmRouter;
8933
+ exports.m0AutomaticRoute = m0AutomaticRoute;
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { routes, chainToPlatform, amount, finality, Wormhole, canonicalAddress, signSendWait, TransferState, isSourceInitiated, isSourceFinalized, isAttested, isRedeemed, toNative, chainToChainId, sha256 } from '@wormhole-foundation/sdk-connect';
1
+ import { chainToPlatform, amount, finality, Wormhole, canonicalAddress, signSendWait, TransferState, isSourceInitiated, isSourceFinalized, isAttested, isRedeemed, toNative, chainToChainId, sha256 } from '@wormhole-foundation/sdk-connect';
2
+ import * as routes from '@wormhole-foundation/sdk-connect/routes';
2
3
  import { Ntt, register } from '@wormhole-foundation/sdk-definitions-ntt';
3
4
  import { register as register$1 } from '@wormhole-foundation/sdk-evm-ntt';
4
5
  import { register as register$2 } from '@wormhole-foundation/sdk-solana-ntt';
@@ -50,7 +51,13 @@ function getExecutorConfig(network = "Mainnet") {
50
51
  perTokenOverrides: {
51
52
  Solana: {
52
53
  ["mzerojk9tg56ebsrEAhfkyc9VgKjTW2zDqp6C5mhjzH"]: {
53
- msgValue: 15000000n
54
+ msgValue: 4500000n,
55
+ gasLimit: 450000n
56
+ }
57
+ },
58
+ Ethereum: {
59
+ ["0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b"]: {
60
+ gasLimit: 600000n
54
61
  }
55
62
  }
56
63
  }
@@ -8524,6 +8531,18 @@ _EvmRouter.PORTAL_ADDRESS = "0xD925C84b55E4e44a53749fF5F2a5A13F63D128fd";
8524
8531
  var EvmRouter = _EvmRouter;
8525
8532
 
8526
8533
  // src/m0AutomaticRoute.ts
8534
+ var registered = false;
8535
+ function ensureM0Registered() {
8536
+ if (registered) return;
8537
+ registered = true;
8538
+ register();
8539
+ register$1();
8540
+ register$2();
8541
+ }
8542
+ function m0AutomaticRoute() {
8543
+ ensureM0Registered();
8544
+ return M0AutomaticRoute;
8545
+ }
8527
8546
  var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
8528
8547
  static supportedNetworks() {
8529
8548
  return ["Mainnet", "Testnet"];
@@ -8879,12 +8898,9 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
8879
8898
  );
8880
8899
  }
8881
8900
  };
8882
- register();
8883
- register$1();
8884
- register$2();
8885
8901
  _M0AutomaticRoute.NATIVE_GAS_DROPOFF_SUPPORTED = false;
8886
8902
  _M0AutomaticRoute.EXECUTOR_ENTRYPOINT = "0x22f04a6cd935bfa3b4d000a4e3d4079adb148198";
8887
8903
  _M0AutomaticRoute.meta = { name: "M0AutomaticRoute", provider: "M0" };
8888
8904
  var M0AutomaticRoute = _M0AutomaticRoute;
8889
8905
 
8890
- export { M0AutomaticRoute, SvmRouter as SolanaRouter };
8906
+ export { M0AutomaticRoute, SvmRouter as SolanaRouter, m0AutomaticRoute };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m0-foundation/ntt-sdk-route",
3
- "version": "0.0.29",
3
+ "version": "0.1.0",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",
@@ -36,14 +36,14 @@
36
36
  "@noble/hashes": "^1.8.0",
37
37
  "@solana/spl-token": "^0.4.14",
38
38
  "@solana/web3.js": "^1.95.8",
39
- "@wormhole-foundation/sdk": "4.9.1",
40
- "@wormhole-foundation/sdk-connect": "4.9.1",
41
- "@wormhole-foundation/sdk-definitions-ntt": "4.0.14",
42
- "@wormhole-foundation/sdk-evm": "4.9.1",
43
- "@wormhole-foundation/sdk-evm-ntt": "4.0.14",
44
- "@wormhole-foundation/sdk-route-ntt": "4.0.14",
45
- "@wormhole-foundation/sdk-solana": "4.9.1",
46
- "@wormhole-foundation/sdk-solana-ntt": "4.0.14",
39
+ "@wormhole-foundation/sdk": "4.18.0",
40
+ "@wormhole-foundation/sdk-connect": "4.18.0",
41
+ "@wormhole-foundation/sdk-definitions-ntt": "5.0.2",
42
+ "@wormhole-foundation/sdk-evm": "4.18.0",
43
+ "@wormhole-foundation/sdk-evm-ntt": "5.0.2",
44
+ "@wormhole-foundation/sdk-route-ntt": "5.0.2",
45
+ "@wormhole-foundation/sdk-solana": "4.18.0",
46
+ "@wormhole-foundation/sdk-solana-ntt": "5.0.2",
47
47
  "bn.js": "^5.2.2",
48
48
  "ethers": "^6.16.0"
49
49
  },