@m0-foundation/ntt-sdk-route 0.0.30 → 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
@@ -8536,7 +8556,19 @@ _EvmRouter.PORTAL_ADDRESS = "0xD925C84b55E4e44a53749fF5F2a5A13F63D128fd";
8536
8556
  var EvmRouter = _EvmRouter;
8537
8557
 
8538
8558
  // src/m0AutomaticRoute.ts
8539
- 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 {
8540
8572
  static supportedNetworks() {
8541
8573
  return ["Mainnet", "Testnet"];
8542
8574
  }
@@ -8872,7 +8904,7 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
8872
8904
  return "mzerojk9tg56ebsrEAhfkyc9VgKjTW2zDqp6C5mhjzH";
8873
8905
  return "0x866A2BF4E572CbcF37D5071A7a58503Bfb36be1b";
8874
8906
  };
8875
- const transferRequest = await sdkConnect.routes.RouteTransferRequest.create(this.wh, {
8907
+ const transferRequest = await routes__namespace.RouteTransferRequest.create(this.wh, {
8876
8908
  source: sdkConnect.Wormhole.tokenId(sourceChain, resolveM(sourceChain)),
8877
8909
  destination: sdkConnect.Wormhole.tokenId(
8878
8910
  destinationChain,
@@ -8891,9 +8923,6 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends sdkConnect.routes.Automa
8891
8923
  );
8892
8924
  }
8893
8925
  };
8894
- sdkDefinitionsNtt.register();
8895
- sdkEvmNtt.register();
8896
- sdkSolanaNtt.register();
8897
8926
  _M0AutomaticRoute.NATIVE_GAS_DROPOFF_SUPPORTED = false;
8898
8927
  _M0AutomaticRoute.EXECUTOR_ENTRYPOINT = "0x22f04a6cd935bfa3b4d000a4e3d4079adb148198";
8899
8928
  _M0AutomaticRoute.meta = { name: "M0AutomaticRoute", provider: "M0" };
@@ -8901,3 +8930,4 @@ var M0AutomaticRoute = _M0AutomaticRoute;
8901
8930
 
8902
8931
  exports.M0AutomaticRoute = M0AutomaticRoute;
8903
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';
@@ -8530,6 +8531,18 @@ _EvmRouter.PORTAL_ADDRESS = "0xD925C84b55E4e44a53749fF5F2a5A13F63D128fd";
8530
8531
  var EvmRouter = _EvmRouter;
8531
8532
 
8532
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
+ }
8533
8546
  var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
8534
8547
  static supportedNetworks() {
8535
8548
  return ["Mainnet", "Testnet"];
@@ -8885,12 +8898,9 @@ var _M0AutomaticRoute = class _M0AutomaticRoute extends routes.AutomaticRoute {
8885
8898
  );
8886
8899
  }
8887
8900
  };
8888
- register();
8889
- register$1();
8890
- register$2();
8891
8901
  _M0AutomaticRoute.NATIVE_GAS_DROPOFF_SUPPORTED = false;
8892
8902
  _M0AutomaticRoute.EXECUTOR_ENTRYPOINT = "0x22f04a6cd935bfa3b4d000a4e3d4079adb148198";
8893
8903
  _M0AutomaticRoute.meta = { name: "M0AutomaticRoute", provider: "M0" };
8894
8904
  var M0AutomaticRoute = _M0AutomaticRoute;
8895
8905
 
8896
- 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.30",
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
  },