@layerzerolabs/ton-sdk-tools 3.0.26 → 3.0.28
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/CHANGELOG.md +12 -0
- package/dist/index.cjs +40 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +40 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3178,8 +3178,7 @@ function generateSmlTestUtils(directory, filename) {
|
|
|
3178
3178
|
fs__namespace.default.writeFileSync(path__namespace.default.join(directory, filename), savedCode);
|
|
3179
3179
|
}
|
|
3180
3180
|
function generateUlnTestUtils(directory, filename) {
|
|
3181
|
-
const savedCode = `
|
|
3182
|
-
import { Address, Cell, TupleItemCell, beginCell, toNano } from '@ton/core'
|
|
3181
|
+
const savedCode = `import { Address, Cell, TupleItemCell, beginCell, toNano } from '@ton/core'
|
|
3183
3182
|
import { Blockchain, SandboxContract, SendMessageResult, TreasuryContract } from '@ton/sandbox'
|
|
3184
3183
|
import { FlatTransactionComparable } from '@ton/test-utils'
|
|
3185
3184
|
import { ethers } from 'ethers'
|
|
@@ -3639,6 +3638,7 @@ export async function addDvnWorkers(
|
|
|
3639
3638
|
for (const dvnFixture of [...sendDvnFixtures, ...receiveDvnFixtures]) {
|
|
3640
3639
|
const dvnWorkerCallMd = await allStorages.getNewMdExecuteParams({
|
|
3641
3640
|
target: addressToBigInt(msglibManager.address),
|
|
3641
|
+
forwardingAddress: 0n,
|
|
3642
3642
|
callData: await allStorages.getNewUlnWorkerFeelibInfo({
|
|
3643
3643
|
workerAddress: addressToBigInt(dvnFixture.dvn.address),
|
|
3644
3644
|
workerFeelibBytecode: cellFromArtifact(DvnFeelibArtifact),
|
|
@@ -4095,7 +4095,7 @@ export async function deployConfigAndRegisterDvn(
|
|
|
4095
4095
|
): Promise<[DvnFixture[], DvnFixture[]]> {
|
|
4096
4096
|
const dvnAdmins = [fixture.owner]
|
|
4097
4097
|
const verifierSet = generateRandomVerifierSet(3)
|
|
4098
|
-
|
|
4098
|
+
|
|
4099
4099
|
const sendDvnFixtures: DvnFixture[] = []
|
|
4100
4100
|
const receiveDvnFixtures: DvnFixture[] = []
|
|
4101
4101
|
|
|
@@ -4137,7 +4137,7 @@ export async function deployConfigAndRegisterDvn(
|
|
|
4137
4137
|
})
|
|
4138
4138
|
await eventHandler.addCurrentEventsToAllEvents(dvnMsgResults, dvn)
|
|
4139
4139
|
}
|
|
4140
|
-
|
|
4140
|
+
|
|
4141
4141
|
return [sendDvnFixtures, receiveDvnFixtures]
|
|
4142
4142
|
}
|
|
4143
4143
|
|
|
@@ -4151,7 +4151,6 @@ export async function deployConfigAndRegisterUln(
|
|
|
4151
4151
|
eventHandler: LzEventHandler,
|
|
4152
4152
|
dvnFixtureConfig: DvnFixtureConfig
|
|
4153
4153
|
): Promise<SandboxContract<TonContractWrapper>> {
|
|
4154
|
-
|
|
4155
4154
|
// ===================================open and deploy uln manager =====================================
|
|
4156
4155
|
|
|
4157
4156
|
const [msglibManager, ulnManagerMsgResults] = await openAndDeployUlnManagerViaMultisig(
|
|
@@ -4164,7 +4163,6 @@ export async function deployConfigAndRegisterUln(
|
|
|
4164
4163
|
srcFixture.msglibManager = msglibManager
|
|
4165
4164
|
|
|
4166
4165
|
// ===================================open and deploy dvn =====================================
|
|
4167
|
-
|
|
4168
4166
|
;[srcFixture.sendDvnFixtures, srcFixture.receiveDvnFixtures] = await deployConfigAndRegisterDvn(
|
|
4169
4167
|
blockchain,
|
|
4170
4168
|
allStorages,
|
|
@@ -4172,7 +4170,7 @@ export async function deployConfigAndRegisterUln(
|
|
|
4172
4170
|
eventHandler,
|
|
4173
4171
|
dvnFixtureConfig
|
|
4174
4172
|
)
|
|
4175
|
-
|
|
4173
|
+
|
|
4176
4174
|
// ===================================open and deploy executor=====================================
|
|
4177
4175
|
|
|
4178
4176
|
const executorAdmins = [srcFixture.owner]
|
|
@@ -4274,7 +4272,7 @@ export async function deployConfigAndRegisterUln(
|
|
|
4274
4272
|
priceFeedCacheProxy.address,
|
|
4275
4273
|
eventHandler
|
|
4276
4274
|
)
|
|
4277
|
-
|
|
4275
|
+
|
|
4278
4276
|
// ===================================addUlnWorker - executor =======================================
|
|
4279
4277
|
|
|
4280
4278
|
const executorWorkerCallMd = await allStorages.getNewMdExecuteParams({
|
|
@@ -4296,6 +4294,7 @@ export async function deployConfigAndRegisterUln(
|
|
|
4296
4294
|
}),
|
|
4297
4295
|
expiration: BigInt(0),
|
|
4298
4296
|
opcode: OPCODES.UlnManager_OP_ADD_ULN_WORKER,
|
|
4297
|
+
forwardingAddress: 0n,
|
|
4299
4298
|
})
|
|
4300
4299
|
|
|
4301
4300
|
internalMsgResults = await addUlnWorker(srcFixture.executorFixtures.admins[0], executor, executorWorkerCallMd, [
|
|
@@ -4357,6 +4356,7 @@ export async function deployConfigAndRegisterUln(
|
|
|
4357
4356
|
}),
|
|
4358
4357
|
expiration: BigInt(0),
|
|
4359
4358
|
opcode: OPCODES.UlnManager_OP_ADD_ULN_WORKER,
|
|
4359
|
+
forwardingAddress: 0n,
|
|
4360
4360
|
})
|
|
4361
4361
|
|
|
4362
4362
|
internalMsgResults = await addUlnWorker(
|
|
@@ -4418,7 +4418,7 @@ export async function deployConfigAndRegisterUln(
|
|
|
4418
4418
|
confirmationsNull: BigInt(0),
|
|
4419
4419
|
confirmations: BigInt(1),
|
|
4420
4420
|
})
|
|
4421
|
-
|
|
4421
|
+
|
|
4422
4422
|
srcFixture.defaultUlnSendConfig = ulnSendConfig
|
|
4423
4423
|
|
|
4424
4424
|
await sendMessageViaMultisigAndExpect({
|
|
@@ -4471,7 +4471,7 @@ export async function deployConfigAndRegisterUln(
|
|
|
4471
4471
|
})
|
|
4472
4472
|
|
|
4473
4473
|
srcFixture.defaultUlnReceiveConfig = ulnReceiveConfig
|
|
4474
|
-
|
|
4474
|
+
|
|
4475
4475
|
await sendMessageViaMultisigAndExpect({
|
|
4476
4476
|
blockchain,
|
|
4477
4477
|
multiSigContract: srcFixture.multisig,
|
|
@@ -4547,7 +4547,7 @@ export async function wireFixtureWithUln(
|
|
|
4547
4547
|
}
|
|
4548
4548
|
|
|
4549
4549
|
// ===================================deploy, configue, and register uln =====================================
|
|
4550
|
-
|
|
4550
|
+
|
|
4551
4551
|
srcFixture.msglibManager = await deployConfigAndRegisterUln(
|
|
4552
4552
|
blockchain,
|
|
4553
4553
|
multiSigners,
|
|
@@ -4569,7 +4569,7 @@ export async function wireFixtureWithUln(
|
|
|
4569
4569
|
srcFixture.msglibManager
|
|
4570
4570
|
)
|
|
4571
4571
|
await eventHandler.addCurrentEventsToAllEvents(internalMsgResults, srcFixture.controller)
|
|
4572
|
-
|
|
4572
|
+
|
|
4573
4573
|
// ===================================open and deploy uln connection =====================================
|
|
4574
4574
|
|
|
4575
4575
|
const [msglibConnection, ulnConnectionMsgResults] = await openAndDeployUlnConnection(
|
|
@@ -4597,8 +4597,7 @@ export async function wireFixtureWithUln(
|
|
|
4597
4597
|
|
|
4598
4598
|
// expect no failures
|
|
4599
4599
|
expect(eventHandler.allFailures.txList).toHaveLength(0)
|
|
4600
|
-
|
|
4601
|
-
|
|
4600
|
+
|
|
4602
4601
|
if (dvnFixtureConfigCustom) {
|
|
4603
4602
|
// ===================================open and deploy dvn =====================================
|
|
4604
4603
|
|
|
@@ -4648,7 +4647,7 @@ export async function wireFixtureWithUln(
|
|
|
4648
4647
|
md: await allStorages.getNewLzConfig({
|
|
4649
4648
|
path: srcFixture.path,
|
|
4650
4649
|
forwardingAddress: addressToBigInt(srcFixture.msglibManager.address),
|
|
4651
|
-
opCode: OPCODES.
|
|
4650
|
+
opCode: OPCODES.MsglibManager_OP_SET_OAPP_MSGLIB_SEND_CONFIG,
|
|
4652
4651
|
config: ulnSendConfig,
|
|
4653
4652
|
}),
|
|
4654
4653
|
balanceRefill: toNano('1'),
|
|
@@ -4662,7 +4661,7 @@ export async function wireFixtureWithUln(
|
|
|
4662
4661
|
{
|
|
4663
4662
|
from: srcFixture.oApp.address,
|
|
4664
4663
|
to: srcFixture.msglibManager.address,
|
|
4665
|
-
op: Number(OPCODES.
|
|
4664
|
+
op: Number(OPCODES.MsglibManager_OP_SET_OAPP_MSGLIB_SEND_CONFIG),
|
|
4666
4665
|
success: true,
|
|
4667
4666
|
},
|
|
4668
4667
|
{
|
|
@@ -4699,7 +4698,7 @@ export async function wireFixtureWithUln(
|
|
|
4699
4698
|
md: await allStorages.getNewLzConfig({
|
|
4700
4699
|
path: srcFixture.path,
|
|
4701
4700
|
forwardingAddress: addressToBigInt(srcFixture.msglibManager.address),
|
|
4702
|
-
opCode: OPCODES.
|
|
4701
|
+
opCode: OPCODES.MsglibManager_OP_SET_OAPP_MSGLIB_RECEIVE_CONFIG,
|
|
4703
4702
|
config: ulnReceiveConfig,
|
|
4704
4703
|
}),
|
|
4705
4704
|
balanceRefill: toNano('1'),
|
|
@@ -4713,7 +4712,7 @@ export async function wireFixtureWithUln(
|
|
|
4713
4712
|
{
|
|
4714
4713
|
from: srcFixture.oApp.address,
|
|
4715
4714
|
to: srcFixture.msglibManager.address,
|
|
4716
|
-
op: Number(OPCODES.
|
|
4715
|
+
op: Number(OPCODES.MsglibManager_OP_SET_OAPP_MSGLIB_RECEIVE_CONFIG),
|
|
4717
4716
|
success: true,
|
|
4718
4717
|
},
|
|
4719
4718
|
{
|
|
@@ -4868,6 +4867,7 @@ interface SetDictOnDvnParams {
|
|
|
4868
4867
|
nonce: bigint
|
|
4869
4868
|
allStorages: SandboxContract<TonContractWrapper>
|
|
4870
4869
|
expectedTransactions: FlatTransactionComparable[]
|
|
4870
|
+
target: bigint
|
|
4871
4871
|
}
|
|
4872
4872
|
|
|
4873
4873
|
export async function setDictOnDvn({
|
|
@@ -4878,6 +4878,7 @@ export async function setDictOnDvn({
|
|
|
4878
4878
|
signedOpcode,
|
|
4879
4879
|
incomingOpcode,
|
|
4880
4880
|
nonce,
|
|
4881
|
+
target,
|
|
4881
4882
|
allStorages,
|
|
4882
4883
|
expectedTransactions = [],
|
|
4883
4884
|
}: SetDictOnDvnParams): Promise<SendMessageResult> {
|
|
@@ -4885,6 +4886,7 @@ export async function setDictOnDvn({
|
|
|
4885
4886
|
nonce,
|
|
4886
4887
|
opcode: signedOpcode,
|
|
4887
4888
|
_dict: newDict,
|
|
4889
|
+
target,
|
|
4888
4890
|
})
|
|
4889
4891
|
|
|
4890
4892
|
return signAndSendRequestToDvn({
|
|
@@ -4922,6 +4924,7 @@ interface SetQuorumOnDvnParams {
|
|
|
4922
4924
|
nonce: bigint
|
|
4923
4925
|
allStorages: SandboxContract<TonContractWrapper>
|
|
4924
4926
|
expectedTransactions: FlatTransactionComparable[]
|
|
4927
|
+
target: bigint
|
|
4925
4928
|
}
|
|
4926
4929
|
|
|
4927
4930
|
export async function setQuorumOnDvn({
|
|
@@ -4934,11 +4937,13 @@ export async function setQuorumOnDvn({
|
|
|
4934
4937
|
nonce,
|
|
4935
4938
|
allStorages,
|
|
4936
4939
|
expectedTransactions,
|
|
4940
|
+
target,
|
|
4937
4941
|
}: SetQuorumOnDvnParams): Promise<SendMessageResult> {
|
|
4938
4942
|
const setQuorumMd = await dvn.getNewMdSetQuorum({
|
|
4939
4943
|
nonce,
|
|
4940
4944
|
opcode: signedOpcode,
|
|
4941
4945
|
quorum: newQuorum,
|
|
4946
|
+
target,
|
|
4942
4947
|
})
|
|
4943
4948
|
|
|
4944
4949
|
return signAndSendRequestToDvn({
|
|
@@ -5033,6 +5038,7 @@ interface CallVerifyOnDvnParams {
|
|
|
5033
5038
|
callData: Cell
|
|
5034
5039
|
allStorages: SandboxContract<TonContractWrapper>
|
|
5035
5040
|
expectedTransactions: FlatTransactionComparable[]
|
|
5041
|
+
forwardingAddress: bigint
|
|
5036
5042
|
}
|
|
5037
5043
|
|
|
5038
5044
|
export async function callVerifyOnDvn({
|
|
@@ -5046,12 +5052,14 @@ export async function callVerifyOnDvn({
|
|
|
5046
5052
|
callData,
|
|
5047
5053
|
allStorages,
|
|
5048
5054
|
expectedTransactions,
|
|
5055
|
+
forwardingAddress,
|
|
5049
5056
|
}: CallVerifyOnDvnParams): Promise<SendMessageResult> {
|
|
5050
5057
|
const executeParamsMd = await dvn.getNewMdExecuteParams({
|
|
5051
5058
|
expiration,
|
|
5052
5059
|
target,
|
|
5053
5060
|
callData,
|
|
5054
5061
|
opcode: signedOpcode,
|
|
5062
|
+
forwardingAddress,
|
|
5055
5063
|
})
|
|
5056
5064
|
|
|
5057
5065
|
return signAndSendRequestToDvn({
|
|
@@ -5082,21 +5090,22 @@ export async function ulnVerifyAndExpect(
|
|
|
5082
5090
|
|
|
5083
5091
|
const lzPacket = await createLzPacketFromPacketEncoded(mdPacketSent.packetEncoded, allStorages)
|
|
5084
5092
|
|
|
5085
|
-
const
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5093
|
+
for (const { dvn, proxy, admins, verifiers } of receiveDvnFixtures) {
|
|
5094
|
+
const requestMd = await allStorages.getNewMdExecuteParams({
|
|
5095
|
+
target: addressToBigInt(dvn.address),
|
|
5096
|
+
callData: await allStorages.getNewMdMdAddress({
|
|
5097
|
+
md: await allStorages.getNewMdUlnVerification({
|
|
5098
|
+
nonce: mdPacketSent.nonce,
|
|
5099
|
+
hash: BigInt('0x' + lzPacket.hash().toString('hex')),
|
|
5100
|
+
confirmations,
|
|
5101
|
+
}),
|
|
5102
|
+
address: addressToBigInt(msglibConnection.address),
|
|
5092
5103
|
}),
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
})
|
|
5104
|
+
expiration: oneDayFromNow,
|
|
5105
|
+
opcode: OPCODES.Uln_OP_ULN_VERIFY,
|
|
5106
|
+
forwardingAddress: addressToBigInt(uln.address),
|
|
5107
|
+
})
|
|
5098
5108
|
|
|
5099
|
-
for (const { dvn, proxy, admins, verifiers } of receiveDvnFixtures) {
|
|
5100
5109
|
const internalMsgResults: SendMessageResult = await sendInternalMessageAndExpect({
|
|
5101
5110
|
profile,
|
|
5102
5111
|
value: OAppFlowGas['Msglib.COMMIT_PACKET'],
|