@across-protocol/contracts 6.0.0-beta.2 → 6.0.0-beta.3
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/README.md +138 -34
- package/contracts/chain-adapters/Solana_Adapter.sol +4 -7
- package/contracts/handlers/HyperliquidDepositHandler.sol +2 -2
- package/contracts/interfaces/SpokePoolPeripheryInterface.sol +16 -4
- package/contracts/libraries/HyperCoreLib.sol +113 -20
- package/contracts/libraries/PeripherySigningLib.sol +56 -0
- package/contracts/periphery/SpokePoolPeriphery.sol +58 -10
- package/dist/broadcast/deployed-addresses.json +19 -0
- package/dist/evm/artifacts/Constants.sol/Constants.json +1 -1
- package/dist/evm/artifacts/DeploymentUtils.sol/DeploymentUtils.json +1 -1
- package/dist/evm/artifacts/DstOFTHandler.sol/DstOFTHandler.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockAddressWhitelist.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockFinder.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockIdentifierWhitelist.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockLpTokenFactory.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockOptimisticOracle.json +1 -1
- package/dist/evm/artifacts/HubPoolTestBase.sol/MockStore.json +1 -1
- package/dist/evm/artifacts/HyperCoreFlowExecutor.sol/HyperCoreFlowExecutor.json +1 -1
- package/dist/evm/artifacts/HyperCoreLib.sol/HyperCoreLib.json +1 -1
- package/dist/evm/artifacts/HyperliquidDepositHandler.sol/HyperliquidDepositHandler.json +1 -1
- package/dist/evm/artifacts/PeripherySigningLib.sol/PeripherySigningLib.json +1 -1
- package/dist/evm/artifacts/Solana_Adapter.sol/Solana_Adapter.json +1 -1
- package/dist/evm/artifacts/SpokePoolPeriphery.sol/SpokePoolPeriphery.json +1 -1
- package/dist/evm/artifacts/SpokePoolPeriphery.sol/SwapProxy.json +1 -1
- package/dist/evm/artifacts/SponsoredCCTPDstPeriphery.sol/SponsoredCCTPDstPeriphery.json +1 -1
- package/dist/evm/artifacts/SponsoredCCTPSrcPeriphery.sol/SponsoredCCTPSrcPeriphery.json +1 -1
- package/dist/evm/artifacts/SponsoredOFTSrcPeriphery.sol/SponsoredOFTSrcPeriphery.json +1 -1
- package/dist/evm/artifacts/SwapHandler.sol/SwapHandler.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SpokePoolPeriphery.json +1 -1
- package/dist/evm/artifacts/Tron_SpokePoolPeriphery.sol/Tron_SwapProxy.json +1 -1
- package/dist/src/consts.js +1 -0
- package/dist/src/svm/assets/idl/sponsored_cctp_src_periphery.json +41 -24
- package/dist/src/svm/assets/idl/svm_spoke.json +1001 -2171
- package/dist/src/svm/assets/sponsored_cctp_src_periphery.d.ts +41 -24
- package/dist/src/svm/assets/svm_spoke.d.ts +996 -2166
- package/dist/src/svm/assets/token_messenger_minter_v2.d.ts +18 -18
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/accounts/index.d.ts +0 -1
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/accounts/index.js +0 -1
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/errors/sponsoredCctpSrcPeriphery.d.ts +24 -12
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/errors/sponsoredCctpSrcPeriphery.js +30 -12
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/programs/sponsoredCctpSrcPeriphery.d.ts +4 -5
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/programs/sponsoredCctpSrcPeriphery.js +4 -8
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/types/index.d.ts +1 -0
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/types/index.js +1 -0
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/types/messageSent.d.ts +21 -0
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/types/messageSent.js +30 -0
- package/dist/src/svm/clients/SvmSpoke/accounts/fillStatusAccount.d.ts +2 -2
- package/dist/src/svm/clients/SvmSpoke/accounts/fillStatusAccount.js +2 -2
- package/dist/src/svm/clients/SvmSpoke/accounts/index.d.ts +0 -3
- package/dist/src/svm/clients/SvmSpoke/accounts/index.js +0 -3
- package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.d.ts +94 -22
- package/dist/src/svm/clients/SvmSpoke/errors/svmSpoke.js +133 -24
- package/dist/src/svm/clients/SvmSpoke/instructions/adapterExecuteAcrossV5.d.ts +75 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/adapterExecuteAcrossV5.js +144 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/closeFillPda.d.ts +16 -8
- package/dist/src/svm/clients/SvmSpoke/instructions/closeFillPda.js +3 -3
- package/dist/src/svm/clients/SvmSpoke/instructions/index.d.ts +2 -7
- package/dist/src/svm/clients/SvmSpoke/instructions/index.js +2 -7
- package/dist/src/svm/clients/SvmSpoke/instructions/withdrawV5FillPayer.d.ts +58 -0
- package/dist/src/svm/clients/SvmSpoke/instructions/withdrawV5FillPayer.js +134 -0
- package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.d.ts +29 -47
- package/dist/src/svm/clients/SvmSpoke/programs/svmSpoke.js +29 -61
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositInput.d.ts +25 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositInput.js +33 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositJitParams.d.ts +18 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositJitParams.js +30 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositParams.d.ts +43 -0
- package/dist/src/svm/clients/SvmSpoke/types/acrossDepositParams.js +48 -0
- package/dist/src/svm/clients/SvmSpoke/types/index.d.ts +9 -1
- package/dist/src/svm/clients/SvmSpoke/types/index.js +9 -1
- package/dist/src/svm/clients/SvmSpoke/types/v5AdapterInput.d.ts +39 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5AdapterInput.js +59 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5DepositModificationRules.d.ts +17 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5DepositModificationRules.js +30 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillFloatWithdrawn.d.ts +19 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillFloatWithdrawn.js +28 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillInput.d.ts +25 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillInput.js +30 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5FillJit.d.ts +22 -0
- package/dist/src/svm/clients/SvmSpoke/types/{slowFill.js → v5FillJit.js} +11 -11
- package/dist/src/svm/clients/SvmSpoke/types/v5InputAmountMode.d.ts +29 -0
- package/dist/src/svm/clients/SvmSpoke/types/v5InputAmountMode.js +38 -0
- package/dist/src/svm/web3-v1/cctpV2Helpers.d.ts +83 -97
- package/dist/src/svm/web3-v1/cctpV2Helpers.js +1 -1
- package/dist/src/svm/web3-v1/coders.d.ts +1 -1
- package/dist/src/svm/web3-v1/coders.js +4 -4
- package/dist/src/svm/web3-v1/conversionUtils.d.ts +1 -1
- package/dist/src/svm/web3-v1/conversionUtils.js +3 -3
- package/dist/src/svm/web3-v1/helpers.d.ts +1 -114
- package/dist/src/svm/web3-v1/helpers.js +1 -179
- package/dist/src/svm/web3-v1/instructionParamsUtils.d.ts +11 -26
- package/dist/src/svm/web3-v1/instructionParamsUtils.js +5 -90
- package/dist/src/svm/web3-v1/programConnectors.d.ts +1 -1
- package/dist/src/svm/web3-v1/programConnectors.js +2 -2
- package/dist/src/svm/web3-v1/relayHashUtils.d.ts +2 -6
- package/dist/src/svm/web3-v1/relayHashUtils.js +5 -66
- package/dist/src/svm/web3-v1/solanaProgramUtils.d.ts +1 -1
- package/dist/src/svm/web3-v1/solanaProgramUtils.js +7 -7
- package/dist/src/svm/web3-v1/transactionUtils.js +3 -3
- package/dist/src/svm/web3-v2/solanaProgramUtils.d.ts +1 -1
- package/dist/src/svm/web3-v2/solanaProgramUtils.js +4 -4
- package/dist/src/types/svm.d.ts +1 -46
- package/package.json +17 -6
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/accounts/messageSent.d.ts +0 -30
- package/dist/src/svm/clients/SponsoredCctpSrcPeriphery/accounts/messageSent.js +0 -66
- package/dist/src/svm/clients/SvmSpoke/accounts/executeSlowRelayLeafParams.d.ts +0 -31
- package/dist/src/svm/clients/SvmSpoke/accounts/executeSlowRelayLeafParams.js +0 -70
- package/dist/src/svm/clients/SvmSpoke/accounts/fillRelayParams.d.ts +0 -31
- package/dist/src/svm/clients/SvmSpoke/accounts/fillRelayParams.js +0 -67
- package/dist/src/svm/clients/SvmSpoke/accounts/requestSlowFillParams.d.ts +0 -27
- package/dist/src/svm/clients/SvmSpoke/accounts/requestSlowFillParams.js +0 -66
- package/dist/src/svm/clients/SvmSpoke/instructions/deposit.d.ts +0 -131
- package/dist/src/svm/clients/SvmSpoke/instructions/deposit.js +0 -241
- package/dist/src/svm/clients/SvmSpoke/instructions/depositNow.d.ts +0 -127
- package/dist/src/svm/clients/SvmSpoke/instructions/depositNow.js +0 -239
- package/dist/src/svm/clients/SvmSpoke/instructions/executeSlowRelayLeaf.d.ts +0 -104
- package/dist/src/svm/clients/SvmSpoke/instructions/executeSlowRelayLeaf.js +0 -259
- package/dist/src/svm/clients/SvmSpoke/instructions/fillRelay.d.ts +0 -108
- package/dist/src/svm/clients/SvmSpoke/instructions/fillRelay.js +0 -265
- package/dist/src/svm/clients/SvmSpoke/instructions/getUnsafeDepositId.d.ts +0 -39
- package/dist/src/svm/clients/SvmSpoke/instructions/getUnsafeDepositId.js +0 -63
- package/dist/src/svm/clients/SvmSpoke/instructions/requestSlowFill.d.ts +0 -76
- package/dist/src/svm/clients/SvmSpoke/instructions/requestSlowFill.js +0 -187
- package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDeposit.d.ts +0 -135
- package/dist/src/svm/clients/SvmSpoke/instructions/unsafeDeposit.js +0 -243
- package/dist/src/svm/clients/SvmSpoke/types/slowFill.d.ts +0 -22
- package/dist/target/types/svm_spoke.d.ts +0 -5106
- package/dist/target/types/svm_spoke.js +0 -2
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.getDepositSeedHash = getDepositSeedHash;
|
|
5
|
-
exports.getDepositPda = getDepositPda;
|
|
6
|
-
exports.getDepositNowSeedHash = getDepositNowSeedHash;
|
|
7
|
-
exports.getDepositNowPda = getDepositNowPda;
|
|
8
|
-
exports.getFillRelayDelegateSeedHash = getFillRelayDelegateSeedHash;
|
|
9
|
-
exports.getFillRelayDelegatePda = getFillRelayDelegatePda;
|
|
3
|
+
exports.isSolanaDevnet = exports.getSolanaChainId = void 0;
|
|
10
4
|
const bignumber_1 = require("@ethersproject/bignumber");
|
|
11
5
|
const ethers_1 = require("ethers");
|
|
12
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
13
|
-
const borsh_1 = require("borsh");
|
|
14
|
-
const utils_1 = require("ethers/lib/utils");
|
|
15
6
|
/**
|
|
16
7
|
* Returns the chainId for a given solana cluster.
|
|
17
8
|
*/
|
|
@@ -32,172 +23,3 @@ const isSolanaDevnet = (provider) => {
|
|
|
32
23
|
throw new Error(`Unsupported solanaCluster endpoint: ${solanaRpcEndpoint}`);
|
|
33
24
|
};
|
|
34
25
|
exports.isSolanaDevnet = isSolanaDevnet;
|
|
35
|
-
/**
|
|
36
|
-
* Generic helper: serialize + keccak256 → 32‑byte Uint8Array
|
|
37
|
-
*/
|
|
38
|
-
function deriveSeedHash(schema, seedObj) {
|
|
39
|
-
const serialized = (0, borsh_1.serialize)(schema, seedObj);
|
|
40
|
-
const hashHex = (0, utils_1.keccak256)(serialized);
|
|
41
|
-
return Buffer.from(hashHex.slice(2), "hex");
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* “Absolute‐deadline” deposit data
|
|
45
|
-
*/
|
|
46
|
-
class DepositSeedData {
|
|
47
|
-
constructor(fields) {
|
|
48
|
-
Object.assign(this, fields);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.DepositSeedData = DepositSeedData;
|
|
52
|
-
const depositSeedSchema = new Map([
|
|
53
|
-
[
|
|
54
|
-
DepositSeedData,
|
|
55
|
-
{
|
|
56
|
-
kind: "struct",
|
|
57
|
-
fields: [
|
|
58
|
-
["depositor", [32]],
|
|
59
|
-
["recipient", [32]],
|
|
60
|
-
["inputToken", [32]],
|
|
61
|
-
["outputToken", [32]],
|
|
62
|
-
["inputAmount", "u64"],
|
|
63
|
-
["outputAmount", [32]],
|
|
64
|
-
["destinationChainId", "u64"],
|
|
65
|
-
["exclusiveRelayer", [32]],
|
|
66
|
-
["quoteTimestamp", "u32"],
|
|
67
|
-
["fillDeadline", "u32"],
|
|
68
|
-
["exclusivityParameter", "u32"],
|
|
69
|
-
["message", ["u8"]],
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
]);
|
|
74
|
-
/**
|
|
75
|
-
* Hash for the standard `deposit(...)` flow
|
|
76
|
-
*/
|
|
77
|
-
function getDepositSeedHash(depositData) {
|
|
78
|
-
const ds = new DepositSeedData({
|
|
79
|
-
depositor: depositData.depositor.toBuffer(),
|
|
80
|
-
recipient: depositData.recipient.toBuffer(),
|
|
81
|
-
inputToken: depositData.inputToken.toBuffer(),
|
|
82
|
-
outputToken: depositData.outputToken.toBuffer(),
|
|
83
|
-
inputAmount: depositData.inputAmount,
|
|
84
|
-
outputAmount: depositData.outputAmount,
|
|
85
|
-
destinationChainId: depositData.destinationChainId,
|
|
86
|
-
exclusiveRelayer: depositData.exclusiveRelayer.toBuffer(),
|
|
87
|
-
quoteTimestamp: depositData.quoteTimestamp,
|
|
88
|
-
fillDeadline: depositData.fillDeadline,
|
|
89
|
-
exclusivityParameter: depositData.exclusivityParameter,
|
|
90
|
-
message: depositData.message,
|
|
91
|
-
});
|
|
92
|
-
return deriveSeedHash(depositSeedSchema, ds);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Returns the delegate PDA for `deposit(...)`
|
|
96
|
-
*/
|
|
97
|
-
function getDepositPda(depositData, programId) {
|
|
98
|
-
const seedHash = getDepositSeedHash(depositData);
|
|
99
|
-
const [pda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("delegate"), seedHash], programId);
|
|
100
|
-
return pda;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* “Offset/now” deposit data
|
|
104
|
-
*/
|
|
105
|
-
class DepositNowSeedData {
|
|
106
|
-
constructor(fields) {
|
|
107
|
-
Object.assign(this, fields);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.DepositNowSeedData = DepositNowSeedData;
|
|
111
|
-
const depositNowSeedSchema = new Map([
|
|
112
|
-
[
|
|
113
|
-
DepositNowSeedData,
|
|
114
|
-
{
|
|
115
|
-
kind: "struct",
|
|
116
|
-
fields: [
|
|
117
|
-
["depositor", [32]],
|
|
118
|
-
["recipient", [32]],
|
|
119
|
-
["inputToken", [32]],
|
|
120
|
-
["outputToken", [32]],
|
|
121
|
-
["inputAmount", "u64"],
|
|
122
|
-
["outputAmount", [32]],
|
|
123
|
-
["destinationChainId", "u64"],
|
|
124
|
-
["exclusiveRelayer", [32]],
|
|
125
|
-
["fillDeadlineOffset", "u32"],
|
|
126
|
-
["exclusivityPeriod", "u32"],
|
|
127
|
-
["message", ["u8"]],
|
|
128
|
-
],
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
]);
|
|
132
|
-
/**
|
|
133
|
-
* Hash for the `deposit_now(...)` flow
|
|
134
|
-
*/
|
|
135
|
-
function getDepositNowSeedHash(depositData) {
|
|
136
|
-
const dns = new DepositNowSeedData({
|
|
137
|
-
depositor: depositData.depositor.toBuffer(),
|
|
138
|
-
recipient: depositData.recipient.toBuffer(),
|
|
139
|
-
inputToken: depositData.inputToken.toBuffer(),
|
|
140
|
-
outputToken: depositData.outputToken.toBuffer(),
|
|
141
|
-
inputAmount: depositData.inputAmount,
|
|
142
|
-
outputAmount: depositData.outputAmount,
|
|
143
|
-
destinationChainId: depositData.destinationChainId,
|
|
144
|
-
exclusiveRelayer: depositData.exclusiveRelayer.toBuffer(),
|
|
145
|
-
fillDeadlineOffset: depositData.fillDeadlineOffset,
|
|
146
|
-
exclusivityPeriod: depositData.exclusivityPeriod,
|
|
147
|
-
message: depositData.message,
|
|
148
|
-
});
|
|
149
|
-
return deriveSeedHash(depositNowSeedSchema, dns);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Returns the delegate PDA for `deposit_now(...)`
|
|
153
|
-
*/
|
|
154
|
-
function getDepositNowPda(depositData, programId) {
|
|
155
|
-
const seedHash = getDepositNowSeedHash(depositData);
|
|
156
|
-
const [pda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("delegate"), seedHash], programId);
|
|
157
|
-
return pda;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Fill Delegate Seed Data
|
|
161
|
-
*/
|
|
162
|
-
class FillDelegateSeedData {
|
|
163
|
-
constructor(fields) {
|
|
164
|
-
this.relayHash = fields.relayHash;
|
|
165
|
-
this.repaymentChainId = fields.repaymentChainId;
|
|
166
|
-
this.repaymentAddress = fields.repaymentAddress;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Borsh schema for FillDelegateSeedData
|
|
171
|
-
*/
|
|
172
|
-
const fillDelegateSeedSchema = new Map([
|
|
173
|
-
[
|
|
174
|
-
FillDelegateSeedData,
|
|
175
|
-
{
|
|
176
|
-
kind: "struct",
|
|
177
|
-
fields: [
|
|
178
|
-
["relayHash", [32]],
|
|
179
|
-
["repaymentChainId", "u64"],
|
|
180
|
-
["repaymentAddress", [32]],
|
|
181
|
-
],
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
]);
|
|
185
|
-
/**
|
|
186
|
-
* Returns the fill delegate seed hash.
|
|
187
|
-
*/
|
|
188
|
-
function getFillRelayDelegateSeedHash(relayHash, repaymentChainId, repaymentAddress) {
|
|
189
|
-
const ds = new FillDelegateSeedData({
|
|
190
|
-
relayHash,
|
|
191
|
-
repaymentChainId,
|
|
192
|
-
repaymentAddress: repaymentAddress.toBuffer(),
|
|
193
|
-
});
|
|
194
|
-
return deriveSeedHash(fillDelegateSeedSchema, ds);
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Returns the fill delegate PDA.
|
|
198
|
-
*/
|
|
199
|
-
function getFillRelayDelegatePda(relayHash, repaymentChainId, repaymentAddress, programId) {
|
|
200
|
-
const seedHash = getFillRelayDelegateSeedHash(relayHash, repaymentChainId, repaymentAddress);
|
|
201
|
-
const [pda] = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("delegate"), seedHash], programId);
|
|
202
|
-
return { seedHash, pda };
|
|
203
|
-
}
|
|
@@ -1,31 +1,16 @@
|
|
|
1
|
-
import { Keypair,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Keypair, PublicKey } from "@solana/web3.js";
|
|
2
|
+
import { Idl, Program } from "@anchor-lang/core";
|
|
3
|
+
import { RelayerRefundLeafSolana } from "../../types/svm";
|
|
4
|
+
import { SvmSpokeAnchor } from "../assets";
|
|
5
|
+
type InstructionParamsProgram = Pick<Program<SvmSpokeAnchor>, "programId" | "provider" | "methods"> & {
|
|
6
|
+
idl: Idl;
|
|
7
|
+
};
|
|
5
8
|
/**
|
|
6
|
-
* Loads execute relayer refund leaf parameters.
|
|
9
|
+
* Loads execute relayer refund leaf parameters and waits for the writes to be confirmed.
|
|
7
10
|
*/
|
|
8
|
-
export declare function loadExecuteRelayerRefundLeafParams(program:
|
|
11
|
+
export declare function loadExecuteRelayerRefundLeafParams(program: InstructionParamsProgram, caller: PublicKey, rootBundleId: number, relayerRefundLeaf: RelayerRefundLeafSolana, proof: number[][]): Promise<PublicKey>;
|
|
9
12
|
/**
|
|
10
13
|
* Closes the instruction parameters account.
|
|
11
14
|
*/
|
|
12
|
-
export declare function closeInstructionParams(program:
|
|
13
|
-
|
|
14
|
-
* Creates instructions to load fill relay parameters.
|
|
15
|
-
*/
|
|
16
|
-
export declare function createFillRelayParamsInstructions(program: Program<SvmSpoke>, signer: PublicKey, relayData: RelayData, repaymentChainId: BN, repaymentAddress: PublicKey): Promise<{
|
|
17
|
-
loadInstructions: TransactionInstruction[];
|
|
18
|
-
closeInstruction: TransactionInstruction;
|
|
19
|
-
}>;
|
|
20
|
-
/**
|
|
21
|
-
* Loads fill relay parameters.
|
|
22
|
-
*/
|
|
23
|
-
export declare function loadFillRelayParams(program: Program<SvmSpoke>, signer: Keypair, relayData: RelayData, repaymentChainId: BN, repaymentAddress: PublicKey): Promise<void>;
|
|
24
|
-
/**
|
|
25
|
-
* Loads request slow fill parameters.
|
|
26
|
-
*/
|
|
27
|
-
export declare function loadRequestSlowFillParams(program: Program<SvmSpoke>, signer: Keypair, relayData: RelayData): Promise<TransactionInstruction[]>;
|
|
28
|
-
/**
|
|
29
|
-
* Loads execute slow relay leaf parameters.
|
|
30
|
-
*/
|
|
31
|
-
export declare function loadExecuteSlowRelayLeafParams(program: Program<SvmSpoke>, signer: Keypair, slowFillLeaf: SlowFillLeaf, rootBundleId: number, proof: number[][]): Promise<TransactionInstruction[]>;
|
|
15
|
+
export declare function closeInstructionParams(program: InstructionParamsProgram, signer: Keypair): Promise<void>;
|
|
16
|
+
export {};
|
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadExecuteRelayerRefundLeafParams = loadExecuteRelayerRefundLeafParams;
|
|
4
4
|
exports.closeInstructionParams = closeInstructionParams;
|
|
5
|
-
exports.createFillRelayParamsInstructions = createFillRelayParamsInstructions;
|
|
6
|
-
exports.loadFillRelayParams = loadFillRelayParams;
|
|
7
|
-
exports.loadRequestSlowFillParams = loadRequestSlowFillParams;
|
|
8
|
-
exports.loadExecuteSlowRelayLeafParams = loadExecuteSlowRelayLeafParams;
|
|
9
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
10
6
|
const coders_1 = require("./coders");
|
|
11
7
|
/**
|
|
12
|
-
* Loads execute relayer refund leaf parameters.
|
|
8
|
+
* Loads execute relayer refund leaf parameters and waits for the writes to be confirmed.
|
|
13
9
|
*/
|
|
14
10
|
async function loadExecuteRelayerRefundLeafParams(program, caller, rootBundleId, relayerRefundLeaf, proof) {
|
|
15
11
|
const maxInstructionParamsFragment = 900; // Should not exceed message size limit when writing to the data account.
|
|
@@ -27,7 +23,10 @@ async function loadExecuteRelayerRefundLeafParams(program, caller, rootBundleId,
|
|
|
27
23
|
await program.methods.initializeInstructionParams(instructionParamsBytes.length).rpc();
|
|
28
24
|
for (let i = 0; i < instructionParamsBytes.length; i += maxInstructionParamsFragment) {
|
|
29
25
|
const fragment = instructionParamsBytes.slice(i, i + maxInstructionParamsFragment);
|
|
30
|
-
|
|
26
|
+
// Preflight must see the preceding initialization; wait for confirmed visibility before the caller executes.
|
|
27
|
+
await program.methods
|
|
28
|
+
.writeInstructionParamsFragment(i, fragment)
|
|
29
|
+
.rpc({ preflightCommitment: "processed", commitment: "confirmed" });
|
|
31
30
|
}
|
|
32
31
|
return instructionParams;
|
|
33
32
|
}
|
|
@@ -42,87 +41,3 @@ async function closeInstructionParams(program, signer) {
|
|
|
42
41
|
await (0, web3_js_1.sendAndConfirmTransaction)(program.provider.connection, new web3_js_1.Transaction().add(closeIx), [signer]);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Creates instructions to load fill relay parameters.
|
|
47
|
-
*/
|
|
48
|
-
async function createFillRelayParamsInstructions(program, signer, relayData, repaymentChainId, repaymentAddress) {
|
|
49
|
-
const maxInstructionParamsFragment = 900; // Should not exceed message size limit when writing to the data account.
|
|
50
|
-
const accountCoder = new coders_1.LargeAccountsCoder(program.idl);
|
|
51
|
-
const instructionParamsBytes = await accountCoder.encode("fillRelayParams", {
|
|
52
|
-
relayData,
|
|
53
|
-
repaymentChainId,
|
|
54
|
-
repaymentAddress,
|
|
55
|
-
});
|
|
56
|
-
const loadInstructions = [];
|
|
57
|
-
loadInstructions.push(await program.methods.initializeInstructionParams(instructionParamsBytes.length).accounts({ signer }).instruction());
|
|
58
|
-
for (let i = 0; i < instructionParamsBytes.length; i += maxInstructionParamsFragment) {
|
|
59
|
-
const fragment = instructionParamsBytes.slice(i, i + maxInstructionParamsFragment);
|
|
60
|
-
loadInstructions.push(await program.methods.writeInstructionParamsFragment(i, fragment).accounts({ signer }).instruction());
|
|
61
|
-
}
|
|
62
|
-
const closeInstruction = await program.methods.closeInstructionParams().accounts({ signer }).instruction();
|
|
63
|
-
return { loadInstructions, closeInstruction };
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Loads fill relay parameters.
|
|
67
|
-
*/
|
|
68
|
-
async function loadFillRelayParams(program, signer, relayData, repaymentChainId, repaymentAddress) {
|
|
69
|
-
// Close the instruction params account if the caller has used it before.
|
|
70
|
-
await closeInstructionParams(program, signer);
|
|
71
|
-
// Execute load instructions sequentially.
|
|
72
|
-
const { loadInstructions } = await createFillRelayParamsInstructions(program, signer.publicKey, relayData, repaymentChainId, repaymentAddress);
|
|
73
|
-
for (let i = 0; i < loadInstructions.length; i += 1) {
|
|
74
|
-
await (0, web3_js_1.sendAndConfirmTransaction)(program.provider.connection, new web3_js_1.Transaction().add(loadInstructions[i]), [signer]);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Loads request slow fill parameters.
|
|
79
|
-
*/
|
|
80
|
-
async function loadRequestSlowFillParams(program, signer, relayData) {
|
|
81
|
-
// Close the instruction params account if the caller has used it before.
|
|
82
|
-
await closeInstructionParams(program, signer);
|
|
83
|
-
// Execute load instructions sequentially.
|
|
84
|
-
const maxInstructionParamsFragment = 900; // Should not exceed message size limit when writing to the data account.
|
|
85
|
-
const accountCoder = new coders_1.LargeAccountsCoder(program.idl);
|
|
86
|
-
const instructionParamsBytes = await accountCoder.encode("requestSlowFillParams", { relayData });
|
|
87
|
-
const loadInstructions = [];
|
|
88
|
-
loadInstructions.push(await program.methods
|
|
89
|
-
.initializeInstructionParams(instructionParamsBytes.length)
|
|
90
|
-
.accounts({ signer: signer.publicKey })
|
|
91
|
-
.instruction());
|
|
92
|
-
for (let i = 0; i < instructionParamsBytes.length; i += maxInstructionParamsFragment) {
|
|
93
|
-
const fragment = instructionParamsBytes.slice(i, i + maxInstructionParamsFragment);
|
|
94
|
-
loadInstructions.push(await program.methods
|
|
95
|
-
.writeInstructionParamsFragment(i, fragment)
|
|
96
|
-
.accounts({ signer: signer.publicKey })
|
|
97
|
-
.instruction());
|
|
98
|
-
}
|
|
99
|
-
return loadInstructions;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Loads execute slow relay leaf parameters.
|
|
103
|
-
*/
|
|
104
|
-
async function loadExecuteSlowRelayLeafParams(program, signer, slowFillLeaf, rootBundleId, proof) {
|
|
105
|
-
// Close the instruction params account if the caller has used it before.
|
|
106
|
-
await closeInstructionParams(program, signer);
|
|
107
|
-
// Execute load instructions sequentially.
|
|
108
|
-
const maxInstructionParamsFragment = 900; // Should not exceed message size limit when writing to the data account.
|
|
109
|
-
const accountCoder = new coders_1.LargeAccountsCoder(program.idl);
|
|
110
|
-
const instructionParamsBytes = await accountCoder.encode("executeSlowRelayLeafParams", {
|
|
111
|
-
slowFillLeaf,
|
|
112
|
-
rootBundleId,
|
|
113
|
-
proof,
|
|
114
|
-
});
|
|
115
|
-
const loadInstructions = [];
|
|
116
|
-
loadInstructions.push(await program.methods
|
|
117
|
-
.initializeInstructionParams(instructionParamsBytes.length)
|
|
118
|
-
.accounts({ signer: signer.publicKey })
|
|
119
|
-
.instruction());
|
|
120
|
-
for (let i = 0; i < instructionParamsBytes.length; i += maxInstructionParamsFragment) {
|
|
121
|
-
const fragment = instructionParamsBytes.slice(i, i + maxInstructionParamsFragment);
|
|
122
|
-
loadInstructions.push(await program.methods
|
|
123
|
-
.writeInstructionParamsFragment(i, fragment)
|
|
124
|
-
.accounts({ signer: signer.publicKey })
|
|
125
|
-
.instruction());
|
|
126
|
-
}
|
|
127
|
-
return loadInstructions;
|
|
128
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnchorProvider, Idl, Program } from "@
|
|
1
|
+
import { AnchorProvider, Idl, Program } from "@anchor-lang/core";
|
|
2
2
|
import { SupportedNetworks } from "../../types/svm";
|
|
3
3
|
import { MulticallHandlerAnchor, SvmSpokeAnchor, MessageTransmitterV2Anchor, TokenMessengerMinterV2Anchor, SponsoredCctpSrcPeripheryAnchor } from "../assets";
|
|
4
4
|
type ProgramOptions = {
|
|
@@ -6,13 +6,13 @@ exports.getMulticallHandlerProgram = getMulticallHandlerProgram;
|
|
|
6
6
|
exports.getMessageTransmitterV2Program = getMessageTransmitterV2Program;
|
|
7
7
|
exports.getTokenMessengerMinterV2Program = getTokenMessengerMinterV2Program;
|
|
8
8
|
exports.getSponsoredCctpSrcPeripheryProgram = getSponsoredCctpSrcPeripheryProgram;
|
|
9
|
-
const
|
|
9
|
+
const core_1 = require("@anchor-lang/core");
|
|
10
10
|
const DeploymentUtils_1 = require("../../DeploymentUtils");
|
|
11
11
|
const assets_1 = require("../assets");
|
|
12
12
|
const helpers_1 = require("./helpers");
|
|
13
13
|
function getConnectedProgram(idl, provider, programId) {
|
|
14
14
|
idl.address = programId;
|
|
15
|
-
return new
|
|
15
|
+
return new core_1.Program(idl, provider);
|
|
16
16
|
}
|
|
17
17
|
// Resolves the program ID from options or defaults to the deployed address. Prioritizes programId, falls back to
|
|
18
18
|
// network, and if network is not defined, determines the network from the provider's RPC URL. Throws an error if
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BN } from "@
|
|
2
|
-
import { RelayerRefundLeaf, RelayerRefundLeafSolana
|
|
1
|
+
import { BN } from "@anchor-lang/core";
|
|
2
|
+
import { RelayerRefundLeaf, RelayerRefundLeafSolana } from "../../types/svm";
|
|
3
3
|
/**
|
|
4
4
|
* Calculates the relay hash from relay data and chain ID.
|
|
5
5
|
*/
|
|
@@ -24,7 +24,3 @@ export declare function calculateRelayerRefundLeafHashUint8Array(relayData: Rela
|
|
|
24
24
|
* Hash function for relayer refund leaves.
|
|
25
25
|
*/
|
|
26
26
|
export declare const relayerRefundHashFn: (input: RelayerRefundLeaf | RelayerRefundLeafSolana) => string;
|
|
27
|
-
/**
|
|
28
|
-
* Hash function for slow fill leaves.
|
|
29
|
-
*/
|
|
30
|
-
export declare function slowFillHashFn(slowFillLeaf: SlowFillLeaf): string;
|
|
@@ -5,8 +5,7 @@ exports.calculateRelayHashUint8Array = calculateRelayHashUint8Array;
|
|
|
5
5
|
exports.calculateRelayEventHashUint8Array = calculateRelayEventHashUint8Array;
|
|
6
6
|
exports.hashNonEmptyMessage = hashNonEmptyMessage;
|
|
7
7
|
exports.calculateRelayerRefundLeafHashUint8Array = calculateRelayerRefundLeafHashUint8Array;
|
|
8
|
-
|
|
9
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
8
|
+
const core_1 = require("@anchor-lang/core");
|
|
10
9
|
const ethers_1 = require("ethers");
|
|
11
10
|
const borsh_1 = require("borsh");
|
|
12
11
|
/**
|
|
@@ -23,8 +22,8 @@ function calculateRelayHashUint8Array(relayData, chainId) {
|
|
|
23
22
|
relayData.outputAmount.toArrayLike(Buffer, "le", 8),
|
|
24
23
|
relayData.originChainId.toArrayLike(Buffer, "le", 8),
|
|
25
24
|
Buffer.from(relayData.depositId),
|
|
26
|
-
new
|
|
27
|
-
new
|
|
25
|
+
new core_1.BN(relayData.fillDeadline).toArrayLike(Buffer, "le", 4),
|
|
26
|
+
new core_1.BN(relayData.exclusivityDeadline).toArrayLike(Buffer, "le", 4),
|
|
28
27
|
hashNonEmptyMessage(relayData.message), // Replace with hash of message, so that relay hash can be recovered from event.
|
|
29
28
|
chainId.toArrayLike(Buffer, "le", 8),
|
|
30
29
|
]);
|
|
@@ -46,8 +45,8 @@ function calculateRelayEventHashUint8Array(relayEventData, chainId) {
|
|
|
46
45
|
relayEventData.outputAmount.toArrayLike(Buffer, "le", 8),
|
|
47
46
|
relayEventData.originChainId.toArrayLike(Buffer, "le", 8),
|
|
48
47
|
Buffer.from(relayEventData.depositId),
|
|
49
|
-
new
|
|
50
|
-
new
|
|
48
|
+
new core_1.BN(relayEventData.fillDeadline).toArrayLike(Buffer, "le", 4),
|
|
49
|
+
new core_1.BN(relayEventData.exclusivityDeadline).toArrayLike(Buffer, "le", 4),
|
|
51
50
|
Buffer.from(relayEventData.messageHash), // Renamed to messageHash in the event data.
|
|
52
51
|
chainId.toArrayLike(Buffer, "le", 8),
|
|
53
52
|
]);
|
|
@@ -147,63 +146,3 @@ const relayerRefundHashFn = (input) => {
|
|
|
147
146
|
}
|
|
148
147
|
};
|
|
149
148
|
exports.relayerRefundHashFn = relayerRefundHashFn;
|
|
150
|
-
/**
|
|
151
|
-
* Class for slow fill data.
|
|
152
|
-
*/
|
|
153
|
-
class SlowFillData {
|
|
154
|
-
constructor(properties) {
|
|
155
|
-
Object.assign(this, properties);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Schema for slow fill data.
|
|
160
|
-
*/
|
|
161
|
-
const slowFillDataSchema = new Map([
|
|
162
|
-
[
|
|
163
|
-
SlowFillData,
|
|
164
|
-
{
|
|
165
|
-
kind: "struct",
|
|
166
|
-
fields: [
|
|
167
|
-
["depositor", [32]],
|
|
168
|
-
["recipient", [32]],
|
|
169
|
-
["exclusiveRelayer", [32]],
|
|
170
|
-
["inputToken", [32]],
|
|
171
|
-
["outputToken", [32]],
|
|
172
|
-
["inputAmount", [32]],
|
|
173
|
-
["outputAmount", "u64"],
|
|
174
|
-
["originChainId", "u64"],
|
|
175
|
-
["depositId", [32]],
|
|
176
|
-
["fillDeadline", "u32"],
|
|
177
|
-
["exclusivityDeadline", "u32"],
|
|
178
|
-
["message", ["u8"]],
|
|
179
|
-
["chainId", "u64"],
|
|
180
|
-
["updatedOutputAmount", "u64"],
|
|
181
|
-
],
|
|
182
|
-
},
|
|
183
|
-
],
|
|
184
|
-
]);
|
|
185
|
-
/**
|
|
186
|
-
* Hash function for slow fill leaves.
|
|
187
|
-
*/
|
|
188
|
-
function slowFillHashFn(slowFillLeaf) {
|
|
189
|
-
const data = new SlowFillData({
|
|
190
|
-
depositor: Uint8Array.from(slowFillLeaf.relayData.depositor.toBuffer()),
|
|
191
|
-
recipient: Uint8Array.from(slowFillLeaf.relayData.recipient.toBuffer()),
|
|
192
|
-
exclusiveRelayer: Uint8Array.from(slowFillLeaf.relayData.exclusiveRelayer.toBuffer()),
|
|
193
|
-
inputToken: Uint8Array.from(slowFillLeaf.relayData.inputToken.toBuffer()),
|
|
194
|
-
outputToken: Uint8Array.from(slowFillLeaf.relayData.outputToken.toBuffer()),
|
|
195
|
-
inputAmount: slowFillLeaf.relayData.inputAmount,
|
|
196
|
-
outputAmount: slowFillLeaf.relayData.outputAmount,
|
|
197
|
-
originChainId: slowFillLeaf.relayData.originChainId,
|
|
198
|
-
depositId: Uint8Array.from(Buffer.from(slowFillLeaf.relayData.depositId)),
|
|
199
|
-
fillDeadline: slowFillLeaf.relayData.fillDeadline,
|
|
200
|
-
exclusivityDeadline: slowFillLeaf.relayData.exclusivityDeadline,
|
|
201
|
-
message: Uint8Array.from(slowFillLeaf.relayData.message),
|
|
202
|
-
chainId: slowFillLeaf.chainId,
|
|
203
|
-
updatedOutputAmount: slowFillLeaf.updatedOutputAmount,
|
|
204
|
-
});
|
|
205
|
-
const serializedData = (0, borsh_1.serialize)(slowFillDataSchema, data);
|
|
206
|
-
// SVM leaves require the first 64 bytes to be 0 to ensure EVM leaves cannot be played on SVM and vice versa
|
|
207
|
-
const contentToHash = Buffer.concat([Buffer.alloc(64, 0), serializedData]);
|
|
208
|
-
return ethers_1.ethers.utils.keccak256(contentToHash);
|
|
209
|
-
}
|
|
@@ -8,7 +8,7 @@ exports.getEvent = getEvent;
|
|
|
8
8
|
exports.readProgramEvents = readProgramEvents;
|
|
9
9
|
exports.subscribeToCpiEventsForProgram = subscribeToCpiEventsForProgram;
|
|
10
10
|
exports.stringifyCpiEvent = stringifyCpiEvent;
|
|
11
|
-
const
|
|
11
|
+
const core_1 = require("@anchor-lang/core");
|
|
12
12
|
const web3_js_1 = require("@solana/web3.js");
|
|
13
13
|
const borsh_1 = require("borsh");
|
|
14
14
|
const conversionUtils_1 = require("./conversionUtils");
|
|
@@ -16,11 +16,11 @@ const conversionUtils_1 = require("./conversionUtils");
|
|
|
16
16
|
* Finds a program address with a given label and optional extra seeds.
|
|
17
17
|
*/
|
|
18
18
|
function findProgramAddress(label, program, extraSeeds) {
|
|
19
|
-
const seeds = [Buffer.from(
|
|
19
|
+
const seeds = [Buffer.from(core_1.utils.bytes.utf8.encode(label))];
|
|
20
20
|
if (extraSeeds) {
|
|
21
21
|
for (const extraSeed of extraSeeds) {
|
|
22
22
|
if (typeof extraSeed === "string") {
|
|
23
|
-
seeds.push(Buffer.from(
|
|
23
|
+
seeds.push(Buffer.from(core_1.utils.bytes.utf8.encode(extraSeed)));
|
|
24
24
|
}
|
|
25
25
|
else if (Array.isArray(extraSeed)) {
|
|
26
26
|
seeds.push(Buffer.from(extraSeed));
|
|
@@ -67,8 +67,8 @@ function processEventFromTx(txResult, programs) {
|
|
|
67
67
|
singleIxAccount !== undefined &&
|
|
68
68
|
program.programId.equals(ixProgramId) &&
|
|
69
69
|
eventAuthorities.get(ixProgramId.toString())?.equals(singleIxAccount)) {
|
|
70
|
-
const ixData =
|
|
71
|
-
const eventData =
|
|
70
|
+
const ixData = core_1.utils.bytes.bs58.decode(ix.data);
|
|
71
|
+
const eventData = core_1.utils.bytes.base64.encode(Buffer.from(new Uint8Array(ixData).slice(8)));
|
|
72
72
|
const event = program.coder.events.decode(eventData);
|
|
73
73
|
events.push({
|
|
74
74
|
program: program.programId,
|
|
@@ -174,7 +174,7 @@ function parseDepositId(value) {
|
|
|
174
174
|
}
|
|
175
175
|
// Deserialize the full depositId using the Borsh schema
|
|
176
176
|
const depositId = (0, borsh_1.deserialize)(depositIdSchema, DepositId, Buffer.from(value));
|
|
177
|
-
return new
|
|
177
|
+
return new core_1.BN(depositId.value).toString();
|
|
178
178
|
}
|
|
179
179
|
/**
|
|
180
180
|
* Stringifies a CPI event.
|
|
@@ -187,7 +187,7 @@ function stringifyCpiEvent(obj, eventName) {
|
|
|
187
187
|
}
|
|
188
188
|
return obj.toString();
|
|
189
189
|
}
|
|
190
|
-
else if (
|
|
190
|
+
else if (core_1.BN.isBN(obj)) {
|
|
191
191
|
return obj.toString();
|
|
192
192
|
}
|
|
193
193
|
else if (typeof obj === "bigint") {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sendTransactionWithLookupTable = sendTransactionWithLookupTable;
|
|
4
4
|
exports.sendTransactionWithExistingLookupTable = sendTransactionWithExistingLookupTable;
|
|
5
|
-
const
|
|
5
|
+
const core_1 = require("@anchor-lang/core");
|
|
6
6
|
const web3_js_1 = require("@solana/web3.js");
|
|
7
7
|
/**
|
|
8
8
|
* Sends a transaction using an Address Lookup Table for large numbers of accounts.
|
|
@@ -22,7 +22,7 @@ async function sendTransactionWithLookupTable(connection, instructions, sender,
|
|
|
22
22
|
recentSlot: await connection.getSlot(),
|
|
23
23
|
});
|
|
24
24
|
// Submit the ALT creation transaction
|
|
25
|
-
await
|
|
25
|
+
await core_1.web3.sendAndConfirmTransaction(connection, new core_1.web3.Transaction().add(lookupTableInstruction), [sender], {
|
|
26
26
|
commitment: "confirmed",
|
|
27
27
|
skipPreflight: true,
|
|
28
28
|
});
|
|
@@ -34,7 +34,7 @@ async function sendTransactionWithLookupTable(connection, instructions, sender,
|
|
|
34
34
|
payer: sender.publicKey,
|
|
35
35
|
addresses: lookupAddresses.slice(i, i + maxExtendedAccounts),
|
|
36
36
|
});
|
|
37
|
-
await
|
|
37
|
+
await core_1.web3.sendAndConfirmTransaction(connection, new core_1.web3.Transaction().add(extendInstruction), [sender], {
|
|
38
38
|
commitment: "confirmed",
|
|
39
39
|
skipPreflight: true,
|
|
40
40
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Idl } from "@
|
|
1
|
+
import { Idl } from "@anchor-lang/core";
|
|
2
2
|
import web3, { Address, Commitment, GetSignaturesForAddressApi, Signature } from "@solana/kit";
|
|
3
3
|
import { RpcClient } from "./types";
|
|
4
4
|
type GetSignaturesForAddressConfig = Parameters<GetSignaturesForAddressApi["getSignaturesForAddress"]>[1];
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.readProgramEvents = readProgramEvents;
|
|
7
7
|
exports.readEvents = readEvents;
|
|
8
8
|
exports.readFillEventFromFillStatusPda = readFillEventFromFillStatusPda;
|
|
9
|
-
const
|
|
9
|
+
const core_1 = require("@anchor-lang/core");
|
|
10
10
|
const kit_1 = __importDefault(require("@solana/kit"));
|
|
11
11
|
/**
|
|
12
12
|
* Reads all events for a specific program.
|
|
@@ -79,9 +79,9 @@ async function processEventFromTx(txResult, programId, programIdl) {
|
|
|
79
79
|
singleIxAccount !== undefined &&
|
|
80
80
|
programId == ixProgramId &&
|
|
81
81
|
eventAuthorities.get(ixProgramId.toString()) == singleIxAccount) {
|
|
82
|
-
const ixData =
|
|
83
|
-
const eventData =
|
|
84
|
-
let event = new
|
|
82
|
+
const ixData = core_1.utils.bytes.bs58.decode(ix.data);
|
|
83
|
+
const eventData = core_1.utils.bytes.base64.encode(Buffer.from(new Uint8Array(ixData).slice(8)));
|
|
84
|
+
let event = new core_1.BorshEventCoder(programIdl).decode(eventData);
|
|
85
85
|
events.push({
|
|
86
86
|
program: programId,
|
|
87
87
|
data: event?.data,
|