@anywalletkit/protocol-swap2-omniston 0.2.3 → 0.2.4
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/dist/{chunk-W3AXGSX3.js → chunk-3CGSN2T6.js} +6 -5
- package/dist/chunk-3CGSN2T6.js.map +1 -0
- package/dist/{chunk-K2KBWGNL.js → chunk-FMMBUGYB.js} +2 -2
- package/dist/index.cjs +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/protocol.cjs +5 -4
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.js +2 -2
- package/dist/provider.cjs +5 -4
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.js +1 -1
- package/dist/validators.cjs +36 -34
- package/dist/validators.cjs.map +1 -1
- package/dist/validators.js +6 -4
- package/dist/validators.js.map +1 -1
- package/package.json +10 -7
- package/dist/chunk-W3AXGSX3.js.map +0 -1
- /package/dist/{chunk-K2KBWGNL.js.map → chunk-FMMBUGYB.js.map} +0 -0
package/dist/validators.js
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
keccak256,
|
|
9
9
|
stringToHex
|
|
10
10
|
} from "viem";
|
|
11
|
+
import { bigintToNumber } from "@anywalletkit/core";
|
|
11
12
|
var ESCROW_FACTORY_ABI = [
|
|
12
13
|
{
|
|
13
14
|
type: "function",
|
|
@@ -178,10 +179,10 @@ function locateImmutables(input, secretHash) {
|
|
|
178
179
|
try {
|
|
179
180
|
const offset = word(7);
|
|
180
181
|
if (offset % 32n !== 0n || offset < 288n || offset > 4096n) return null;
|
|
181
|
-
const lengthAt = start +
|
|
182
|
+
const lengthAt = start + bigintToNumber(offset) * 2;
|
|
182
183
|
if (data.length < lengthAt + 64) return null;
|
|
183
184
|
const length = BigInt(`0x${data.slice(lengthAt, lengthAt + 64)}`);
|
|
184
|
-
if (length > 1024n || data.length < lengthAt + 64 +
|
|
185
|
+
if (length > 1024n || data.length < lengthAt + 64 + bigintToNumber(length) * 2) return null;
|
|
185
186
|
return {
|
|
186
187
|
orderHash: `0x${data.slice(start, at)}`,
|
|
187
188
|
hashlock: `0x${needle}`,
|
|
@@ -191,7 +192,7 @@ function locateImmutables(input, secretHash) {
|
|
|
191
192
|
amount: word(4),
|
|
192
193
|
safetyDeposit: word(5),
|
|
193
194
|
timelocks: word(6),
|
|
194
|
-
parameters: `0x${data.slice(lengthAt + 64, lengthAt + 64 +
|
|
195
|
+
parameters: `0x${data.slice(lengthAt + 64, lengthAt + 64 + bigintToNumber(length) * 2)}`
|
|
195
196
|
};
|
|
196
197
|
} catch {
|
|
197
198
|
return null;
|
|
@@ -505,6 +506,7 @@ function createOmnistonEvmInputValidator(options = {}) {
|
|
|
505
506
|
// src/validators/ton.ts
|
|
506
507
|
import { Buffer } from "buffer";
|
|
507
508
|
import { Address, Cell } from "@ton/core";
|
|
509
|
+
import { bigintToNumber as bigintToNumber2 } from "@anywalletkit/core";
|
|
508
510
|
var JETTON_TRANSFER_OP = 260734629;
|
|
509
511
|
var ESCROW_CREATE_OP = 3232100569;
|
|
510
512
|
var ESCROW_CONFIG_OP = 4073126499;
|
|
@@ -879,7 +881,7 @@ function createOmnistonTonValidators(options = {}) {
|
|
|
879
881
|
const txResponse = await get(`/v2/blockchain/accounts/${encodeURIComponent(input.positionAddress)}/transactions?limit=25`);
|
|
880
882
|
if (!txResponse.ok) return refuse("transactions-fetch", { status: txResponse.status });
|
|
881
883
|
const body = await txResponse.json();
|
|
882
|
-
const deployedByFactory = (body.transactions ?? []).some((tx) => tx.success === true && tx.aborted !== true && tx.in_msg?.op_code?.toLowerCase() === POSITION_DEPLOY_OP && !!tx.in_msg.source?.address && sameAddress(Address.parse(tx.in_msg.source.address), input.protocolAddress) && typeof tx.utime === "number" && Math.abs(
|
|
884
|
+
const deployedByFactory = (body.transactions ?? []).some((tx) => tx.success === true && tx.aborted !== true && tx.in_msg?.op_code?.toLowerCase() === POSITION_DEPLOY_OP && !!tx.in_msg.source?.address && sameAddress(Address.parse(tx.in_msg.source.address), input.protocolAddress) && typeof tx.utime === "number" && Math.abs(bigintToNumber2(BigInt(state.withdrawalAt)) - 1 - tx.utime) <= 5);
|
|
883
885
|
return deployedByFactory || refuse("deploy-transaction", { transactions: (body.transactions ?? []).length });
|
|
884
886
|
} catch (error) {
|
|
885
887
|
return refuse("error", { message: error instanceof Error ? error.message : String(error) });
|