@hyperlane-xyz/sealevel-sdk 27.0.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/LICENSE.md +193 -0
- package/dist/accounts/mint.d.ts +43 -0
- package/dist/accounts/mint.d.ts.map +1 -0
- package/dist/accounts/mint.js +159 -0
- package/dist/accounts/mint.js.map +1 -0
- package/dist/accounts/multisig-ism-message-id.d.ts +14 -0
- package/dist/accounts/multisig-ism-message-id.d.ts.map +1 -0
- package/dist/accounts/multisig-ism-message-id.js +32 -0
- package/dist/accounts/multisig-ism-message-id.js.map +1 -0
- package/dist/accounts/test-ism.d.ts +5 -0
- package/dist/accounts/test-ism.d.ts.map +1 -0
- package/dist/accounts/test-ism.js +8 -0
- package/dist/accounts/test-ism.js.map +1 -0
- package/dist/accounts/token.d.ts +60 -0
- package/dist/accounts/token.d.ts.map +1 -0
- package/dist/accounts/token.js +127 -0
- package/dist/accounts/token.js.map +1 -0
- package/dist/clients/protocol.d.ts +21 -0
- package/dist/clients/protocol.d.ts.map +1 -0
- package/dist/clients/protocol.js +51 -0
- package/dist/clients/protocol.js.map +1 -0
- package/dist/clients/provider.d.ts +66 -0
- package/dist/clients/provider.d.ts.map +1 -0
- package/dist/clients/provider.js +237 -0
- package/dist/clients/provider.js.map +1 -0
- package/dist/clients/signer.d.ts +61 -0
- package/dist/clients/signer.d.ts.map +1 -0
- package/dist/clients/signer.js +314 -0
- package/dist/clients/signer.js.map +1 -0
- package/dist/codecs/account-data.d.ts +8 -0
- package/dist/codecs/account-data.d.ts.map +1 -0
- package/dist/codecs/account-data.js +20 -0
- package/dist/codecs/account-data.js.map +1 -0
- package/dist/codecs/binary.d.ts +34 -0
- package/dist/codecs/binary.d.ts.map +1 -0
- package/dist/codecs/binary.js +165 -0
- package/dist/codecs/binary.js.map +1 -0
- package/dist/codecs/shared.d.ts +81 -0
- package/dist/codecs/shared.d.ts.map +1 -0
- package/dist/codecs/shared.js +241 -0
- package/dist/codecs/shared.js.map +1 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +21 -0
- package/dist/constants.js.map +1 -0
- package/dist/deploy/program-deployer.d.ts +51 -0
- package/dist/deploy/program-deployer.d.ts.map +1 -0
- package/dist/deploy/program-deployer.js +176 -0
- package/dist/deploy/program-deployer.js.map +1 -0
- package/dist/deploy/resolve-program.d.ts +9 -0
- package/dist/deploy/resolve-program.d.ts.map +1 -0
- package/dist/deploy/resolve-program.js +24 -0
- package/dist/deploy/resolve-program.js.map +1 -0
- package/dist/generated/core-addresses.d.ts +14 -0
- package/dist/generated/core-addresses.d.ts.map +1 -0
- package/dist/generated/core-addresses.js +55 -0
- package/dist/generated/core-addresses.js.map +1 -0
- package/dist/hook/hook-artifact-manager.d.ts +17 -0
- package/dist/hook/hook-artifact-manager.d.ts.map +1 -0
- package/dist/hook/hook-artifact-manager.js +58 -0
- package/dist/hook/hook-artifact-manager.js.map +1 -0
- package/dist/hook/hook-query.d.ts +25 -0
- package/dist/hook/hook-query.d.ts.map +1 -0
- package/dist/hook/hook-query.js +46 -0
- package/dist/hook/hook-query.js.map +1 -0
- package/dist/hook/igp-hook.d.ts +28 -0
- package/dist/hook/igp-hook.d.ts.map +1 -0
- package/dist/hook/igp-hook.js +242 -0
- package/dist/hook/igp-hook.js.map +1 -0
- package/dist/hook/merkle-tree-hook.d.ts +23 -0
- package/dist/hook/merkle-tree-hook.d.ts.map +1 -0
- package/dist/hook/merkle-tree-hook.js +46 -0
- package/dist/hook/merkle-tree-hook.js.map +1 -0
- package/dist/hyperlane/program-bytes.d.ts +20 -0
- package/dist/hyperlane/program-bytes.d.ts.map +1 -0
- package/dist/hyperlane/program-bytes.js +80534 -0
- package/dist/hyperlane/program-bytes.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions/igp.d.ts +66 -0
- package/dist/instructions/igp.d.ts.map +1 -0
- package/dist/instructions/igp.js +168 -0
- package/dist/instructions/igp.js.map +1 -0
- package/dist/instructions/interfaces.d.ts +52 -0
- package/dist/instructions/interfaces.d.ts.map +1 -0
- package/dist/instructions/interfaces.js +126 -0
- package/dist/instructions/interfaces.js.map +1 -0
- package/dist/instructions/loader.d.ts +11 -0
- package/dist/instructions/loader.d.ts.map +1 -0
- package/dist/instructions/loader.js +24 -0
- package/dist/instructions/loader.js.map +1 -0
- package/dist/instructions/multisig-ism-message-id.d.ts +32 -0
- package/dist/instructions/multisig-ism-message-id.d.ts.map +1 -0
- package/dist/instructions/multisig-ism-message-id.js +105 -0
- package/dist/instructions/multisig-ism-message-id.js.map +1 -0
- package/dist/instructions/test-ism.d.ts +16 -0
- package/dist/instructions/test-ism.d.ts.map +1 -0
- package/dist/instructions/test-ism.js +47 -0
- package/dist/instructions/test-ism.js.map +1 -0
- package/dist/instructions/token.d.ts +62 -0
- package/dist/instructions/token.d.ts.map +1 -0
- package/dist/instructions/token.js +257 -0
- package/dist/instructions/token.js.map +1 -0
- package/dist/instructions/utils.d.ts +19 -0
- package/dist/instructions/utils.d.ts.map +1 -0
- package/dist/instructions/utils.js +36 -0
- package/dist/instructions/utils.js.map +1 -0
- package/dist/ism/ism-artifact-manager.d.ts +14 -0
- package/dist/ism/ism-artifact-manager.d.ts.map +1 -0
- package/dist/ism/ism-artifact-manager.js +49 -0
- package/dist/ism/ism-artifact-manager.js.map +1 -0
- package/dist/ism/ism-query.d.ts +22 -0
- package/dist/ism/ism-query.d.ts.map +1 -0
- package/dist/ism/ism-query.js +53 -0
- package/dist/ism/ism-query.js.map +1 -0
- package/dist/ism/multisig-ism.d.ts +33 -0
- package/dist/ism/multisig-ism.d.ts.map +1 -0
- package/dist/ism/multisig-ism.js +113 -0
- package/dist/ism/multisig-ism.js.map +1 -0
- package/dist/ism/test-ism.d.ts +20 -0
- package/dist/ism/test-ism.d.ts.map +1 -0
- package/dist/ism/test-ism.js +57 -0
- package/dist/ism/test-ism.js.map +1 -0
- package/dist/pda.d.ts +17 -0
- package/dist/pda.d.ts.map +1 -0
- package/dist/pda.js +118 -0
- package/dist/pda.js.map +1 -0
- package/dist/rpc.d.ts +9 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +21 -0
- package/dist/rpc.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +3 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/setup.d.ts +33 -0
- package/dist/testing/setup.d.ts.map +1 -0
- package/dist/testing/setup.js +120 -0
- package/dist/testing/setup.js.map +1 -0
- package/dist/testing/solana-container.d.ts +32 -0
- package/dist/testing/solana-container.d.ts.map +1 -0
- package/dist/testing/solana-container.js +289 -0
- package/dist/testing/solana-container.js.map +1 -0
- package/dist/tests/collateral-token.e2e-test.d.ts +2 -0
- package/dist/tests/collateral-token.e2e-test.d.ts.map +1 -0
- package/dist/tests/collateral-token.e2e-test.js +112 -0
- package/dist/tests/collateral-token.e2e-test.js.map +1 -0
- package/dist/tests/deploy.e2e-test.d.ts +2 -0
- package/dist/tests/deploy.e2e-test.d.ts.map +1 -0
- package/dist/tests/deploy.e2e-test.js +76 -0
- package/dist/tests/deploy.e2e-test.js.map +1 -0
- package/dist/tests/hook.e2e-test.d.ts +2 -0
- package/dist/tests/hook.e2e-test.d.ts.map +1 -0
- package/dist/tests/hook.e2e-test.js +176 -0
- package/dist/tests/hook.e2e-test.js.map +1 -0
- package/dist/tests/ism.e2e-test.d.ts +2 -0
- package/dist/tests/ism.e2e-test.d.ts.map +1 -0
- package/dist/tests/ism.e2e-test.js +167 -0
- package/dist/tests/ism.e2e-test.js.map +1 -0
- package/dist/tests/native-token.e2e-test.d.ts +2 -0
- package/dist/tests/native-token.e2e-test.d.ts.map +1 -0
- package/dist/tests/native-token.e2e-test.js +93 -0
- package/dist/tests/native-token.e2e-test.js.map +1 -0
- package/dist/tests/provider.e2e-test.d.ts +2 -0
- package/dist/tests/provider.e2e-test.d.ts.map +1 -0
- package/dist/tests/provider.e2e-test.js +87 -0
- package/dist/tests/provider.e2e-test.js.map +1 -0
- package/dist/tests/read-token.e2e-test.d.ts +2 -0
- package/dist/tests/read-token.e2e-test.d.ts.map +1 -0
- package/dist/tests/read-token.e2e-test.js +79 -0
- package/dist/tests/read-token.e2e-test.js.map +1 -0
- package/dist/tests/scale.unit-test.d.ts +2 -0
- package/dist/tests/scale.unit-test.d.ts.map +1 -0
- package/dist/tests/scale.unit-test.js +65 -0
- package/dist/tests/scale.unit-test.js.map +1 -0
- package/dist/tests/synthetic-token.e2e-test.d.ts +2 -0
- package/dist/tests/synthetic-token.e2e-test.d.ts.map +1 -0
- package/dist/tests/synthetic-token.e2e-test.js +115 -0
- package/dist/tests/synthetic-token.e2e-test.js.map +1 -0
- package/dist/tests/warp-token-suite.d.ts +26 -0
- package/dist/tests/warp-token-suite.d.ts.map +1 -0
- package/dist/tests/warp-token-suite.js +208 -0
- package/dist/tests/warp-token-suite.js.map +1 -0
- package/dist/tx.d.ts +23 -0
- package/dist/tx.d.ts.map +1 -0
- package/dist/tx.js +43 -0
- package/dist/tx.js.map +1 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/warp/collateral-token.d.ts +21 -0
- package/dist/warp/collateral-token.d.ts.map +1 -0
- package/dist/warp/collateral-token.js +129 -0
- package/dist/warp/collateral-token.js.map +1 -0
- package/dist/warp/native-token.d.ts +21 -0
- package/dist/warp/native-token.d.ts.map +1 -0
- package/dist/warp/native-token.js +99 -0
- package/dist/warp/native-token.js.map +1 -0
- package/dist/warp/synthetic-token.d.ts +21 -0
- package/dist/warp/synthetic-token.d.ts.map +1 -0
- package/dist/warp/synthetic-token.js +180 -0
- package/dist/warp/synthetic-token.js.map +1 -0
- package/dist/warp/types.d.ts +16 -0
- package/dist/warp/types.d.ts.map +1 -0
- package/dist/warp/types.js +2 -0
- package/dist/warp/types.js.map +1 -0
- package/dist/warp/warp-artifact-manager.d.ts +14 -0
- package/dist/warp/warp-artifact-manager.d.ts.map +1 -0
- package/dist/warp/warp-artifact-manager.js +52 -0
- package/dist/warp/warp-artifact-manager.js.map +1 -0
- package/dist/warp/warp-query.d.ts +30 -0
- package/dist/warp/warp-query.d.ts.map +1 -0
- package/dist/warp/warp-query.js +66 -0
- package/dist/warp/warp-query.js.map +1 -0
- package/dist/warp/warp-tx.d.ts +64 -0
- package/dist/warp/warp-tx.d.ts.map +1 -0
- package/dist/warp/warp-tx.js +291 -0
- package/dist/warp/warp-tx.js.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { getAddressCodec } from '@solana/kit';
|
|
2
|
+
import { assert, strip0x } from '@hyperlane-xyz/utils';
|
|
3
|
+
const ADDRESS_CODEC = getAddressCodec();
|
|
4
|
+
import { PROGRAM_INSTRUCTION_DISCRIMINATOR, SYSTEM_PROGRAM_ADDRESS, } from '../constants.js';
|
|
5
|
+
import { ByteCursor, concatBytes, option, u8 } from '../codecs/binary.js';
|
|
6
|
+
import { decodeDomainedValidatorsAndThreshold, encodeDomainedValidatorsAndThreshold, } from '../codecs/shared.js';
|
|
7
|
+
import { isProgramInstructionDiscriminator } from './interfaces.js';
|
|
8
|
+
import { buildInstruction, readonlyAccount, writableAccount, writableSigner, } from './utils.js';
|
|
9
|
+
import { deriveMultisigIsmAccessControlPda, deriveMultisigIsmDomainDataPda, } from '../pda.js';
|
|
10
|
+
export var MultisigIsmMessageIdProgramInstructionKind;
|
|
11
|
+
(function (MultisigIsmMessageIdProgramInstructionKind) {
|
|
12
|
+
MultisigIsmMessageIdProgramInstructionKind[MultisigIsmMessageIdProgramInstructionKind["Initialize"] = 0] = "Initialize";
|
|
13
|
+
MultisigIsmMessageIdProgramInstructionKind[MultisigIsmMessageIdProgramInstructionKind["SetValidatorsAndThreshold"] = 1] = "SetValidatorsAndThreshold";
|
|
14
|
+
MultisigIsmMessageIdProgramInstructionKind[MultisigIsmMessageIdProgramInstructionKind["GetOwner"] = 2] = "GetOwner";
|
|
15
|
+
MultisigIsmMessageIdProgramInstructionKind[MultisigIsmMessageIdProgramInstructionKind["TransferOwnership"] = 3] = "TransferOwnership";
|
|
16
|
+
})(MultisigIsmMessageIdProgramInstructionKind || (MultisigIsmMessageIdProgramInstructionKind = {}));
|
|
17
|
+
export function encodeMultisigIsmMessageIdProgramInstruction(instruction) {
|
|
18
|
+
switch (instruction.kind) {
|
|
19
|
+
case 'initialize':
|
|
20
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(MultisigIsmMessageIdProgramInstructionKind.Initialize));
|
|
21
|
+
case 'setValidatorsAndThreshold':
|
|
22
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(MultisigIsmMessageIdProgramInstructionKind.SetValidatorsAndThreshold), encodeDomainedValidatorsAndThreshold(instruction.value));
|
|
23
|
+
case 'getOwner':
|
|
24
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(MultisigIsmMessageIdProgramInstructionKind.GetOwner));
|
|
25
|
+
case 'transferOwnership':
|
|
26
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(MultisigIsmMessageIdProgramInstructionKind.TransferOwnership), option(instruction.newOwner, (owner) => ADDRESS_CODEC.encode(owner)));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function decodeMultisigIsmMessageIdProgramInstruction(data) {
|
|
30
|
+
if (data.length < 9)
|
|
31
|
+
return null;
|
|
32
|
+
const cursor = new ByteCursor(data);
|
|
33
|
+
cursor.readBytes(8);
|
|
34
|
+
if (!isProgramInstructionDiscriminator(data))
|
|
35
|
+
return null;
|
|
36
|
+
const kind = cursor.readU8();
|
|
37
|
+
switch (kind) {
|
|
38
|
+
case MultisigIsmMessageIdProgramInstructionKind.Initialize:
|
|
39
|
+
return { kind: 'initialize' };
|
|
40
|
+
case MultisigIsmMessageIdProgramInstructionKind.SetValidatorsAndThreshold:
|
|
41
|
+
return {
|
|
42
|
+
kind: 'setValidatorsAndThreshold',
|
|
43
|
+
value: decodeDomainedValidatorsAndThreshold(cursor),
|
|
44
|
+
};
|
|
45
|
+
case MultisigIsmMessageIdProgramInstructionKind.GetOwner:
|
|
46
|
+
return { kind: 'getOwner' };
|
|
47
|
+
case MultisigIsmMessageIdProgramInstructionKind.TransferOwnership: {
|
|
48
|
+
const hasOwner = cursor.readU8() === 1;
|
|
49
|
+
return {
|
|
50
|
+
kind: 'transferOwnership',
|
|
51
|
+
newOwner: hasOwner ? ADDRESS_CODEC.decode(cursor.readBytes(32)) : null,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
default:
|
|
55
|
+
if (kind <= MultisigIsmMessageIdProgramInstructionKind.TransferOwnership) {
|
|
56
|
+
throw new Error(`MultisigIsmMessageId instruction kind ${kind} is recognized but decoding is not yet implemented`);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export async function getInitializeMultisigIsmMessageIdInstruction(programAddress, owner) {
|
|
62
|
+
const { address: accessControl } = await deriveMultisigIsmAccessControlPda(programAddress);
|
|
63
|
+
return buildInstruction(programAddress, [
|
|
64
|
+
writableSigner(owner),
|
|
65
|
+
writableAccount(accessControl),
|
|
66
|
+
readonlyAccount(SYSTEM_PROGRAM_ADDRESS),
|
|
67
|
+
], encodeMultisigIsmMessageIdProgramInstruction({ kind: 'initialize' }));
|
|
68
|
+
}
|
|
69
|
+
export async function getSetValidatorsAndThresholdInstruction(args) {
|
|
70
|
+
const { address: accessControl } = await deriveMultisigIsmAccessControlPda(args.programAddress);
|
|
71
|
+
const { address: domainData } = await deriveMultisigIsmDomainDataPda(args.programAddress, args.domain);
|
|
72
|
+
const validators = args.validators.map((v) => typeof v === 'string' ? hexToBytes20(v) : v);
|
|
73
|
+
return buildInstruction(args.programAddress, [
|
|
74
|
+
writableSigner(args.owner),
|
|
75
|
+
readonlyAccount(accessControl),
|
|
76
|
+
writableAccount(domainData),
|
|
77
|
+
readonlyAccount(SYSTEM_PROGRAM_ADDRESS),
|
|
78
|
+
], encodeMultisigIsmMessageIdProgramInstruction({
|
|
79
|
+
kind: 'setValidatorsAndThreshold',
|
|
80
|
+
value: {
|
|
81
|
+
domain: args.domain,
|
|
82
|
+
data: {
|
|
83
|
+
validators,
|
|
84
|
+
threshold: args.threshold,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
export async function getTransferOwnershipInstruction(programAddress, owner, newOwner) {
|
|
90
|
+
const { address: accessControl } = await deriveMultisigIsmAccessControlPda(programAddress);
|
|
91
|
+
return buildInstruction(programAddress, [writableSigner(owner), writableAccount(accessControl)], encodeMultisigIsmMessageIdProgramInstruction({
|
|
92
|
+
kind: 'transferOwnership',
|
|
93
|
+
newOwner,
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
function hexToBytes20(value) {
|
|
97
|
+
const hex = strip0x(value);
|
|
98
|
+
assert(/^[0-9a-fA-F]{40}$/.test(hex), `Expected 20-byte hex validator, got ${value}`);
|
|
99
|
+
const out = new Uint8Array(20);
|
|
100
|
+
for (let i = 0; i < 20; i += 1) {
|
|
101
|
+
out[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
|
|
102
|
+
}
|
|
103
|
+
return out;
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=multisig-ism-message-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multisig-ism-message-id.js","sourceRoot":"","sources":["../../src/instructions/multisig-ism-message-id.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,aAAa,GAAG,e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F;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,cAAuB,EACvB,KAAwB,EACxB,QAAwB;IAExB,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAC9B,MAAM,iCAAiC,CAAC,cAAc,CAAC,CAAC;IAC1D,OAAO,gBAAgB,CACrB,cAAc,EACd,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC,EACvD,4CAA4C,CAAC;QAC3C,IAAI,EAAE,mBAAmB;QACzB,QAAQ;KACT,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,CACJ,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAC7B,uCAAuC,KAAK,EAAE,CAC/C,CAAC;IACF,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Address, Instruction, ReadonlyUint8Array, TransactionSigner } from '@solana/kit';
|
|
2
|
+
export declare enum TestIsmInstructionKind {
|
|
3
|
+
Init = 0,
|
|
4
|
+
SetAccept = 1
|
|
5
|
+
}
|
|
6
|
+
export type TestIsmProgramInstruction = {
|
|
7
|
+
kind: 'init';
|
|
8
|
+
} | {
|
|
9
|
+
kind: 'setAccept';
|
|
10
|
+
accept: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare function encodeTestIsmProgramInstruction(instruction: TestIsmProgramInstruction): ReadonlyUint8Array;
|
|
13
|
+
export declare function decodeTestIsmProgramInstruction(data: Uint8Array): TestIsmProgramInstruction | null;
|
|
14
|
+
export declare function getInitTestIsmInstruction(programAddress: Address, payer: TransactionSigner): Promise<Instruction>;
|
|
15
|
+
export declare function getSetAcceptTestIsmInstruction(programAddress: Address, accept: boolean): Promise<Instruction>;
|
|
16
|
+
//# sourceMappingURL=test-ism.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-ism.d.ts","sourceRoot":"","sources":["../../src/instructions/test-ism.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAYrB,oBAAY,sBAAsB;IAChC,IAAI,IAAI;IACR,SAAS,IAAI;CACd;AAED,MAAM,MAAM,yBAAyB,GACjC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAE3C,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,yBAAyB,GACrC,kBAAkB,CAUpB;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,UAAU,GACf,yBAAyB,GAAG,IAAI,CAiBlC;AAED,wBAAsB,yBAAyB,CAC7C,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,WAAW,CAAC,CAWtB;AAED,wBAAsB,8BAA8B,CAClD,cAAc,EAAE,OAAO,EACvB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,WAAW,CAAC,CAOtB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { SYSTEM_PROGRAM_ADDRESS } from '../constants.js';
|
|
2
|
+
import { ByteCursor, concatBytes, u8 } from '../codecs/binary.js';
|
|
3
|
+
import { deriveTestIsmStoragePda } from '../pda.js';
|
|
4
|
+
import { buildInstruction, readonlyAccount, writableAccount, writableSigner, } from './utils.js';
|
|
5
|
+
export var TestIsmInstructionKind;
|
|
6
|
+
(function (TestIsmInstructionKind) {
|
|
7
|
+
TestIsmInstructionKind[TestIsmInstructionKind["Init"] = 0] = "Init";
|
|
8
|
+
TestIsmInstructionKind[TestIsmInstructionKind["SetAccept"] = 1] = "SetAccept";
|
|
9
|
+
})(TestIsmInstructionKind || (TestIsmInstructionKind = {}));
|
|
10
|
+
export function encodeTestIsmProgramInstruction(instruction) {
|
|
11
|
+
switch (instruction.kind) {
|
|
12
|
+
case 'init':
|
|
13
|
+
return u8(TestIsmInstructionKind.Init);
|
|
14
|
+
case 'setAccept':
|
|
15
|
+
return concatBytes(u8(TestIsmInstructionKind.SetAccept), u8(instruction.accept ? 1 : 0));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export function decodeTestIsmProgramInstruction(data) {
|
|
19
|
+
if (data.length < 1)
|
|
20
|
+
return null;
|
|
21
|
+
const cursor = new ByteCursor(data);
|
|
22
|
+
const kind = cursor.readU8();
|
|
23
|
+
switch (kind) {
|
|
24
|
+
case TestIsmInstructionKind.Init:
|
|
25
|
+
return { kind: 'init' };
|
|
26
|
+
case TestIsmInstructionKind.SetAccept:
|
|
27
|
+
return { kind: 'setAccept', accept: cursor.readBool() };
|
|
28
|
+
default:
|
|
29
|
+
if (kind <= TestIsmInstructionKind.SetAccept) {
|
|
30
|
+
throw new Error(`TestIsm instruction kind ${kind} is recognized but decoding is not yet implemented`);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function getInitTestIsmInstruction(programAddress, payer) {
|
|
36
|
+
const { address: storage } = await deriveTestIsmStoragePda(programAddress);
|
|
37
|
+
return buildInstruction(programAddress, [
|
|
38
|
+
readonlyAccount(SYSTEM_PROGRAM_ADDRESS),
|
|
39
|
+
writableSigner(payer),
|
|
40
|
+
writableAccount(storage),
|
|
41
|
+
], encodeTestIsmProgramInstruction({ kind: 'init' }));
|
|
42
|
+
}
|
|
43
|
+
export async function getSetAcceptTestIsmInstruction(programAddress, accept) {
|
|
44
|
+
const { address: storage } = await deriveTestIsmStoragePda(programAddress);
|
|
45
|
+
return buildInstruction(programAddress, [writableAccount(storage)], encodeTestIsmProgramInstruction({ kind: 'setAccept', accept }));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=test-ism.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-ism.js","sourceRoot":"","sources":["../../src/instructions/test-ism.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,mEAAQ,CAAA;IACR,6EAAa,CAAA;AACf,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,QAGjC;AAMD,MAAM,UAAU,+BAA+B,CAC7C,WAAsC;IAEtC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC;QACzB,KAAK,MAAM;YACT,OAAO,EAAE,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QACzC,KAAK,WAAW;YACd,OAAO,WAAW,CAChB,EAAE,CAAC,sBAAsB,CAAC,SAAS,CAAC,EACpC,EAAE,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAC;IACN,CAAC;AACH,CAAC;AAED,MAAM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B,+BAA+B,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAC/D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Address, Instruction, ReadonlyUint8Array, TransactionSigner } from '@solana/kit';
|
|
2
|
+
import { type GasRouterConfig, type H256, type InterchainGasPaymasterType, type RemoteRouterConfig } from '../codecs/shared.js';
|
|
3
|
+
import { type InstructionAccountMeta } from './utils.js';
|
|
4
|
+
export declare enum TokenProgramInstructionKind {
|
|
5
|
+
Init = 0,
|
|
6
|
+
TransferRemote = 1,
|
|
7
|
+
EnrollRemoteRouter = 2,
|
|
8
|
+
EnrollRemoteRouters = 3,
|
|
9
|
+
SetDestinationGasConfigs = 4,
|
|
10
|
+
SetInterchainSecurityModule = 5,
|
|
11
|
+
SetInterchainGasPaymaster = 6,
|
|
12
|
+
TransferOwnership = 7
|
|
13
|
+
}
|
|
14
|
+
export interface TokenInitInstructionData {
|
|
15
|
+
mailbox: Address;
|
|
16
|
+
interchainSecurityModule: Address | null;
|
|
17
|
+
interchainGasPaymaster: {
|
|
18
|
+
programId: Address;
|
|
19
|
+
igp: InterchainGasPaymasterType;
|
|
20
|
+
} | null;
|
|
21
|
+
decimals: number;
|
|
22
|
+
remoteDecimals: number;
|
|
23
|
+
}
|
|
24
|
+
export interface TransferRemoteInstructionData {
|
|
25
|
+
destinationDomain: number;
|
|
26
|
+
recipient: H256;
|
|
27
|
+
amountOrId: bigint;
|
|
28
|
+
}
|
|
29
|
+
export type TokenProgramInstructionData = {
|
|
30
|
+
kind: 'init';
|
|
31
|
+
value: TokenInitInstructionData;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'transferRemote';
|
|
34
|
+
value: TransferRemoteInstructionData;
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'enrollRemoteRouter';
|
|
37
|
+
value: RemoteRouterConfig;
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'enrollRemoteRouters';
|
|
40
|
+
value: RemoteRouterConfig[];
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'setDestinationGasConfigs';
|
|
43
|
+
value: GasRouterConfig[];
|
|
44
|
+
} | {
|
|
45
|
+
kind: 'setInterchainSecurityModule';
|
|
46
|
+
value: Address | null;
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'setInterchainGasPaymaster';
|
|
49
|
+
value: [Address, InterchainGasPaymasterType] | null;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'transferOwnership';
|
|
52
|
+
value: Address | null;
|
|
53
|
+
};
|
|
54
|
+
export declare function encodeTokenProgramInstruction(instruction: TokenProgramInstructionData): ReadonlyUint8Array;
|
|
55
|
+
export declare function decodeTokenProgramInstruction(data: Uint8Array): TokenProgramInstructionData | null;
|
|
56
|
+
export declare function getTokenInitInstruction(programAddress: Address, payer: TransactionSigner, init: TokenInitInstructionData, pluginAccounts: InstructionAccountMeta[]): Promise<Instruction>;
|
|
57
|
+
export declare function getTokenTransferOwnershipInstruction(programAddress: Address, owner: Address, newOwner: Address | null): Promise<Instruction>;
|
|
58
|
+
export declare function getTokenSetInterchainSecurityModuleInstruction(programAddress: Address, owner: Address, newIsm: Address | null): Promise<Instruction>;
|
|
59
|
+
export declare function getTokenSetInterchainGasPaymasterInstruction(programAddress: Address, owner: Address, value: [Address, InterchainGasPaymasterType] | null): Promise<Instruction>;
|
|
60
|
+
export declare function getTokenEnrollRemoteRoutersInstruction(programAddress: Address, owner: Address, routers: RemoteRouterConfig[]): Promise<Instruction>;
|
|
61
|
+
export declare function getTokenSetDestinationGasConfigsInstruction(programAddress: Address, owner: Address, gasConfigs: GasRouterConfig[]): Promise<Instruction>;
|
|
62
|
+
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../src/instructions/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,iB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,OAAO,EACvB,KAAK,EAAE,OAAO,EACd,UAAU,EAAE,eAAe,EAAE,GAC5B,OAAO,CAAC,WAAW,CAAC,CActB"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { getAddressCodec, getNullableCodec, getNullableDecoder, getNullableEncoder, getStructDecoder, getStructEncoder, getU8Codec, } from '@solana/kit';
|
|
2
|
+
import { ByteCursor, concatBytes, option, u256le, u32le, u8, vec, } from '../codecs/binary.js';
|
|
3
|
+
import { decodeInterchainGasPaymasterType, encodeGasRouterConfig, encodeH256, encodeInterchainGasPaymasterType, encodeRemoteRouterConfig, InterchainGasPaymasterTypeKind, } from '../codecs/shared.js';
|
|
4
|
+
import { PROGRAM_INSTRUCTION_DISCRIMINATOR, SYSTEM_PROGRAM_ADDRESS, } from '../constants.js';
|
|
5
|
+
import { deriveHyperlaneTokenPda, deriveMailboxDispatchAuthorityPda, } from '../pda.js';
|
|
6
|
+
import { buildInstruction, readonlyAccount, readonlySignerAddress, writableAccount, writableSigner, writableSignerAddress, } from './utils.js';
|
|
7
|
+
export var TokenProgramInstructionKind;
|
|
8
|
+
(function (TokenProgramInstructionKind) {
|
|
9
|
+
TokenProgramInstructionKind[TokenProgramInstructionKind["Init"] = 0] = "Init";
|
|
10
|
+
TokenProgramInstructionKind[TokenProgramInstructionKind["TransferRemote"] = 1] = "TransferRemote";
|
|
11
|
+
TokenProgramInstructionKind[TokenProgramInstructionKind["EnrollRemoteRouter"] = 2] = "EnrollRemoteRouter";
|
|
12
|
+
TokenProgramInstructionKind[TokenProgramInstructionKind["EnrollRemoteRouters"] = 3] = "EnrollRemoteRouters";
|
|
13
|
+
TokenProgramInstructionKind[TokenProgramInstructionKind["SetDestinationGasConfigs"] = 4] = "SetDestinationGasConfigs";
|
|
14
|
+
TokenProgramInstructionKind[TokenProgramInstructionKind["SetInterchainSecurityModule"] = 5] = "SetInterchainSecurityModule";
|
|
15
|
+
TokenProgramInstructionKind[TokenProgramInstructionKind["SetInterchainGasPaymaster"] = 6] = "SetInterchainGasPaymaster";
|
|
16
|
+
TokenProgramInstructionKind[TokenProgramInstructionKind["TransferOwnership"] = 7] = "TransferOwnership";
|
|
17
|
+
})(TokenProgramInstructionKind || (TokenProgramInstructionKind = {}));
|
|
18
|
+
const ADDRESS_CODEC = getAddressCodec();
|
|
19
|
+
const OPTIONAL_ADDRESS_CODEC = getNullableCodec(ADDRESS_CODEC);
|
|
20
|
+
const U8_CODEC = getU8Codec();
|
|
21
|
+
const IGP_VALUE_CODEC = getStructEncoder([
|
|
22
|
+
['programId', ADDRESS_CODEC],
|
|
23
|
+
['igpKind', U8_CODEC],
|
|
24
|
+
['igpAccount', ADDRESS_CODEC],
|
|
25
|
+
]);
|
|
26
|
+
const IGP_VALUE_DECODER = getStructDecoder([
|
|
27
|
+
['programId', ADDRESS_CODEC],
|
|
28
|
+
['igpKind', U8_CODEC],
|
|
29
|
+
['igpAccount', ADDRESS_CODEC],
|
|
30
|
+
]);
|
|
31
|
+
const OPTIONAL_IGP_ENCODER = getNullableEncoder(IGP_VALUE_CODEC);
|
|
32
|
+
const OPTIONAL_IGP_DECODER = getNullableDecoder(IGP_VALUE_DECODER);
|
|
33
|
+
const TOKEN_INIT_ENCODER = getStructEncoder([
|
|
34
|
+
['mailbox', ADDRESS_CODEC],
|
|
35
|
+
['interchainSecurityModule', OPTIONAL_ADDRESS_CODEC],
|
|
36
|
+
['interchainGasPaymaster', OPTIONAL_IGP_ENCODER],
|
|
37
|
+
['decimals', U8_CODEC],
|
|
38
|
+
['remoteDecimals', U8_CODEC],
|
|
39
|
+
]);
|
|
40
|
+
const TOKEN_INIT_DECODER = getStructDecoder([
|
|
41
|
+
['mailbox', ADDRESS_CODEC],
|
|
42
|
+
['interchainSecurityModule', OPTIONAL_ADDRESS_CODEC],
|
|
43
|
+
['interchainGasPaymaster', OPTIONAL_IGP_DECODER],
|
|
44
|
+
['decimals', U8_CODEC],
|
|
45
|
+
['remoteDecimals', U8_CODEC],
|
|
46
|
+
]);
|
|
47
|
+
export function encodeTokenProgramInstruction(instruction) {
|
|
48
|
+
switch (instruction.kind) {
|
|
49
|
+
case 'init':
|
|
50
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(TokenProgramInstructionKind.Init), encodeTokenInit(instruction.value));
|
|
51
|
+
case 'transferRemote':
|
|
52
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(TokenProgramInstructionKind.TransferRemote), encodeTransferRemote(instruction.value));
|
|
53
|
+
case 'enrollRemoteRouter':
|
|
54
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(TokenProgramInstructionKind.EnrollRemoteRouter), encodeRemoteRouterConfig(instruction.value));
|
|
55
|
+
case 'enrollRemoteRouters':
|
|
56
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(TokenProgramInstructionKind.EnrollRemoteRouters), vec(instruction.value, encodeRemoteRouterConfig));
|
|
57
|
+
case 'setDestinationGasConfigs':
|
|
58
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(TokenProgramInstructionKind.SetDestinationGasConfigs), vec(instruction.value, encodeGasRouterConfig));
|
|
59
|
+
case 'setInterchainSecurityModule':
|
|
60
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(TokenProgramInstructionKind.SetInterchainSecurityModule), option(instruction.value, (addr) => ADDRESS_CODEC.encode(addr)));
|
|
61
|
+
case 'setInterchainGasPaymaster':
|
|
62
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(TokenProgramInstructionKind.SetInterchainGasPaymaster), option(instruction.value, ([programId, igp]) => concatBytes(ADDRESS_CODEC.encode(programId), encodeInterchainGasPaymasterType(igp))));
|
|
63
|
+
case 'transferOwnership':
|
|
64
|
+
return concatBytes(PROGRAM_INSTRUCTION_DISCRIMINATOR, u8(TokenProgramInstructionKind.TransferOwnership), option(instruction.value, (addr) => ADDRESS_CODEC.encode(addr)));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function decodeTokenProgramInstruction(data) {
|
|
68
|
+
if (data.length < 9)
|
|
69
|
+
return null;
|
|
70
|
+
const cursor = new ByteCursor(data);
|
|
71
|
+
const prefix = cursor.readBytes(8);
|
|
72
|
+
if (!prefix.every((v) => v === 1))
|
|
73
|
+
return null;
|
|
74
|
+
const kind = cursor.readU8();
|
|
75
|
+
switch (kind) {
|
|
76
|
+
case TokenProgramInstructionKind.Init:
|
|
77
|
+
return {
|
|
78
|
+
kind: 'init',
|
|
79
|
+
value: decodeTokenInit(cursor.readBytes(cursor.remaining())),
|
|
80
|
+
};
|
|
81
|
+
case TokenProgramInstructionKind.TransferRemote:
|
|
82
|
+
return { kind: 'transferRemote', value: decodeTransferRemote(cursor) };
|
|
83
|
+
case TokenProgramInstructionKind.EnrollRemoteRouter:
|
|
84
|
+
return {
|
|
85
|
+
kind: 'enrollRemoteRouter',
|
|
86
|
+
value: decodeRemoteRouterConfig(cursor),
|
|
87
|
+
};
|
|
88
|
+
case TokenProgramInstructionKind.EnrollRemoteRouters:
|
|
89
|
+
return {
|
|
90
|
+
kind: 'enrollRemoteRouters',
|
|
91
|
+
value: decodeVec(cursor, decodeRemoteRouterConfig),
|
|
92
|
+
};
|
|
93
|
+
case TokenProgramInstructionKind.SetDestinationGasConfigs:
|
|
94
|
+
return {
|
|
95
|
+
kind: 'setDestinationGasConfigs',
|
|
96
|
+
value: decodeVec(cursor, decodeGasRouterConfig),
|
|
97
|
+
};
|
|
98
|
+
case TokenProgramInstructionKind.SetInterchainSecurityModule:
|
|
99
|
+
return {
|
|
100
|
+
kind: 'setInterchainSecurityModule',
|
|
101
|
+
value: decodeOptionAddress(cursor),
|
|
102
|
+
};
|
|
103
|
+
case TokenProgramInstructionKind.SetInterchainGasPaymaster:
|
|
104
|
+
return {
|
|
105
|
+
kind: 'setInterchainGasPaymaster',
|
|
106
|
+
value: decodeOptionIgpTuple(cursor),
|
|
107
|
+
};
|
|
108
|
+
case TokenProgramInstructionKind.TransferOwnership:
|
|
109
|
+
return { kind: 'transferOwnership', value: decodeOptionAddress(cursor) };
|
|
110
|
+
default:
|
|
111
|
+
if (kind <= TokenProgramInstructionKind.TransferOwnership) {
|
|
112
|
+
throw new Error(`Token instruction kind ${kind} is recognized but decoding is not yet implemented`);
|
|
113
|
+
}
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export async function getTokenInitInstruction(programAddress, payer, init, pluginAccounts) {
|
|
118
|
+
const { address: tokenPda } = await deriveHyperlaneTokenPda(programAddress);
|
|
119
|
+
const { address: dispatchAuthority } = await deriveMailboxDispatchAuthorityPda(programAddress);
|
|
120
|
+
return buildInstruction(programAddress, [
|
|
121
|
+
readonlyAccount(SYSTEM_PROGRAM_ADDRESS),
|
|
122
|
+
writableAccount(tokenPda),
|
|
123
|
+
writableAccount(dispatchAuthority),
|
|
124
|
+
writableSigner(payer),
|
|
125
|
+
...pluginAccounts,
|
|
126
|
+
], encodeTokenProgramInstruction({ kind: 'init', value: init }));
|
|
127
|
+
}
|
|
128
|
+
export async function getTokenTransferOwnershipInstruction(programAddress, owner, newOwner) {
|
|
129
|
+
const { address: tokenPda } = await deriveHyperlaneTokenPda(programAddress);
|
|
130
|
+
return buildInstruction(programAddress, [writableAccount(tokenPda), readonlySignerAddress(owner)], encodeTokenProgramInstruction({
|
|
131
|
+
kind: 'transferOwnership',
|
|
132
|
+
value: newOwner,
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
export async function getTokenSetInterchainSecurityModuleInstruction(programAddress, owner, newIsm) {
|
|
136
|
+
const { address: tokenPda } = await deriveHyperlaneTokenPda(programAddress);
|
|
137
|
+
return buildInstruction(programAddress, [writableAccount(tokenPda), readonlySignerAddress(owner)], encodeTokenProgramInstruction({
|
|
138
|
+
kind: 'setInterchainSecurityModule',
|
|
139
|
+
value: newIsm,
|
|
140
|
+
}));
|
|
141
|
+
}
|
|
142
|
+
export async function getTokenSetInterchainGasPaymasterInstruction(programAddress, owner, value) {
|
|
143
|
+
const { address: tokenPda } = await deriveHyperlaneTokenPda(programAddress);
|
|
144
|
+
return buildInstruction(programAddress, [writableAccount(tokenPda), readonlySignerAddress(owner)], encodeTokenProgramInstruction({ kind: 'setInterchainGasPaymaster', value }));
|
|
145
|
+
}
|
|
146
|
+
export async function getTokenEnrollRemoteRoutersInstruction(programAddress, owner, routers) {
|
|
147
|
+
const { address: tokenPda } = await deriveHyperlaneTokenPda(programAddress);
|
|
148
|
+
return buildInstruction(programAddress, [
|
|
149
|
+
readonlyAccount(SYSTEM_PROGRAM_ADDRESS),
|
|
150
|
+
writableAccount(tokenPda),
|
|
151
|
+
writableSignerAddress(owner),
|
|
152
|
+
], encodeTokenProgramInstruction({
|
|
153
|
+
kind: 'enrollRemoteRouters',
|
|
154
|
+
value: routers,
|
|
155
|
+
}));
|
|
156
|
+
}
|
|
157
|
+
export async function getTokenSetDestinationGasConfigsInstruction(programAddress, owner, gasConfigs) {
|
|
158
|
+
const { address: tokenPda } = await deriveHyperlaneTokenPda(programAddress);
|
|
159
|
+
return buildInstruction(programAddress, [
|
|
160
|
+
readonlyAccount(SYSTEM_PROGRAM_ADDRESS),
|
|
161
|
+
writableAccount(tokenPda),
|
|
162
|
+
writableSignerAddress(owner),
|
|
163
|
+
], encodeTokenProgramInstruction({
|
|
164
|
+
kind: 'setDestinationGasConfigs',
|
|
165
|
+
value: gasConfigs,
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
function encodeTokenInit(value) {
|
|
169
|
+
const normalized = {
|
|
170
|
+
mailbox: value.mailbox,
|
|
171
|
+
interchainSecurityModule: value.interchainSecurityModule,
|
|
172
|
+
interchainGasPaymaster: value.interchainGasPaymaster
|
|
173
|
+
? {
|
|
174
|
+
programId: value.interchainGasPaymaster.programId,
|
|
175
|
+
igpKind: value.interchainGasPaymaster.igp.kind,
|
|
176
|
+
igpAccount: value.interchainGasPaymaster.igp.account,
|
|
177
|
+
}
|
|
178
|
+
: null,
|
|
179
|
+
decimals: value.decimals,
|
|
180
|
+
remoteDecimals: value.remoteDecimals,
|
|
181
|
+
};
|
|
182
|
+
return Uint8Array.from(TOKEN_INIT_ENCODER.encode(normalized));
|
|
183
|
+
}
|
|
184
|
+
function validateIgpKind(value) {
|
|
185
|
+
if (value !== InterchainGasPaymasterTypeKind.Igp &&
|
|
186
|
+
value !== InterchainGasPaymasterTypeKind.OverheadIgp) {
|
|
187
|
+
throw new Error(`Unknown InterchainGasPaymasterTypeKind: ${value}`);
|
|
188
|
+
}
|
|
189
|
+
return value;
|
|
190
|
+
}
|
|
191
|
+
function decodeTokenInit(data) {
|
|
192
|
+
const decoded = TOKEN_INIT_DECODER.decode(data);
|
|
193
|
+
const igp = decoded.interchainGasPaymaster;
|
|
194
|
+
return {
|
|
195
|
+
mailbox: decoded.mailbox,
|
|
196
|
+
interchainSecurityModule: decoded.interchainSecurityModule,
|
|
197
|
+
interchainGasPaymaster: igp
|
|
198
|
+
? {
|
|
199
|
+
programId: igp.programId,
|
|
200
|
+
igp: {
|
|
201
|
+
kind: validateIgpKind(igp.igpKind),
|
|
202
|
+
account: igp.igpAccount,
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
: null,
|
|
206
|
+
decimals: decoded.decimals,
|
|
207
|
+
remoteDecimals: decoded.remoteDecimals,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function encodeTransferRemote(value) {
|
|
211
|
+
return concatBytes(u32le(value.destinationDomain), encodeH256(value.recipient), u256le(value.amountOrId));
|
|
212
|
+
}
|
|
213
|
+
function decodeTransferRemote(cursor) {
|
|
214
|
+
return {
|
|
215
|
+
destinationDomain: cursor.readU32LE(),
|
|
216
|
+
recipient: cursor.readBytes(32),
|
|
217
|
+
amountOrId: cursor.readU256LE(),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
function decodeRemoteRouterConfig(cursor) {
|
|
221
|
+
const domain = cursor.readU32LE();
|
|
222
|
+
const hasRouter = cursor.readU8() === 1;
|
|
223
|
+
return {
|
|
224
|
+
domain,
|
|
225
|
+
router: hasRouter ? cursor.readBytes(32) : null,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function decodeGasRouterConfig(cursor) {
|
|
229
|
+
const domain = cursor.readU32LE();
|
|
230
|
+
const hasGas = cursor.readU8() === 1;
|
|
231
|
+
return {
|
|
232
|
+
domain,
|
|
233
|
+
gas: hasGas ? cursor.readU64LE() : null,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function decodeOptionAddress(cursor) {
|
|
237
|
+
const hasValue = cursor.readU8() === 1;
|
|
238
|
+
return hasValue ? ADDRESS_CODEC.decode(cursor.readBytes(32)) : null;
|
|
239
|
+
}
|
|
240
|
+
function decodeOptionIgpTuple(cursor) {
|
|
241
|
+
const hasValue = cursor.readU8() === 1;
|
|
242
|
+
if (!hasValue)
|
|
243
|
+
return null;
|
|
244
|
+
return [
|
|
245
|
+
ADDRESS_CODEC.decode(cursor.readBytes(32)),
|
|
246
|
+
decodeInterchainGasPaymasterType(cursor),
|
|
247
|
+
];
|
|
248
|
+
}
|
|
249
|
+
function decodeVec(cursor, decoder) {
|
|
250
|
+
const length = cursor.readU32LE();
|
|
251
|
+
const out = [];
|
|
252
|
+
for (let i = 0; i < length; i += 1) {
|
|
253
|
+
out.push(decoder(cursor));
|
|
254
|
+
}
|
|
255
|
+
return out;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../src/instructions/token.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,GACX,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,UAAU,EACV,WAAW,EACX,MAAM,EACN,MAAM,EACN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} from '@solana/kit';
|
|
2
|
+
export type InstructionAccountMeta = AccountMeta | AccountSignerMeta;
|
|
3
|
+
export declare function readonlyAccount(address: Address): InstructionAccountMeta;
|
|
4
|
+
export declare function writableAccount(address: Address): InstructionAccountMeta;
|
|
5
|
+
export declare function readonlySigner(signer: TransactionSigner): InstructionAccountMeta;
|
|
6
|
+
/**
|
|
7
|
+
* Marks an address as a required readonly signer without embedding a keypair.
|
|
8
|
+
* Use this for update instructions where signing is deferred to the caller.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readonlySignerAddress(address: Address): InstructionAccountMeta;
|
|
11
|
+
/**
|
|
12
|
+
* Marks an address as a required writable signer without embedding a keypair.
|
|
13
|
+
* Use this when the account must both sign and be mutated, but the keypair is
|
|
14
|
+
* managed by the caller (e.g. the transaction payer for a SOL transfer).
|
|
15
|
+
*/
|
|
16
|
+
export declare function writableSignerAddress(address: Address): InstructionAccountMeta;
|
|
17
|
+
export declare function writableSigner(signer: TransactionSigner): InstructionAccountMeta;
|
|
18
|
+
export declare function buildInstruction(programAddress: Address, accounts: InstructionAccountMeta[], data: ReadonlyUint8Array): Instruction;
|
|
19
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/instructions/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,sBAAsB,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAErE,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,sBAAsB,CAExE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,sBAAsB,CAExE;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,iBAAiB,GACxB,sBAAsB,CAExB;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,GACf,sBAAsB,CAExB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,GACf,sBAAsB,CAExB;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,iBAAiB,GACxB,sBAAsB,CAExB;AAED,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,OAAO,EACvB,QAAQ,EAAE,sBAAsB,EAAE,EAClC,IAAI,EAAE,kBAAkB,GACvB,WAAW,CAMb"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AccountRole } from '@solana/kit';
|
|
2
|
+
export function readonlyAccount(address) {
|
|
3
|
+
return { address, role: AccountRole.READONLY };
|
|
4
|
+
}
|
|
5
|
+
export function writableAccount(address) {
|
|
6
|
+
return { address, role: AccountRole.WRITABLE };
|
|
7
|
+
}
|
|
8
|
+
export function readonlySigner(signer) {
|
|
9
|
+
return { address: signer.address, role: AccountRole.READONLY_SIGNER, signer };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Marks an address as a required readonly signer without embedding a keypair.
|
|
13
|
+
* Use this for update instructions where signing is deferred to the caller.
|
|
14
|
+
*/
|
|
15
|
+
export function readonlySignerAddress(address) {
|
|
16
|
+
return { address, role: AccountRole.READONLY_SIGNER };
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Marks an address as a required writable signer without embedding a keypair.
|
|
20
|
+
* Use this when the account must both sign and be mutated, but the keypair is
|
|
21
|
+
* managed by the caller (e.g. the transaction payer for a SOL transfer).
|
|
22
|
+
*/
|
|
23
|
+
export function writableSignerAddress(address) {
|
|
24
|
+
return { address, role: AccountRole.WRITABLE_SIGNER };
|
|
25
|
+
}
|
|
26
|
+
export function writableSigner(signer) {
|
|
27
|
+
return { address: signer.address, role: AccountRole.WRITABLE_SIGNER, signer };
|
|
28
|
+
}
|
|
29
|
+
export function buildInstruction(programAddress, accounts, data) {
|
|
30
|
+
return {
|
|
31
|
+
programAddress,
|
|
32
|
+
accounts,
|
|
33
|
+
data,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/instructions/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAY1C,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,MAAyB;IAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;AAChF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAgB;IAEhB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,eAAe,EAAE,CAAC;AACxD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACnC,OAAgB;IAEhB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,eAAe,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,cAAc,CAC5B,MAAyB;IAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,cAAuB,EACvB,QAAkC,EAClC,IAAwB;IAExB,OAAO;QACL,cAAc;QACd,QAAQ;QACR,IAAI;KACL,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Rpc, type SolanaRpcApi } from '@solana/kit';
|
|
2
|
+
import type { ArtifactReader, ArtifactWriter } from '@hyperlane-xyz/provider-sdk/artifact';
|
|
3
|
+
import type { DeployedRawIsmArtifact, IRawIsmArtifactManager, RawIsmArtifactConfigs } from '@hyperlane-xyz/provider-sdk/ism';
|
|
4
|
+
import type { SvmSigner } from '../clients/signer.js';
|
|
5
|
+
import type { SvmDeployedIsm } from '../types.js';
|
|
6
|
+
export declare class SvmIsmArtifactManager implements IRawIsmArtifactManager {
|
|
7
|
+
private readonly rpc;
|
|
8
|
+
constructor(rpc: Rpc<SolanaRpcApi>);
|
|
9
|
+
readIsm(address: string): Promise<DeployedRawIsmArtifact>;
|
|
10
|
+
createReader<T extends keyof RawIsmArtifactConfigs>(type: T): ArtifactReader<RawIsmArtifactConfigs[T], SvmDeployedIsm>;
|
|
11
|
+
createWriter<T extends keyof RawIsmArtifactConfigs>(type: T, signer: SvmSigner): ArtifactWriter<RawIsmArtifactConfigs[T], SvmDeployedIsm>;
|
|
12
|
+
private altVmToTypeKey;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=ism-artifact-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ism-artifact-manager.d.ts","sourceRoot":"","sources":["../../src/ism/ism-artifact-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,GAAG,EACR,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACf,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AASlD,qBAAa,qBAAsB,YAAW,sBAAsB;IACtD,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,GAAG,CAAC,YAAY,CAAC;IAE7C,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAQ/D,YAAY,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAChD,IAAI,EAAE,CAAC,GACN,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC;IAe3D,YAAY,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAChD,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,SAAS,GAChB,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,cAAc,CAAC;IAgB3D,OAAO,CAAC,cAAc;CAUvB"}
|