@wormhole-foundation/sdk-definitions-ntt 0.0.1-beta.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.
@@ -0,0 +1,4 @@
1
+ export * from "./ntt.js";
2
+ export type { TrimmedAmount, Prefix, NativeTokenTransfer, TransceiverMessage, NttManagerMessage, WormholeTransceiverMessage, } from "./nttLayout.js";
3
+ export * from "./nttLayout.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,YAAY,EACV,aAAa,EACb,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ntt.js"), exports);
18
+ __exportStar(require("./nttLayout.js"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AASzB,iDAA+B"}
@@ -0,0 +1,133 @@
1
+ import { type Chain, type Network, type Platform } from "@wormhole-foundation/sdk-base";
2
+ import { AccountAddress, ChainAddress, EmptyPlatformMap, ProtocolPayload, ProtocolVAA, TokenAddress, UnsignedTransaction } from "@wormhole-foundation/sdk-definitions";
3
+ import { NttManagerMessage, nativeTokenTransferLayout } from "./nttLayout.js";
4
+ /**
5
+ * @namespace Ntt
6
+ */
7
+ export declare namespace Ntt {
8
+ const _protocol = "Ntt";
9
+ export type ProtocolName = typeof _protocol;
10
+ export type Mode = "locking" | "burning";
11
+ export type Contracts = {
12
+ token: string;
13
+ manager: string;
14
+ transceiver: {
15
+ wormhole: string;
16
+ };
17
+ };
18
+ export type Message = NttManagerMessage<typeof nativeTokenTransferLayout>;
19
+ export type Attestation = any;
20
+ /**
21
+ * InboundQueuedTransfer is a queued transfer from another chain
22
+ * @property recipient the recipient of the transfer
23
+ * @property amount the amount of the transfer
24
+ * @property rateLimitExpiryTimestamp the timestamp when the rate limit expires
25
+ */
26
+ export type InboundQueuedTransfer<C extends Chain> = {
27
+ recipient: AccountAddress<C>;
28
+ amount: bigint;
29
+ rateLimitExpiryTimestamp: number;
30
+ };
31
+ /**
32
+ * TransceiverInstruction is a single instruction for the transceiver
33
+ * @property index the index of the instruction, may not be > 255
34
+ * @property payload the payload of the instruction, may not exceed 255 bytes
35
+ */
36
+ export type TransceiverInstruction = {
37
+ index: number;
38
+ payload: Uint8Array;
39
+ };
40
+ export function encodeTransceiverInstructions(ixs: TransceiverInstruction[]): Uint8Array;
41
+ /**
42
+ * messageDigest hashes a message for the Ntt manager, the digest is used
43
+ * to uniquely identify the message
44
+ * @param chain The chain that sent the message
45
+ * @param message The ntt message to hash
46
+ * @returns a 32 byte digest of the message
47
+ */
48
+ export function messageDigest(chain: Chain, message: Message): Uint8Array;
49
+ export {};
50
+ }
51
+ /**
52
+ * Ntt is the interface for the Ntt
53
+ *
54
+ * The Ntt is responsible for managing the coordination between the token contract and
55
+ * the transceiver(s). It is also responsible for managing the capacity of inbound or outbount transfers.
56
+ *
57
+ * @typeparam N the network
58
+ * @typeparam C the chain
59
+ */
60
+ export interface Ntt<N extends Network, C extends Chain> {
61
+ getCustodyAddress(): Promise<string>;
62
+ setPeer(peer: ChainAddress, tokenDecimals: number, inboundLimit: bigint, payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
63
+ setWormholeTransceiverPeer(peer: ChainAddress, payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
64
+ /**
65
+ * transfer sends a message to the Ntt manager to initiate a transfer
66
+ * @param sender the address of the sender
67
+ * @param amount the amount to transfer
68
+ * @param destination the destination chain
69
+ * @param queue whether to queue the transfer if the outbound capacity is exceeded
70
+ */
71
+ transfer(sender: AccountAddress<C>, amount: bigint, destination: ChainAddress, queue: boolean): AsyncGenerator<UnsignedTransaction<N, C>>;
72
+ /**
73
+ * redeem redeems a set of Attestations to the corresponding transceivers on the destination chain
74
+ * @param attestations The attestations to redeem, the length should be equal to the number of transceivers
75
+ */
76
+ redeem(attestations: Ntt.Attestation[], payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
77
+ /**
78
+ * getCurrentOutboundCapacity returns the current outbound capacity of the Ntt manager
79
+ */
80
+ getCurrentOutboundCapacity(): Promise<bigint>;
81
+ /**
82
+ * getCurrentInboundCapacity returns the current inbound capacity of the Ntt manager
83
+ * @param fromChain the chain to check the inbound capacity for
84
+ */
85
+ getCurrentInboundCapacity(fromChain: Chain): Promise<bigint>;
86
+ /**
87
+ * getInboundQueuedTransfer returns the details of an inbound queued transfer
88
+ * @param transceiverMessage the transceiver message
89
+ * @param fromChain the chain the transfer is from
90
+ */
91
+ getInboundQueuedTransfer(fromChain: Chain, transceiverMessage: Ntt.Message): Promise<Ntt.InboundQueuedTransfer<C> | null>;
92
+ /**
93
+ * completeInboundQueuedTransfer completes an inbound queued transfer
94
+ * @param transceiverMessage the transceiver message
95
+ * @param token the token to transfer
96
+ * @param fromChain the chain the transfer is from
97
+ * @param payer the address to pay for the transfer
98
+ */
99
+ completeInboundQueuedTransfer(fromChain: Chain, transceiverMessage: Ntt.Message, token: TokenAddress<C>, payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
100
+ }
101
+ export interface NttTransceiver<N extends Network, C extends Chain, A extends Ntt.Attestation> {
102
+ /**
103
+ * receive calls the `receive*` method on the transceiver
104
+ *
105
+ * @param attestation the attestation to redeem against the transceiver
106
+ * @param sender the address of the sender
107
+ */
108
+ receive(attestation: A, sender?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
109
+ setPeer(peer: ChainAddress<Chain>): AsyncGenerator<UnsignedTransaction<N, C>>;
110
+ }
111
+ export declare namespace WormholeNttTransceiver {
112
+ const _payloads: readonly ["WormholeTransfer"];
113
+ export type PayloadNames = (typeof _payloads)[number];
114
+ export type VAA<PayloadName extends PayloadNames = PayloadNames> = ProtocolVAA<Ntt.ProtocolName, PayloadName>;
115
+ export type Payload<PayloadName extends PayloadNames = PayloadNames> = ProtocolPayload<Ntt.ProtocolName, PayloadName>;
116
+ export {};
117
+ }
118
+ /**
119
+ * WormholeNttTransceiver is the interface for the Wormhole Ntt transceiver
120
+ *
121
+ * The WormholeNttTransceiver is responsible for verifying VAAs against the core
122
+ * bridge and signaling the NttManager that it can mint tokens.
123
+ */
124
+ export interface WormholeNttTransceiver<N extends Network, C extends Chain> extends NttTransceiver<N, C, WormholeNttTransceiver.VAA> {
125
+ }
126
+ declare module "@wormhole-foundation/sdk-definitions" {
127
+ namespace WormholeRegistry {
128
+ interface ProtocolToPlatformMapping {
129
+ Ntt: EmptyPlatformMap<Platform, Ntt.ProtocolName>;
130
+ }
131
+ }
132
+ }
133
+ //# sourceMappingURL=ntt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ntt.d.ts","sourceRoot":"","sources":["../../src/ntt.ts"],"names":[],"mappings":"AAAA,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AAC;IACpD,UAAiB,gBAAgB,CAAC;QAChC,UAAU,yBAAyB;YACjC,GAAG,EAAE,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;SACnD;KACF;CACF"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WormholeNttTransceiver = exports.Ntt = void 0;
4
+ const sdk_base_1 = require("@wormhole-foundation/sdk-base");
5
+ const sdk_definitions_1 = require("@wormhole-foundation/sdk-definitions");
6
+ const nttLayout_js_1 = require("./nttLayout.js");
7
+ /**
8
+ * @namespace Ntt
9
+ */
10
+ var Ntt;
11
+ (function (Ntt) {
12
+ const _protocol = "Ntt";
13
+ // TODO: should layoutify this but couldnt immediately figure out how to
14
+ // specify the length of the array as an encoded value
15
+ function encodeTransceiverInstructions(ixs) {
16
+ if (ixs.length > 255)
17
+ throw new Error(`Too many instructions (${ixs.length})`);
18
+ return sdk_base_1.encoding.bytes.concat(new Uint8Array([ixs.length]), ...ixs.map((ix) => (0, sdk_base_1.serializeLayout)((0, nttLayout_js_1.transceiverInstructionLayout)(), ix)));
19
+ }
20
+ Ntt.encodeTransceiverInstructions = encodeTransceiverInstructions;
21
+ /**
22
+ * messageDigest hashes a message for the Ntt manager, the digest is used
23
+ * to uniquely identify the message
24
+ * @param chain The chain that sent the message
25
+ * @param message The ntt message to hash
26
+ * @returns a 32 byte digest of the message
27
+ */
28
+ function messageDigest(chain, message) {
29
+ return (0, sdk_definitions_1.keccak256)(sdk_base_1.encoding.bytes.concat(sdk_base_1.encoding.bignum.toBytes((0, sdk_base_1.toChainId)(chain), 2), (0, sdk_base_1.serializeLayout)((0, nttLayout_js_1.nttManagerMessageLayout)(nttLayout_js_1.nativeTokenTransferLayout), message)));
30
+ }
31
+ Ntt.messageDigest = messageDigest;
32
+ })(Ntt || (exports.Ntt = Ntt = {}));
33
+ var WormholeNttTransceiver;
34
+ (function (WormholeNttTransceiver) {
35
+ const _payloads = ["WormholeTransfer"];
36
+ })(WormholeNttTransceiver || (exports.WormholeNttTransceiver = WormholeNttTransceiver = {}));
37
+ //# sourceMappingURL=ntt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ntt.js","sourceRoot":"","sources":["../../src/ntt.ts"],"names":[],"mappings":";;;AAAA,4DAOuC;AAEvC,0EAS8C;AAC9C,iDAKwB;AAExB;;GAEG;AACH,IAAiB,GAAG,CAqEnB;AArED,WAAiB,GAAG;IAClB,MAAM,SAAS,GAAG,KAAK,CAAC;IAuCxB,wEAAwE;IACxE,sDAAsD;IACtD,SAAgB,6BAA6B,CAAC,GAA6B;QACzE,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG;YAClB,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3D,OAAO,mBAAQ,CAAC,KAAK,CAAC,MAAM,CAC1B,IAAI,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAC5B,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAA,0BAAe,EAAC,IAAA,2CAA4B,GAAE,EAAE,EAAE,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;IAPe,iCAA6B,gCAO5C,CAAA;IAED;;;;;;OAMG;IACH,SAAgB,aAAa,CAAC,KAAY,EAAE,OAAgB;QAC1D,OAAO,IAAA,2BAAS,EACd,mBAAQ,CAAC,KAAK,CAAC,MAAM,CACnB,mBAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAC5C,IAAA,0BAAe,EACb,IAAA,sCAAuB,EAAC,wCAAyB,CAAC,EAClD,OAAO,CACR,CACF,CACF,CAAC;IACJ,CAAC;IAVe,iBAAa,gBAU5B,CAAA;AACH,CAAC,EArEgB,GAAG,mBAAH,GAAG,QAqEnB;AAoGD,IAAiB,sBAAsB,CAOtC;AAPD,WAAiB,sBAAsB;IACrC,MAAM,SAAS,GAAG,CAAC,kBAAkB,CAAU,CAAC;AAMlD,CAAC,EAPgB,sBAAsB,sCAAtB,sBAAsB,QAOtC"}
@@ -0,0 +1,257 @@
1
+ import type { CustomizableBytes, LayoutToType } from "@wormhole-foundation/sdk-base";
2
+ import { RegisterPayloadTypes } from "@wormhole-foundation/sdk-definitions";
3
+ export declare const trimmedAmountLayout: readonly [{
4
+ readonly name: "decimals";
5
+ readonly binary: "uint";
6
+ readonly size: 1;
7
+ }, {
8
+ readonly name: "amount";
9
+ readonly binary: "uint";
10
+ readonly size: 8;
11
+ }];
12
+ export type TrimmedAmount = LayoutToType<typeof trimmedAmountLayout>;
13
+ export type Prefix = readonly [number, number, number, number];
14
+ export declare const nativeTokenTransferLayout: readonly [{
15
+ readonly name: "prefix";
16
+ readonly binary: "bytes";
17
+ readonly custom: Uint8Array;
18
+ readonly omit: true;
19
+ }, {
20
+ readonly name: "trimmedAmount";
21
+ readonly binary: "bytes";
22
+ readonly layout: readonly [{
23
+ readonly name: "decimals";
24
+ readonly binary: "uint";
25
+ readonly size: 1;
26
+ }, {
27
+ readonly name: "amount";
28
+ readonly binary: "uint";
29
+ readonly size: 8;
30
+ }];
31
+ }, {
32
+ readonly binary: "bytes";
33
+ readonly size: 32;
34
+ readonly custom: {
35
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
36
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
37
+ };
38
+ readonly name: "sourceToken";
39
+ }, {
40
+ readonly binary: "bytes";
41
+ readonly size: 32;
42
+ readonly custom: {
43
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
44
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
45
+ };
46
+ readonly name: "recipientAddress";
47
+ }, {
48
+ readonly custom: {
49
+ to: (val: number) => "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia";
50
+ from: (val: "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia") => number;
51
+ };
52
+ readonly binary: "uint";
53
+ readonly size: 2;
54
+ readonly name: "recipientChain";
55
+ }];
56
+ export type NativeTokenTransfer = LayoutToType<typeof nativeTokenTransferLayout>;
57
+ export declare const transceiverMessageLayout: <const MP extends CustomizableBytes = undefined, const TP extends CustomizableBytes = undefined>(prefix: Prefix, nttManagerPayload?: MP, transceiverPayload?: TP) => readonly [{
58
+ readonly name: "prefix";
59
+ readonly binary: "bytes";
60
+ readonly custom: Uint8Array;
61
+ readonly omit: true;
62
+ }, {
63
+ readonly binary: "bytes";
64
+ readonly size: 32;
65
+ readonly custom: {
66
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
67
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
68
+ };
69
+ readonly name: "sourceNttManager";
70
+ }, {
71
+ readonly binary: "bytes";
72
+ readonly size: 32;
73
+ readonly custom: {
74
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
75
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
76
+ };
77
+ readonly name: "recipientNttManager";
78
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
79
+ readonly name: "nttManagerPayload";
80
+ readonly lengthSize: 2;
81
+ }, MP>, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
82
+ readonly name: "transceiverPayload";
83
+ readonly lengthSize: 2;
84
+ }, TP>];
85
+ export type TransceiverMessage<MP extends CustomizableBytes = undefined, TP extends CustomizableBytes = undefined> = LayoutToType<ReturnType<typeof transceiverMessageLayout<MP, TP>>>;
86
+ export declare const nttManagerMessageLayout: <const P extends CustomizableBytes = undefined>(customPayload?: P) => readonly [{
87
+ readonly name: "id";
88
+ readonly binary: "bytes";
89
+ readonly size: 32;
90
+ }, {
91
+ readonly binary: "bytes";
92
+ readonly size: 32;
93
+ readonly custom: {
94
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
95
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
96
+ };
97
+ readonly name: "sender";
98
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
99
+ readonly name: "payload";
100
+ readonly lengthSize: 2;
101
+ }, P>];
102
+ export type NttManagerMessage<P extends CustomizableBytes = undefined> = LayoutToType<ReturnType<typeof nttManagerMessageLayout<P>>>;
103
+ declare const optionalWormholeTransceiverPayloadLayout: readonly [{
104
+ readonly name: "version";
105
+ readonly binary: "uint";
106
+ readonly size: 2;
107
+ readonly custom: 1;
108
+ readonly omit: true;
109
+ }, {
110
+ readonly name: "forSpecializedRelayer";
111
+ readonly binary: "uint";
112
+ readonly size: 1;
113
+ readonly custom: {
114
+ readonly to: (val: number) => boolean;
115
+ readonly from: (val: boolean) => 1 | 0;
116
+ };
117
+ }];
118
+ type OptionalWormholeTransceiverPayload = LayoutToType<typeof optionalWormholeTransceiverPayloadLayout>;
119
+ export declare const wormholeTransceiverMessageLayout: <MP extends CustomizableBytes = undefined>(nttManagerPayload?: MP) => readonly [{
120
+ readonly name: "prefix";
121
+ readonly binary: "bytes";
122
+ readonly custom: Uint8Array;
123
+ readonly omit: true;
124
+ }, {
125
+ readonly binary: "bytes";
126
+ readonly size: 32;
127
+ readonly custom: {
128
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
129
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
130
+ };
131
+ readonly name: "sourceNttManager";
132
+ }, {
133
+ readonly binary: "bytes";
134
+ readonly size: 32;
135
+ readonly custom: {
136
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
137
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
138
+ };
139
+ readonly name: "recipientNttManager";
140
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
141
+ readonly name: "nttManagerPayload";
142
+ readonly lengthSize: 2;
143
+ }, MP>, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
144
+ readonly name: "transceiverPayload";
145
+ readonly lengthSize: 2;
146
+ }, {
147
+ readonly to: (encoded: Uint8Array) => {
148
+ readonly forSpecializedRelayer: boolean;
149
+ } | null;
150
+ readonly from: (value: OptionalWormholeTransceiverPayload | null) => Uint8Array;
151
+ }>];
152
+ export type WormholeTransceiverMessage<MP extends CustomizableBytes = undefined> = LayoutToType<ReturnType<typeof wormholeTransceiverMessageLayout<MP>>>;
153
+ export declare const transceiverInstructionLayout: <const P extends CustomizableBytes = undefined>(customPayload?: P) => readonly [{
154
+ readonly name: "index";
155
+ readonly binary: "uint";
156
+ readonly size: 1;
157
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
158
+ readonly name: "payload";
159
+ readonly lengthSize: 1;
160
+ }, P>];
161
+ export declare const nttNamedPayloads: readonly [readonly ["WormholeTransfer", readonly [{
162
+ readonly name: "prefix";
163
+ readonly binary: "bytes";
164
+ readonly custom: Uint8Array;
165
+ readonly omit: true;
166
+ }, {
167
+ readonly binary: "bytes";
168
+ readonly size: 32;
169
+ readonly custom: {
170
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
171
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
172
+ };
173
+ readonly name: "sourceNttManager";
174
+ }, {
175
+ readonly binary: "bytes";
176
+ readonly size: 32;
177
+ readonly custom: {
178
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
179
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
180
+ };
181
+ readonly name: "recipientNttManager";
182
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
183
+ readonly name: "nttManagerPayload";
184
+ readonly lengthSize: 2;
185
+ }, readonly [{
186
+ readonly name: "id";
187
+ readonly binary: "bytes";
188
+ readonly size: 32;
189
+ }, {
190
+ readonly binary: "bytes";
191
+ readonly size: 32;
192
+ readonly custom: {
193
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
194
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
195
+ };
196
+ readonly name: "sender";
197
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
198
+ readonly name: "payload";
199
+ readonly lengthSize: 2;
200
+ }, readonly [{
201
+ readonly name: "prefix";
202
+ readonly binary: "bytes";
203
+ readonly custom: Uint8Array;
204
+ readonly omit: true;
205
+ }, {
206
+ readonly name: "trimmedAmount";
207
+ readonly binary: "bytes";
208
+ readonly layout: readonly [{
209
+ readonly name: "decimals";
210
+ readonly binary: "uint";
211
+ readonly size: 1;
212
+ }, {
213
+ readonly name: "amount";
214
+ readonly binary: "uint";
215
+ readonly size: 8;
216
+ }];
217
+ }, {
218
+ readonly binary: "bytes";
219
+ readonly size: 32;
220
+ readonly custom: {
221
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
222
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
223
+ };
224
+ readonly name: "sourceToken";
225
+ }, {
226
+ readonly binary: "bytes";
227
+ readonly size: 32;
228
+ readonly custom: {
229
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
230
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
231
+ };
232
+ readonly name: "recipientAddress";
233
+ }, {
234
+ readonly custom: {
235
+ to: (val: number) => "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia";
236
+ from: (val: "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia") => number;
237
+ };
238
+ readonly binary: "uint";
239
+ readonly size: 2;
240
+ readonly name: "recipientChain";
241
+ }]>]>, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
242
+ readonly name: "transceiverPayload";
243
+ readonly lengthSize: 2;
244
+ }, {
245
+ readonly to: (encoded: Uint8Array) => {
246
+ readonly forSpecializedRelayer: boolean;
247
+ } | null;
248
+ readonly from: (value: OptionalWormholeTransceiverPayload | null) => Uint8Array;
249
+ }>]]];
250
+ declare module "@wormhole-foundation/sdk-definitions" {
251
+ namespace WormholeRegistry {
252
+ interface PayloadLiteralToLayoutMapping extends RegisterPayloadTypes<"Ntt", typeof nttNamedPayloads> {
253
+ }
254
+ }
255
+ }
256
+ export {};
257
+ //# sourceMappingURL=nttLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nttLayout.d.ts","sourceRoot":"","sources":["../../src/nttLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iBAAiB,EAEjB,YAAY,EACb,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EAEL,oBAAoB,EAGrB,MAAM,sCAAsC,CAAC;AAE9C,eAAO,MAAM,mBAAmB;;;;;;;;EAGL,CAAC;AAE5B,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,MAAM,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAU/D,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMX,CAAC;AA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KAAG,UAAU;KAwCpC,CAAC;AAGnC,OAAO,QAAQ,sCAAsC,CAAC;IACpD,UAAiB,gBAAgB,CAAC;QAChC,UAAU,6BACR,SAAQ,oBAAoB,CAAC,KAAK,EAAE,OAAO,gBAAgB,CAAC;SAAG;KAClE;CACF"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nttNamedPayloads = exports.transceiverInstructionLayout = exports.wormholeTransceiverMessageLayout = exports.nttManagerMessageLayout = exports.transceiverMessageLayout = exports.nativeTokenTransferLayout = exports.trimmedAmountLayout = void 0;
4
+ const sdk_base_1 = require("@wormhole-foundation/sdk-base");
5
+ const sdk_definitions_1 = require("@wormhole-foundation/sdk-definitions");
6
+ exports.trimmedAmountLayout = [
7
+ { name: "decimals", binary: "uint", size: 1 },
8
+ { name: "amount", binary: "uint", size: 8 },
9
+ ];
10
+ const prefixItem = (prefix) => ({
11
+ name: "prefix",
12
+ binary: "bytes",
13
+ custom: Uint8Array.from(prefix),
14
+ omit: true,
15
+ });
16
+ exports.nativeTokenTransferLayout = [
17
+ prefixItem([0x99, 0x4e, 0x54, 0x54]),
18
+ { name: "trimmedAmount", binary: "bytes", layout: exports.trimmedAmountLayout },
19
+ { name: "sourceToken", ...sdk_definitions_1.layoutItems.universalAddressItem },
20
+ { name: "recipientAddress", ...sdk_definitions_1.layoutItems.universalAddressItem },
21
+ { name: "recipientChain", ...sdk_definitions_1.layoutItems.chainItem() }, //TODO restrict to supported chains?
22
+ ];
23
+ const transceiverMessageLayout = (prefix, nttManagerPayload, transceiverPayload) => [
24
+ prefixItem(prefix),
25
+ { name: "sourceNttManager", ...sdk_definitions_1.layoutItems.universalAddressItem },
26
+ { name: "recipientNttManager", ...sdk_definitions_1.layoutItems.universalAddressItem },
27
+ (0, sdk_base_1.customizableBytes)({ name: "nttManagerPayload", lengthSize: 2 }, nttManagerPayload),
28
+ (0, sdk_base_1.customizableBytes)({ name: "transceiverPayload", lengthSize: 2 }, transceiverPayload),
29
+ ];
30
+ exports.transceiverMessageLayout = transceiverMessageLayout;
31
+ const nttManagerMessageLayout = (customPayload) => [
32
+ { name: "id", binary: "bytes", size: 32 },
33
+ { name: "sender", ...sdk_definitions_1.layoutItems.universalAddressItem },
34
+ (0, sdk_base_1.customizableBytes)({ name: "payload", lengthSize: 2 }, customPayload),
35
+ ];
36
+ exports.nttManagerMessageLayout = nttManagerMessageLayout;
37
+ const optionalWormholeTransceiverPayloadLayout = [
38
+ { name: "version", binary: "uint", size: 2, custom: 1, omit: true },
39
+ {
40
+ name: "forSpecializedRelayer",
41
+ binary: "uint",
42
+ size: 1,
43
+ custom: {
44
+ to: (val) => val > 0,
45
+ from: (val) => (val ? 1 : 0),
46
+ },
47
+ },
48
+ ];
49
+ const optionalWormholeTransceiverPayloadConversion = {
50
+ to: (encoded) => encoded.length === 0
51
+ ? null
52
+ : (0, sdk_base_1.deserializeLayout)(optionalWormholeTransceiverPayloadLayout, encoded),
53
+ from: (value) => value === null
54
+ ? new Uint8Array(0)
55
+ : (0, sdk_base_1.serializeLayout)(optionalWormholeTransceiverPayloadLayout, value),
56
+ };
57
+ const wormholeTransceiverMessageLayout = (nttManagerPayload) => (0, exports.transceiverMessageLayout)([0x99, 0x45, 0xff, 0x10], nttManagerPayload, optionalWormholeTransceiverPayloadConversion);
58
+ exports.wormholeTransceiverMessageLayout = wormholeTransceiverMessageLayout;
59
+ const wormholeNativeTokenTransferLayout = (0, exports.wormholeTransceiverMessageLayout)((0, exports.nttManagerMessageLayout)(exports.nativeTokenTransferLayout));
60
+ const transceiverInstructionLayout = (customPayload) => [
61
+ { name: "index", binary: "uint", size: 1 },
62
+ (0, sdk_base_1.customizableBytes)({ name: "payload", lengthSize: 1 }, customPayload),
63
+ ];
64
+ exports.transceiverInstructionLayout = transceiverInstructionLayout;
65
+ exports.nttNamedPayloads = [
66
+ ["WormholeTransfer", wormholeNativeTokenTransferLayout],
67
+ ];
68
+ (0, sdk_definitions_1.registerPayloadTypes)("Ntt", exports.nttNamedPayloads);
69
+ //# sourceMappingURL=nttLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nttLayout.js","sourceRoot":"","sources":["../../src/nttLayout.ts"],"names":[],"mappings":";;;AAMA,4DAIuC;AAEvC,0EAK8C;AAEjC,QAAA,mBAAmB,GAAG;IACjC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;IAC7C,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;CAClB,CAAC;AAM5B,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,EAAE,CACpC,CAAC;IACC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE,IAAI;CACD,CAAA,CAAC;AAED,QAAA,yBAAyB,GAAG;IACvC,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACpC,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,2BAAmB,EAAE;IACvE,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,6BAAW,CAAC,oBAAoB,EAAE;IAC5D,EAAE,IAAI,EAAE,kBAAkB,EAAE,GAAG,6BAAW,CAAC,oBAAoB,EAAE;IACjE,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,6BAAW,CAAC,SAAS,EAAE,EAAE,EAAE,oCAAoC;CACnE,CAAC;AAMrB,MAAM,wBAAwB,GAAG,CAItC,MAAc,EACd,iBAAsB,EACtB,kBAAuB,EACvB,EAAE,CACF;IACE,UAAU,CAAC,MAAM,CAAC;IAClB,EAAE,IAAI,EAAE,kBAAkB,EAAE,GAAG,6BAAW,CAAC,oBAAoB,EAAE;IACjE,EA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QAClB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAA,4BAAiB,EAAC,wCAAwC,EAAE,OAAO,CAAC;IAE1E,IAAI,EAAE,CAAC,KAAgD,EAAc,EAAE,CACrE,KAAK,KAAK,IAAI;QACZ,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC;QACnB,CAAC,CAAC,IAAA,0BAAe,EAAC,wCAAwC,EAAE,KAAK,CAAC;CAIvE,CAAC;AAEK,MAAM,gCAAgC,GAAG,CAG9C,iBAAsB,EACtB,EAAE,CACF,IAAA,gCAAwB,EACtB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EACxB,iBAAiB,EACjB,4CAA4C,CAC7C,CAAC;AATS,QAAA,gCAAgC,oCASzC;AAMJ,MAAM,iCAAiC,GAAG,IAAA,wCAAgC,EACxE,IAAA,+BAAuB,EAAC,iCAAyB,CAAC,CACnD,CAAC;AAEK,MAAM,4BAA4B,GAAG,CAG1C,aAAiB,EACjB,EAAE,CACF;IACE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;IAC1C,IAAA,4BAAiB,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC;CAC3C,CAAC;AARjB,QAAA,4BAA4B,gCAQX;AAEjB,QAAA,gBAAgB,GAAG;IAC9B,CAAC,kBAAkB,EAAE,iCAAiC,CAAC;CACvB,CAAC;AAUnC,IAAA,sCAAoB,EAAC,KAAK,EAAE,wBAAgB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,4 @@
1
+ export * from "./ntt.js";
2
+ export type { TrimmedAmount, Prefix, NativeTokenTransfer, TransceiverMessage, NttManagerMessage, WormholeTransceiverMessage, } from "./nttLayout.js";
3
+ export * from "./nttLayout.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,YAAY,EACV,aAAa,EACb,MAAM,EACN,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./ntt.js";
2
+ export * from "./nttLayout.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AASzB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,133 @@
1
+ import { type Chain, type Network, type Platform } from "@wormhole-foundation/sdk-base";
2
+ import { AccountAddress, ChainAddress, EmptyPlatformMap, ProtocolPayload, ProtocolVAA, TokenAddress, UnsignedTransaction } from "@wormhole-foundation/sdk-definitions";
3
+ import { NttManagerMessage, nativeTokenTransferLayout } from "./nttLayout.js";
4
+ /**
5
+ * @namespace Ntt
6
+ */
7
+ export declare namespace Ntt {
8
+ const _protocol = "Ntt";
9
+ export type ProtocolName = typeof _protocol;
10
+ export type Mode = "locking" | "burning";
11
+ export type Contracts = {
12
+ token: string;
13
+ manager: string;
14
+ transceiver: {
15
+ wormhole: string;
16
+ };
17
+ };
18
+ export type Message = NttManagerMessage<typeof nativeTokenTransferLayout>;
19
+ export type Attestation = any;
20
+ /**
21
+ * InboundQueuedTransfer is a queued transfer from another chain
22
+ * @property recipient the recipient of the transfer
23
+ * @property amount the amount of the transfer
24
+ * @property rateLimitExpiryTimestamp the timestamp when the rate limit expires
25
+ */
26
+ export type InboundQueuedTransfer<C extends Chain> = {
27
+ recipient: AccountAddress<C>;
28
+ amount: bigint;
29
+ rateLimitExpiryTimestamp: number;
30
+ };
31
+ /**
32
+ * TransceiverInstruction is a single instruction for the transceiver
33
+ * @property index the index of the instruction, may not be > 255
34
+ * @property payload the payload of the instruction, may not exceed 255 bytes
35
+ */
36
+ export type TransceiverInstruction = {
37
+ index: number;
38
+ payload: Uint8Array;
39
+ };
40
+ export function encodeTransceiverInstructions(ixs: TransceiverInstruction[]): Uint8Array;
41
+ /**
42
+ * messageDigest hashes a message for the Ntt manager, the digest is used
43
+ * to uniquely identify the message
44
+ * @param chain The chain that sent the message
45
+ * @param message The ntt message to hash
46
+ * @returns a 32 byte digest of the message
47
+ */
48
+ export function messageDigest(chain: Chain, message: Message): Uint8Array;
49
+ export {};
50
+ }
51
+ /**
52
+ * Ntt is the interface for the Ntt
53
+ *
54
+ * The Ntt is responsible for managing the coordination between the token contract and
55
+ * the transceiver(s). It is also responsible for managing the capacity of inbound or outbount transfers.
56
+ *
57
+ * @typeparam N the network
58
+ * @typeparam C the chain
59
+ */
60
+ export interface Ntt<N extends Network, C extends Chain> {
61
+ getCustodyAddress(): Promise<string>;
62
+ setPeer(peer: ChainAddress, tokenDecimals: number, inboundLimit: bigint, payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
63
+ setWormholeTransceiverPeer(peer: ChainAddress, payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
64
+ /**
65
+ * transfer sends a message to the Ntt manager to initiate a transfer
66
+ * @param sender the address of the sender
67
+ * @param amount the amount to transfer
68
+ * @param destination the destination chain
69
+ * @param queue whether to queue the transfer if the outbound capacity is exceeded
70
+ */
71
+ transfer(sender: AccountAddress<C>, amount: bigint, destination: ChainAddress, queue: boolean): AsyncGenerator<UnsignedTransaction<N, C>>;
72
+ /**
73
+ * redeem redeems a set of Attestations to the corresponding transceivers on the destination chain
74
+ * @param attestations The attestations to redeem, the length should be equal to the number of transceivers
75
+ */
76
+ redeem(attestations: Ntt.Attestation[], payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
77
+ /**
78
+ * getCurrentOutboundCapacity returns the current outbound capacity of the Ntt manager
79
+ */
80
+ getCurrentOutboundCapacity(): Promise<bigint>;
81
+ /**
82
+ * getCurrentInboundCapacity returns the current inbound capacity of the Ntt manager
83
+ * @param fromChain the chain to check the inbound capacity for
84
+ */
85
+ getCurrentInboundCapacity(fromChain: Chain): Promise<bigint>;
86
+ /**
87
+ * getInboundQueuedTransfer returns the details of an inbound queued transfer
88
+ * @param transceiverMessage the transceiver message
89
+ * @param fromChain the chain the transfer is from
90
+ */
91
+ getInboundQueuedTransfer(fromChain: Chain, transceiverMessage: Ntt.Message): Promise<Ntt.InboundQueuedTransfer<C> | null>;
92
+ /**
93
+ * completeInboundQueuedTransfer completes an inbound queued transfer
94
+ * @param transceiverMessage the transceiver message
95
+ * @param token the token to transfer
96
+ * @param fromChain the chain the transfer is from
97
+ * @param payer the address to pay for the transfer
98
+ */
99
+ completeInboundQueuedTransfer(fromChain: Chain, transceiverMessage: Ntt.Message, token: TokenAddress<C>, payer?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
100
+ }
101
+ export interface NttTransceiver<N extends Network, C extends Chain, A extends Ntt.Attestation> {
102
+ /**
103
+ * receive calls the `receive*` method on the transceiver
104
+ *
105
+ * @param attestation the attestation to redeem against the transceiver
106
+ * @param sender the address of the sender
107
+ */
108
+ receive(attestation: A, sender?: AccountAddress<C>): AsyncGenerator<UnsignedTransaction<N, C>>;
109
+ setPeer(peer: ChainAddress<Chain>): AsyncGenerator<UnsignedTransaction<N, C>>;
110
+ }
111
+ export declare namespace WormholeNttTransceiver {
112
+ const _payloads: readonly ["WormholeTransfer"];
113
+ export type PayloadNames = (typeof _payloads)[number];
114
+ export type VAA<PayloadName extends PayloadNames = PayloadNames> = ProtocolVAA<Ntt.ProtocolName, PayloadName>;
115
+ export type Payload<PayloadName extends PayloadNames = PayloadNames> = ProtocolPayload<Ntt.ProtocolName, PayloadName>;
116
+ export {};
117
+ }
118
+ /**
119
+ * WormholeNttTransceiver is the interface for the Wormhole Ntt transceiver
120
+ *
121
+ * The WormholeNttTransceiver is responsible for verifying VAAs against the core
122
+ * bridge and signaling the NttManager that it can mint tokens.
123
+ */
124
+ export interface WormholeNttTransceiver<N extends Network, C extends Chain> extends NttTransceiver<N, C, WormholeNttTransceiver.VAA> {
125
+ }
126
+ declare module "@wormhole-foundation/sdk-definitions" {
127
+ namespace WormholeRegistry {
128
+ interface ProtocolToPlatformMapping {
129
+ Ntt: EmptyPlatformMap<Platform, Ntt.ProtocolName>;
130
+ }
131
+ }
132
+ }
133
+ //# sourceMappingURL=ntt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ntt.d.ts","sourceRoot":"","sources":["../../src/ntt.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,YAAY,EACZ,mBAAmB,EAEpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EAG1B,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,yBAAiB,GAAG,CAAC;IACnB,MAAM,SAAS,QAAQ,CAAC;IACxB,MAAM,MAAM,YAAY,GAAG,OAAO,SAAS,CAAC;IAE5C,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,SAAS,CAAC;IACzC,MAAM,MAAM,SAAS,GAAG;QACtB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE;YACX,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC;IACF,MAAM,MAAM,OAAO,GAAG,iBAAiB,CAAC,OAAO,yBAAyB,CAAC,CAAC;IAK1E,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC;IAE9B;;;;;OAKG;IACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,KAAK,IAAI;QACnD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,CAAC,WAAW,SAAS,YAAY,GAAG,YAAY,IAC7D,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAC7C,MAAM,MAAM,OAAO,CAAC,WAAW,SAAS,YAAY,GAAG,YAAY,IACjE,eAAe,CAAC,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;;CAClD;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,SAAS,OAAO,EAAE,CAAC,SAAS,KAAK,CACxE,SAAQ,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,sBAAsB,CAAC,GAAG,CAAC;CAAG;AAK7D,OAAO,QAAQ,sCAAsC,CAAC;IACpD,UAAiB,gBAAgB,CAAC;QAChC,UAAU,yBAAyB;YACjC,GAAG,EAAE,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,YAAY,CAAC,CAAC;SACnD;KACF;CACF"}
@@ -0,0 +1,34 @@
1
+ import { encoding, serializeLayout, toChainId, } from "@wormhole-foundation/sdk-base";
2
+ import { keccak256, } from "@wormhole-foundation/sdk-definitions";
3
+ import { nativeTokenTransferLayout, nttManagerMessageLayout, transceiverInstructionLayout, } from "./nttLayout.js";
4
+ /**
5
+ * @namespace Ntt
6
+ */
7
+ export var Ntt;
8
+ (function (Ntt) {
9
+ const _protocol = "Ntt";
10
+ // TODO: should layoutify this but couldnt immediately figure out how to
11
+ // specify the length of the array as an encoded value
12
+ function encodeTransceiverInstructions(ixs) {
13
+ if (ixs.length > 255)
14
+ throw new Error(`Too many instructions (${ixs.length})`);
15
+ return encoding.bytes.concat(new Uint8Array([ixs.length]), ...ixs.map((ix) => serializeLayout(transceiverInstructionLayout(), ix)));
16
+ }
17
+ Ntt.encodeTransceiverInstructions = encodeTransceiverInstructions;
18
+ /**
19
+ * messageDigest hashes a message for the Ntt manager, the digest is used
20
+ * to uniquely identify the message
21
+ * @param chain The chain that sent the message
22
+ * @param message The ntt message to hash
23
+ * @returns a 32 byte digest of the message
24
+ */
25
+ function messageDigest(chain, message) {
26
+ return keccak256(encoding.bytes.concat(encoding.bignum.toBytes(toChainId(chain), 2), serializeLayout(nttManagerMessageLayout(nativeTokenTransferLayout), message)));
27
+ }
28
+ Ntt.messageDigest = messageDigest;
29
+ })(Ntt || (Ntt = {}));
30
+ export var WormholeNttTransceiver;
31
+ (function (WormholeNttTransceiver) {
32
+ const _payloads = ["WormholeTransfer"];
33
+ })(WormholeNttTransceiver || (WormholeNttTransceiver = {}));
34
+ //# sourceMappingURL=ntt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ntt.js","sourceRoot":"","sources":["../../src/ntt.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,eAAe,EACf,SAAS,GAIV,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAQL,SAAS,GACV,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAEL,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,GAC7B,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,KAAW,GAAG,CAqEnB;AArED,WAAiB,GAAG;IAClB,MAAM,SAAS,GAAG,KAAK,CAAC;IAuCxB,wEAAwE;IACxE,sDAAsD;IACtD,SAAgB,6BAA6B,CAAC,GAA6B;QACzE,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG;YAClB,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3D,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,CAC1B,IAAI,UAAU,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAC5B,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,eAAe,CAAC,4BAA4B,EAAE,EAAE,EAAE,CAAC,CAAC,CACxE,CAAC;IACJ,CAAC;IAPe,iCAA6B,gCAO5C,CAAA;IAED;;;;;;OAMG;IACH,SAAgB,aAAa,CAAC,KAAY,EAAE,OAAgB;QAC1D,OAAO,SAAS,CACd,QAAQ,CAAC,KAAK,CAAC,MAAM,CACnB,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAC5C,eAAe,CACb,uBAAuB,CAAC,yBAAyB,CAAC,EAClD,OAAO,CACR,CACF,CACF,CAAC;IACJ,CAAC;IAVe,iBAAa,gBAU5B,CAAA;AACH,CAAC,EArEgB,GAAG,KAAH,GAAG,QAqEnB;AAoGD,MAAM,KAAW,sBAAsB,CAOtC;AAPD,WAAiB,sBAAsB;IACrC,MAAM,SAAS,GAAG,CAAC,kBAAkB,CAAU,CAAC;AAMlD,CAAC,EAPgB,sBAAsB,KAAtB,sBAAsB,QAOtC"}
@@ -0,0 +1,257 @@
1
+ import type { CustomizableBytes, LayoutToType } from "@wormhole-foundation/sdk-base";
2
+ import { RegisterPayloadTypes } from "@wormhole-foundation/sdk-definitions";
3
+ export declare const trimmedAmountLayout: readonly [{
4
+ readonly name: "decimals";
5
+ readonly binary: "uint";
6
+ readonly size: 1;
7
+ }, {
8
+ readonly name: "amount";
9
+ readonly binary: "uint";
10
+ readonly size: 8;
11
+ }];
12
+ export type TrimmedAmount = LayoutToType<typeof trimmedAmountLayout>;
13
+ export type Prefix = readonly [number, number, number, number];
14
+ export declare const nativeTokenTransferLayout: readonly [{
15
+ readonly name: "prefix";
16
+ readonly binary: "bytes";
17
+ readonly custom: Uint8Array;
18
+ readonly omit: true;
19
+ }, {
20
+ readonly name: "trimmedAmount";
21
+ readonly binary: "bytes";
22
+ readonly layout: readonly [{
23
+ readonly name: "decimals";
24
+ readonly binary: "uint";
25
+ readonly size: 1;
26
+ }, {
27
+ readonly name: "amount";
28
+ readonly binary: "uint";
29
+ readonly size: 8;
30
+ }];
31
+ }, {
32
+ readonly binary: "bytes";
33
+ readonly size: 32;
34
+ readonly custom: {
35
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
36
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
37
+ };
38
+ readonly name: "sourceToken";
39
+ }, {
40
+ readonly binary: "bytes";
41
+ readonly size: 32;
42
+ readonly custom: {
43
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
44
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
45
+ };
46
+ readonly name: "recipientAddress";
47
+ }, {
48
+ readonly custom: {
49
+ to: (val: number) => "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia";
50
+ from: (val: "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia") => number;
51
+ };
52
+ readonly binary: "uint";
53
+ readonly size: 2;
54
+ readonly name: "recipientChain";
55
+ }];
56
+ export type NativeTokenTransfer = LayoutToType<typeof nativeTokenTransferLayout>;
57
+ export declare const transceiverMessageLayout: <const MP extends CustomizableBytes = undefined, const TP extends CustomizableBytes = undefined>(prefix: Prefix, nttManagerPayload?: MP, transceiverPayload?: TP) => readonly [{
58
+ readonly name: "prefix";
59
+ readonly binary: "bytes";
60
+ readonly custom: Uint8Array;
61
+ readonly omit: true;
62
+ }, {
63
+ readonly binary: "bytes";
64
+ readonly size: 32;
65
+ readonly custom: {
66
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
67
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
68
+ };
69
+ readonly name: "sourceNttManager";
70
+ }, {
71
+ readonly binary: "bytes";
72
+ readonly size: 32;
73
+ readonly custom: {
74
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
75
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
76
+ };
77
+ readonly name: "recipientNttManager";
78
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
79
+ readonly name: "nttManagerPayload";
80
+ readonly lengthSize: 2;
81
+ }, MP>, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
82
+ readonly name: "transceiverPayload";
83
+ readonly lengthSize: 2;
84
+ }, TP>];
85
+ export type TransceiverMessage<MP extends CustomizableBytes = undefined, TP extends CustomizableBytes = undefined> = LayoutToType<ReturnType<typeof transceiverMessageLayout<MP, TP>>>;
86
+ export declare const nttManagerMessageLayout: <const P extends CustomizableBytes = undefined>(customPayload?: P) => readonly [{
87
+ readonly name: "id";
88
+ readonly binary: "bytes";
89
+ readonly size: 32;
90
+ }, {
91
+ readonly binary: "bytes";
92
+ readonly size: 32;
93
+ readonly custom: {
94
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
95
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
96
+ };
97
+ readonly name: "sender";
98
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
99
+ readonly name: "payload";
100
+ readonly lengthSize: 2;
101
+ }, P>];
102
+ export type NttManagerMessage<P extends CustomizableBytes = undefined> = LayoutToType<ReturnType<typeof nttManagerMessageLayout<P>>>;
103
+ declare const optionalWormholeTransceiverPayloadLayout: readonly [{
104
+ readonly name: "version";
105
+ readonly binary: "uint";
106
+ readonly size: 2;
107
+ readonly custom: 1;
108
+ readonly omit: true;
109
+ }, {
110
+ readonly name: "forSpecializedRelayer";
111
+ readonly binary: "uint";
112
+ readonly size: 1;
113
+ readonly custom: {
114
+ readonly to: (val: number) => boolean;
115
+ readonly from: (val: boolean) => 1 | 0;
116
+ };
117
+ }];
118
+ type OptionalWormholeTransceiverPayload = LayoutToType<typeof optionalWormholeTransceiverPayloadLayout>;
119
+ export declare const wormholeTransceiverMessageLayout: <MP extends CustomizableBytes = undefined>(nttManagerPayload?: MP) => readonly [{
120
+ readonly name: "prefix";
121
+ readonly binary: "bytes";
122
+ readonly custom: Uint8Array;
123
+ readonly omit: true;
124
+ }, {
125
+ readonly binary: "bytes";
126
+ readonly size: 32;
127
+ readonly custom: {
128
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
129
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
130
+ };
131
+ readonly name: "sourceNttManager";
132
+ }, {
133
+ readonly binary: "bytes";
134
+ readonly size: 32;
135
+ readonly custom: {
136
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
137
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
138
+ };
139
+ readonly name: "recipientNttManager";
140
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
141
+ readonly name: "nttManagerPayload";
142
+ readonly lengthSize: 2;
143
+ }, MP>, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
144
+ readonly name: "transceiverPayload";
145
+ readonly lengthSize: 2;
146
+ }, {
147
+ readonly to: (encoded: Uint8Array) => {
148
+ readonly forSpecializedRelayer: boolean;
149
+ } | null;
150
+ readonly from: (value: OptionalWormholeTransceiverPayload | null) => Uint8Array;
151
+ }>];
152
+ export type WormholeTransceiverMessage<MP extends CustomizableBytes = undefined> = LayoutToType<ReturnType<typeof wormholeTransceiverMessageLayout<MP>>>;
153
+ export declare const transceiverInstructionLayout: <const P extends CustomizableBytes = undefined>(customPayload?: P) => readonly [{
154
+ readonly name: "index";
155
+ readonly binary: "uint";
156
+ readonly size: 1;
157
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
158
+ readonly name: "payload";
159
+ readonly lengthSize: 1;
160
+ }, P>];
161
+ export declare const nttNamedPayloads: readonly [readonly ["WormholeTransfer", readonly [{
162
+ readonly name: "prefix";
163
+ readonly binary: "bytes";
164
+ readonly custom: Uint8Array;
165
+ readonly omit: true;
166
+ }, {
167
+ readonly binary: "bytes";
168
+ readonly size: 32;
169
+ readonly custom: {
170
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
171
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
172
+ };
173
+ readonly name: "sourceNttManager";
174
+ }, {
175
+ readonly binary: "bytes";
176
+ readonly size: 32;
177
+ readonly custom: {
178
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
179
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
180
+ };
181
+ readonly name: "recipientNttManager";
182
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
183
+ readonly name: "nttManagerPayload";
184
+ readonly lengthSize: 2;
185
+ }, readonly [{
186
+ readonly name: "id";
187
+ readonly binary: "bytes";
188
+ readonly size: 32;
189
+ }, {
190
+ readonly binary: "bytes";
191
+ readonly size: 32;
192
+ readonly custom: {
193
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
194
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
195
+ };
196
+ readonly name: "sender";
197
+ }, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
198
+ readonly name: "payload";
199
+ readonly lengthSize: 2;
200
+ }, readonly [{
201
+ readonly name: "prefix";
202
+ readonly binary: "bytes";
203
+ readonly custom: Uint8Array;
204
+ readonly omit: true;
205
+ }, {
206
+ readonly name: "trimmedAmount";
207
+ readonly binary: "bytes";
208
+ readonly layout: readonly [{
209
+ readonly name: "decimals";
210
+ readonly binary: "uint";
211
+ readonly size: 1;
212
+ }, {
213
+ readonly name: "amount";
214
+ readonly binary: "uint";
215
+ readonly size: 8;
216
+ }];
217
+ }, {
218
+ readonly binary: "bytes";
219
+ readonly size: 32;
220
+ readonly custom: {
221
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
222
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
223
+ };
224
+ readonly name: "sourceToken";
225
+ }, {
226
+ readonly binary: "bytes";
227
+ readonly size: 32;
228
+ readonly custom: {
229
+ to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
230
+ from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
231
+ };
232
+ readonly name: "recipientAddress";
233
+ }, {
234
+ readonly custom: {
235
+ to: (val: number) => "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia";
236
+ from: (val: "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Rootstock" | "Scroll" | "Mantle" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia") => number;
237
+ };
238
+ readonly binary: "uint";
239
+ readonly size: 2;
240
+ readonly name: "recipientChain";
241
+ }]>]>, import("@wormhole-foundation/sdk-base").CustomizableBytesReturn<{
242
+ readonly name: "transceiverPayload";
243
+ readonly lengthSize: 2;
244
+ }, {
245
+ readonly to: (encoded: Uint8Array) => {
246
+ readonly forSpecializedRelayer: boolean;
247
+ } | null;
248
+ readonly from: (value: OptionalWormholeTransceiverPayload | null) => Uint8Array;
249
+ }>]]];
250
+ declare module "@wormhole-foundation/sdk-definitions" {
251
+ namespace WormholeRegistry {
252
+ interface PayloadLiteralToLayoutMapping extends RegisterPayloadTypes<"Ntt", typeof nttNamedPayloads> {
253
+ }
254
+ }
255
+ }
256
+ export {};
257
+ //# sourceMappingURL=nttLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nttLayout.d.ts","sourceRoot":"","sources":["../../src/nttLayout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iBAAiB,EAEjB,YAAY,EACb,MAAM,+BAA+B,CAAC;AAOvC,OAA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,EAAE,SAAS,iBAAiB,GAAG,SAAS,IACtC,YAAY,CAAC,UAAU,CAAC,OAAO,gCAAgC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAM1E,eAAO,MAAM,4BAA4B,kEAGvB,CAAC;;;;;;;MAKU,CAAC;AAE9B,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BA3Cb,UAAU;;;2BAKV,kCAAkC,GAAG,IAAI,KAAG,UAAU;KAwCpC,CAAC;AAGnC,OAAO,QAAQ,sCAAsC,CAAC;IACpD,UAAiB,gBAAgB,CAAC;QAChC,UAAU,6BACR,SAAQ,oBAAoB,CAAC,KAAK,EAAE,OAAO,gBAAgB,CAAC;SAAG;KAClE;CACF"}
@@ -0,0 +1,62 @@
1
+ import { customizableBytes, deserializeLayout, serializeLayout, } from "@wormhole-foundation/sdk-base";
2
+ import { layoutItems, registerPayloadTypes, } from "@wormhole-foundation/sdk-definitions";
3
+ export const trimmedAmountLayout = [
4
+ { name: "decimals", binary: "uint", size: 1 },
5
+ { name: "amount", binary: "uint", size: 8 },
6
+ ];
7
+ const prefixItem = (prefix) => ({
8
+ name: "prefix",
9
+ binary: "bytes",
10
+ custom: Uint8Array.from(prefix),
11
+ omit: true,
12
+ });
13
+ export const nativeTokenTransferLayout = [
14
+ prefixItem([0x99, 0x4e, 0x54, 0x54]),
15
+ { name: "trimmedAmount", binary: "bytes", layout: trimmedAmountLayout },
16
+ { name: "sourceToken", ...layoutItems.universalAddressItem },
17
+ { name: "recipientAddress", ...layoutItems.universalAddressItem },
18
+ { name: "recipientChain", ...layoutItems.chainItem() }, //TODO restrict to supported chains?
19
+ ];
20
+ export const transceiverMessageLayout = (prefix, nttManagerPayload, transceiverPayload) => [
21
+ prefixItem(prefix),
22
+ { name: "sourceNttManager", ...layoutItems.universalAddressItem },
23
+ { name: "recipientNttManager", ...layoutItems.universalAddressItem },
24
+ customizableBytes({ name: "nttManagerPayload", lengthSize: 2 }, nttManagerPayload),
25
+ customizableBytes({ name: "transceiverPayload", lengthSize: 2 }, transceiverPayload),
26
+ ];
27
+ export const nttManagerMessageLayout = (customPayload) => [
28
+ { name: "id", binary: "bytes", size: 32 },
29
+ { name: "sender", ...layoutItems.universalAddressItem },
30
+ customizableBytes({ name: "payload", lengthSize: 2 }, customPayload),
31
+ ];
32
+ const optionalWormholeTransceiverPayloadLayout = [
33
+ { name: "version", binary: "uint", size: 2, custom: 1, omit: true },
34
+ {
35
+ name: "forSpecializedRelayer",
36
+ binary: "uint",
37
+ size: 1,
38
+ custom: {
39
+ to: (val) => val > 0,
40
+ from: (val) => (val ? 1 : 0),
41
+ },
42
+ },
43
+ ];
44
+ const optionalWormholeTransceiverPayloadConversion = {
45
+ to: (encoded) => encoded.length === 0
46
+ ? null
47
+ : deserializeLayout(optionalWormholeTransceiverPayloadLayout, encoded),
48
+ from: (value) => value === null
49
+ ? new Uint8Array(0)
50
+ : serializeLayout(optionalWormholeTransceiverPayloadLayout, value),
51
+ };
52
+ export const wormholeTransceiverMessageLayout = (nttManagerPayload) => transceiverMessageLayout([0x99, 0x45, 0xff, 0x10], nttManagerPayload, optionalWormholeTransceiverPayloadConversion);
53
+ const wormholeNativeTokenTransferLayout = wormholeTransceiverMessageLayout(nttManagerMessageLayout(nativeTokenTransferLayout));
54
+ export const transceiverInstructionLayout = (customPayload) => [
55
+ { name: "index", binary: "uint", size: 1 },
56
+ customizableBytes({ name: "payload", lengthSize: 1 }, customPayload),
57
+ ];
58
+ export const nttNamedPayloads = [
59
+ ["WormholeTransfer", wormholeNativeTokenTransferLayout],
60
+ ];
61
+ registerPayloadTypes("Ntt", nttNamedPayloads);
62
+ //# sourceMappingURL=nttLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nttLayout.js","sourceRoot":"","sources":["../../src/nttLayout.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,iBAAi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CAAC,KAAgD,EAAc,EAAE,CACrE,KAAK,KAAK,IAAI;QACZ,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC;QACnB,CAAC,CAAC,eAAe,CAAC,wCAAwC,EAAE,KAAK,CAAC;CAIvE,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAG9C,iBAAsB,EACtB,EAAE,CACF,wBAAwB,CACtB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EACxB,iBAAiB,EACjB,4CAA4C,CAC7C,CAAC;AAMJ,MAAM,iCAAiC,GAAG,gCAAgC,CACxE,uBAAuB,CAAC,yBAAyB,CAAC,CACnD,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAG1C,aAAiB,EACjB,EAAE,CACF;IACE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE;IAC1C,iBAAiB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC;CAC3C,CAAC;AAE9B,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,CAAC,kBAAkB,EAAE,iCAAiC,CAAC;CACvB,CAAC;AAUnC,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "@wormhole-foundation/sdk-definitions-ntt",
3
+ "version": "0.0.1-beta.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
+ "main": "./dist/cjs/index.js",
16
+ "module": "./dist/esm/index.js",
17
+ "types": "./dist/cjs/index.d.ts",
18
+ "files": [
19
+ "dist/esm",
20
+ "dist/cjs"
21
+ ],
22
+ "exports": {
23
+ ".": {
24
+ "require": {
25
+ "types": "./dist/cjs/index.d.ts",
26
+ "default": "./dist/cjs/index.js"
27
+ },
28
+ "import": {
29
+ "types": "./dist/esm/index.d.ts",
30
+ "default": "./dist/esm/index.js"
31
+ }
32
+ }
33
+ },
34
+ "typesVersions": {
35
+ "*": {
36
+ "*": [
37
+ "./dist/cjs/index.d.ts",
38
+ "./dist/esm/index.d.ts"
39
+ ]
40
+ }
41
+ },
42
+ "scripts": {
43
+ "build:cjs": "tsc -p ./tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
44
+ "build:esm": "tsc -p ./tsconfig.esm.json",
45
+ "build": "npm run build:esm && npm run build:cjs",
46
+ "rebuild": "npm run clean && npm run build",
47
+ "clean": "rm -rf ./dist",
48
+ "test": "jest --config ./jest.config.ts"
49
+ },
50
+ "dependencies": {
51
+ "@noble/hashes": "^1.3.1",
52
+ "@wormhole-foundation/sdk-base": "0.5.2-beta.10",
53
+ "@wormhole-foundation/sdk-definitions": "0.5.2-beta.10"
54
+ },
55
+ "type": "module"
56
+ }