Skip to content

Commit

Permalink
Adjusted all tests to match new signature place (in end)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skydev0h committed Feb 9, 2024
1 parent 033b63e commit 34a8556
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
15 changes: 10 additions & 5 deletions tests/wallet-v5-external.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ describe('Wallet V5 sign auth external', () => {
.endCell();

const fakePayload = beginCell()
.storeUint(Opcodes.auth_signed, 32)
.storeUint(WALLET_ID.serialized, 80)
.storeUint(vu, 32)
.storeUint(seqno + 1, 32) // seqno
Expand All @@ -627,8 +628,8 @@ describe('Wallet V5 sign auth external', () => {

const signature = sign(fakePayload.hash(), keypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

await disableConsoleError(() =>
Expand All @@ -649,6 +650,7 @@ describe('Wallet V5 sign auth external', () => {
const actionsList = packActionsList([new ActionSendMsg(SendMode.PAY_GAS_SEPARATELY, msg)]);

const payload = beginCell()
.storeUint(Opcodes.auth_signed, 32)
.storeUint(WALLET_ID.serialized, 80)
.storeUint(validUntil(), 32)
.storeUint(seqno, 32) // seqno
Expand All @@ -659,8 +661,8 @@ describe('Wallet V5 sign auth external', () => {

const signature = sign(payload.hash(), fakeKeypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

await disableConsoleError(() =>
Expand All @@ -681,6 +683,7 @@ describe('Wallet V5 sign auth external', () => {
const actionsList = packActionsList([new ActionSendMsg(SendMode.PAY_GAS_SEPARATELY, msg)]);

const payload = beginCell()
.storeUint(Opcodes.auth_signed, 32)
.storeUint(WALLET_ID.serialized, 80)
.storeUint(validUntil(), 32)
.storeUint(seqno + 1, 32) // seqno
Expand All @@ -689,8 +692,8 @@ describe('Wallet V5 sign auth external', () => {

const signature = sign(payload.hash(), keypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

await disableConsoleError(() =>
Expand All @@ -711,6 +714,7 @@ describe('Wallet V5 sign auth external', () => {
const actionsList = packActionsList([new ActionSendMsg(SendMode.PAY_GAS_SEPARATELY, msg)]);

const payload = beginCell()
.storeUint(Opcodes.auth_signed, 32)
.storeUint(WALLET_ID.serialized, 80)
.storeUint(Math.round(Date.now() / 1000) - 600, 32)
.storeUint(seqno, 32)
Expand All @@ -719,8 +723,8 @@ describe('Wallet V5 sign auth external', () => {

const signature = sign(payload.hash(), keypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

await disableConsoleError(() =>
Expand All @@ -741,6 +745,7 @@ describe('Wallet V5 sign auth external', () => {
const actionsList = packActionsList([new ActionSendMsg(SendMode.PAY_GAS_SEPARATELY, msg)]);

const payload = beginCell()
.storeUint(Opcodes.auth_signed, 32)
.storeUint(new WalletId({ ...WALLET_ID, subwalletNumber: 1 }).serialized, 80)
.storeUint(validUntil(), 32)
.storeUint(seqno, 32)
Expand All @@ -749,8 +754,8 @@ describe('Wallet V5 sign auth external', () => {

const signature = sign(payload.hash(), keypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

await disableConsoleError(() =>
Expand Down
13 changes: 8 additions & 5 deletions tests/wallet-v5-internal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ describe('Wallet V5 sign auth internal', () => {
const vu = validUntil();

const payload = beginCell()
.storeUint(Opcodes.auth_signed_internal, 32)
.storeUint(WALLET_ID.serialized, 80)
.storeUint(vu, 32)
.storeUint(seqno, 32) // seqno
Expand All @@ -623,8 +624,8 @@ describe('Wallet V5 sign auth internal', () => {

const signature = sign(fakePayload.hash(), keypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

const receipt = await walletV5.sendInternalSignedMessage(sender, {
Expand Down Expand Up @@ -713,7 +714,7 @@ describe('Wallet V5 sign auth internal', () => {
const actionsList = packActionsList([new ActionSendMsg(SendMode.PAY_GAS_SEPARATELY, msg)]);

const payload = beginCell()

.storeUint(Opcodes.auth_signed_internal, 32)
.storeUint(WALLET_ID.serialized, 80)
.storeUint(validUntil(), 32)
.storeUint(seqno + 1, 32) // seqno
Expand All @@ -722,8 +723,8 @@ describe('Wallet V5 sign auth internal', () => {

const signature = sign(payload.hash(), keypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

const receipt = await walletV5.sendInternalSignedMessage(sender, {
Expand Down Expand Up @@ -758,6 +759,7 @@ describe('Wallet V5 sign auth internal', () => {
const actionsList = packActionsList([new ActionSendMsg(SendMode.PAY_GAS_SEPARATELY, msg)]);

const payload = beginCell()
.storeUint(Opcodes.auth_signed_internal, 32)
.storeUint(WALLET_ID.serialized, 80)
.storeUint(Math.round(Date.now() / 1000) - 600, 32)
.storeUint(seqno, 32)
Expand All @@ -766,8 +768,8 @@ describe('Wallet V5 sign auth internal', () => {

const signature = sign(payload.hash(), keypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

const receipt = await walletV5.sendInternalSignedMessage(sender, {
Expand Down Expand Up @@ -802,6 +804,7 @@ describe('Wallet V5 sign auth internal', () => {
const actionsList = packActionsList([new ActionSendMsg(SendMode.PAY_GAS_SEPARATELY, msg)]);

const payload = beginCell()
.storeUint(Opcodes.auth_signed_internal, 32)
.storeUint(new WalletId({ ...WALLET_ID, subwalletNumber: 1 }).serialized, 80)
.storeUint(validUntil(), 32)
.storeUint(seqno, 32)
Expand All @@ -810,8 +813,8 @@ describe('Wallet V5 sign auth internal', () => {

const signature = sign(payload.hash(), keypair.secretKey);
const body = beginCell()
.storeUint(bufferToBigInt(signature), 512)
.storeSlice(payload.beginParse())
.storeUint(bufferToBigInt(signature), 512)
.endCell();

const receipt = await walletV5.sendInternalSignedMessage(sender, {
Expand Down

0 comments on commit 34a8556

Please sign in to comment.