@piprail/sdk 2.4.0 → 2.6.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/CHANGELOG.md +55 -0
- package/dist/index.cjs +177 -7
- package/dist/index.d.cts +31 -9
- package/dist/index.d.ts +31 -9
- package/dist/index.js +175 -5
- package/dist/{near-DI2I3MAV.cjs → near-H5AQ253I.cjs} +300 -24
- package/dist/{near-MTYBCUYM.js → near-OTPQD6BI.js} +287 -11
- package/package.json +6 -1
|
@@ -2,7 +2,9 @@ import {
|
|
|
2
2
|
ConfirmationTimeoutError,
|
|
3
3
|
InsufficientFundsError,
|
|
4
4
|
RecipientNotReadyError,
|
|
5
|
+
SettlementError,
|
|
5
6
|
UnknownTokenError,
|
|
7
|
+
UnsupportedSchemeError,
|
|
6
8
|
WrongFamilyError,
|
|
7
9
|
assertNoLegacyWalletKey,
|
|
8
10
|
nativeCost,
|
|
@@ -11,10 +13,15 @@ import {
|
|
|
11
13
|
} from "./chunk-7XK22JSQ.js";
|
|
12
14
|
|
|
13
15
|
// src/drivers/near/index.ts
|
|
14
|
-
import { JsonRpcProvider, Account, actions } from "near-api-js";
|
|
16
|
+
import { JsonRpcProvider, Account, actions as actions2 } from "near-api-js";
|
|
15
17
|
|
|
16
18
|
// src/drivers/near/chains.ts
|
|
17
19
|
var NEAR_DECIMALS = 24;
|
|
20
|
+
function isValidNearAccountId(id) {
|
|
21
|
+
if (id.startsWith("0x")) return false;
|
|
22
|
+
if (id.length < 2 || id.length > 64) return false;
|
|
23
|
+
return /^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/.test(id);
|
|
24
|
+
}
|
|
18
25
|
var NEAR_MAINNET = {
|
|
19
26
|
caip2: "near:mainnet",
|
|
20
27
|
defaultRpc: "https://free.rpc.fastnear.com",
|
|
@@ -92,6 +99,190 @@ function isNearAffordability(err) {
|
|
|
92
99
|
return /not enough|doesn't have enough|does not have enough|lack ?balance|exceeds .*balance|insufficient/i.test(m);
|
|
93
100
|
}
|
|
94
101
|
|
|
102
|
+
// src/drivers/near/exact.ts
|
|
103
|
+
import { actions, buildDelegateAction, encodeSignedDelegate, DelegateAction, SCHEMA } from "near-api-js";
|
|
104
|
+
import { deserialize } from "borsh";
|
|
105
|
+
var FT_TRANSFER_GAS2 = 30000000000000n;
|
|
106
|
+
var ONE_YOCTO2 = 1n;
|
|
107
|
+
var ESTIMATED_BLOCK_SECONDS = 1;
|
|
108
|
+
var NONCE_BLOCK_MULTIPLIER = 1000000n;
|
|
109
|
+
async function payExactNear(input) {
|
|
110
|
+
const { signer, senderId, blockHeight, accessKeyNonce, accept } = input;
|
|
111
|
+
if (accept.asset === "native") {
|
|
112
|
+
throw new UnsupportedSchemeError(
|
|
113
|
+
"NEAR exact is NEP-141-only (an ft_transfer); native NEAR is not exact-payable. Pay via onchain-proof."
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
if (!isValidNearAccountId(accept.asset)) {
|
|
117
|
+
throw new UnsupportedSchemeError(`NEAR exact: asset "${accept.asset}" must be a NEP-141 contract account id.`);
|
|
118
|
+
}
|
|
119
|
+
if (!isValidNearAccountId(accept.payTo)) {
|
|
120
|
+
throw new UnsupportedSchemeError(`NEAR exact: payTo "${accept.payTo}" is not a valid NEAR account id.`);
|
|
121
|
+
}
|
|
122
|
+
if (!isValidNearAccountId(senderId)) {
|
|
123
|
+
throw new UnsupportedSchemeError(`NEAR exact: sender "${senderId}" is not a valid NEAR account id.`);
|
|
124
|
+
}
|
|
125
|
+
const t = accept.maxTimeoutSeconds;
|
|
126
|
+
if (!Number.isInteger(t) || t <= 0) {
|
|
127
|
+
throw new UnsupportedSchemeError("NEAR exact: maxTimeoutSeconds must be a positive integer.");
|
|
128
|
+
}
|
|
129
|
+
const timeoutBlocks = BigInt(Math.max(1, Math.ceil(t / ESTIMATED_BLOCK_SECONDS)));
|
|
130
|
+
const maxBlockHeight = blockHeight + timeoutBlocks;
|
|
131
|
+
const nonce = accessKeyNonce + 1n;
|
|
132
|
+
if (nonce >= blockHeight * NONCE_BLOCK_MULTIPLIER) {
|
|
133
|
+
throw new UnsupportedSchemeError(
|
|
134
|
+
"NEAR exact: the access-key nonce is at the protocol ceiling for this block height; cannot build a delegate action."
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
const publicKey = await signer.getPublicKey();
|
|
138
|
+
const action = actions.functionCall(
|
|
139
|
+
"ft_transfer",
|
|
140
|
+
{ receiver_id: accept.payTo, amount: accept.amount },
|
|
141
|
+
FT_TRANSFER_GAS2,
|
|
142
|
+
ONE_YOCTO2
|
|
143
|
+
);
|
|
144
|
+
const delegateAction = buildDelegateAction({
|
|
145
|
+
senderId,
|
|
146
|
+
receiverId: accept.asset,
|
|
147
|
+
actions: [action],
|
|
148
|
+
nonce,
|
|
149
|
+
maxBlockHeight,
|
|
150
|
+
publicKey
|
|
151
|
+
});
|
|
152
|
+
const { signedDelegate } = await signer.signDelegateAction(delegateAction);
|
|
153
|
+
const encoded = encodeSignedDelegate(signedDelegate);
|
|
154
|
+
return {
|
|
155
|
+
payload: { signedDelegateAction: Buffer.from(encoded).toString("base64") },
|
|
156
|
+
payerFrom: senderId,
|
|
157
|
+
// A stable id for THIS authorization (single-use on-chain via the access-key nonce): the
|
|
158
|
+
// client records it as the spend ref and re-presents the SAME signed action on a retry.
|
|
159
|
+
nonce: `${senderId}:${nonce.toString()}`
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
var MAX_RELAY_GAS = 300000000000000n;
|
|
163
|
+
var b64decode = (s) => new Uint8Array(Buffer.from(s, "base64"));
|
|
164
|
+
function shorten(msg) {
|
|
165
|
+
const oneLine = msg.replace(/\s+/g, " ").trim();
|
|
166
|
+
return oneLine.length > 200 ? `${oneLine.slice(0, 200)}\u2026` : oneLine;
|
|
167
|
+
}
|
|
168
|
+
function fail(error, detail) {
|
|
169
|
+
return { ok: false, error, detail };
|
|
170
|
+
}
|
|
171
|
+
function verifyExactNear(payload, accept, currentBlockHeight) {
|
|
172
|
+
if (accept.asset === "native" || !isValidNearAccountId(accept.asset)) {
|
|
173
|
+
return fail("transfer_not_found", `NEAR exact rail asset "${accept.asset}" is not a NEP-141 contract.`);
|
|
174
|
+
}
|
|
175
|
+
if (typeof payload?.signedDelegateAction !== "string") {
|
|
176
|
+
return fail("signature_invalid", "NEAR exact payload is missing signedDelegateAction.");
|
|
177
|
+
}
|
|
178
|
+
let decoded;
|
|
179
|
+
try {
|
|
180
|
+
decoded = deserialize(SCHEMA.SignedDelegate, b64decode(payload.signedDelegateAction));
|
|
181
|
+
} catch (err) {
|
|
182
|
+
return fail("signature_invalid", `Unparseable SignedDelegateAction: ${shorten(err instanceof Error ? err.message : String(err))}.`);
|
|
183
|
+
}
|
|
184
|
+
const da = decoded?.delegateAction;
|
|
185
|
+
const sig = decoded?.signature;
|
|
186
|
+
if (!da || sig == null) return fail("signature_invalid", "SignedDelegateAction is missing its delegate action or signature.");
|
|
187
|
+
if (!Array.isArray(da.actions) || da.actions.length !== 1) {
|
|
188
|
+
return fail("transfer_not_found", `the delegate must carry exactly one action, got ${da.actions?.length ?? 0}.`);
|
|
189
|
+
}
|
|
190
|
+
const fc = da.actions[0]?.functionCall;
|
|
191
|
+
if (!fc || fc.methodName !== "ft_transfer") {
|
|
192
|
+
return fail("transfer_not_found", `the delegated action is not an ft_transfer (got "${fc?.methodName ?? "none"}").`);
|
|
193
|
+
}
|
|
194
|
+
if (da.receiverId !== accept.asset) {
|
|
195
|
+
return fail("transfer_not_found", `delegate receiver ${da.receiverId} \u2260 token contract ${accept.asset}.`);
|
|
196
|
+
}
|
|
197
|
+
let args;
|
|
198
|
+
try {
|
|
199
|
+
args = JSON.parse(Buffer.from(fc.args ?? new Uint8Array()).toString());
|
|
200
|
+
} catch {
|
|
201
|
+
return fail("transfer_not_found", "the ft_transfer args are not valid JSON.");
|
|
202
|
+
}
|
|
203
|
+
if (args.receiver_id !== accept.payTo) {
|
|
204
|
+
return fail("wrong_recipient", `ft_transfer pays ${String(args.receiver_id)}, not payTo ${accept.payTo}.`);
|
|
205
|
+
}
|
|
206
|
+
if (typeof args.amount !== "string" || !/^\d+$/.test(args.amount) || BigInt(args.amount) < BigInt(accept.amount)) {
|
|
207
|
+
return fail("amount_too_low", `ft_transfer pays ${String(args.amount)} of the token, required ${accept.amount}.`);
|
|
208
|
+
}
|
|
209
|
+
let deposit;
|
|
210
|
+
let gas;
|
|
211
|
+
try {
|
|
212
|
+
deposit = BigInt(fc.deposit ?? 0);
|
|
213
|
+
gas = BigInt(fc.gas ?? 0);
|
|
214
|
+
} catch {
|
|
215
|
+
return fail("signature_invalid", "the ft_transfer has a malformed gas/deposit.");
|
|
216
|
+
}
|
|
217
|
+
if (deposit !== ONE_YOCTO2) {
|
|
218
|
+
return fail("signature_invalid", `attached deposit ${deposit} \u2260 the required 1 yoctoNEAR (relayer drain guard).`);
|
|
219
|
+
}
|
|
220
|
+
if (gas > MAX_RELAY_GAS) {
|
|
221
|
+
return fail("signature_invalid", `delegated gas ${gas} exceeds the ${MAX_RELAY_GAS} cap (relayer drain guard).`);
|
|
222
|
+
}
|
|
223
|
+
if (currentBlockHeight !== null) {
|
|
224
|
+
let maxBlock;
|
|
225
|
+
try {
|
|
226
|
+
maxBlock = BigInt(da.maxBlockHeight ?? 0);
|
|
227
|
+
} catch {
|
|
228
|
+
return fail("signature_invalid", "the delegate has a malformed max_block_height.");
|
|
229
|
+
}
|
|
230
|
+
if (maxBlock <= currentBlockHeight) {
|
|
231
|
+
return fail("payment_expired", `the delegate expired (max_block_height ${maxBlock} \u2264 current ${currentBlockHeight}).`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (!da.senderId || !isValidNearAccountId(String(da.senderId))) {
|
|
235
|
+
return fail("signature_invalid", `the delegate sender "${String(da.senderId)}" is not a valid NEAR account id.`);
|
|
236
|
+
}
|
|
237
|
+
return { ok: true, senderId: String(da.senderId), delegateAction: new DelegateAction(da), signature: sig };
|
|
238
|
+
}
|
|
239
|
+
async function verifyAndSettleExactNear(input) {
|
|
240
|
+
const { client, payload, accept } = input;
|
|
241
|
+
let height = null;
|
|
242
|
+
try {
|
|
243
|
+
height = await client.currentBlockHeight();
|
|
244
|
+
} catch {
|
|
245
|
+
}
|
|
246
|
+
const v = verifyExactNear(payload, accept, height);
|
|
247
|
+
if (!v.ok) return v;
|
|
248
|
+
let result;
|
|
249
|
+
try {
|
|
250
|
+
result = await client.relay({ senderId: v.senderId, delegateAction: v.delegateAction, signature: v.signature });
|
|
251
|
+
} catch (err) {
|
|
252
|
+
const m = err instanceof Error ? err.message : String(err);
|
|
253
|
+
if (/invalid.*nonce|nonce.*used|DelegateActionInvalidNonce/i.test(m)) {
|
|
254
|
+
return fail("tx_already_used", `this delegate was already used (single-use nonce): ${shorten(m)}.`);
|
|
255
|
+
}
|
|
256
|
+
if (/expired|DelegateActionExpired|max_block_height|deadline/i.test(m)) {
|
|
257
|
+
return fail("payment_expired", `the delegate expired before it landed: ${shorten(m)}.`);
|
|
258
|
+
}
|
|
259
|
+
if (/not enough|insufficient|exceeded the prepaid gas|NotEnoughBalance|doesn't have enough|is not registered/i.test(m)) {
|
|
260
|
+
return fail("tx_reverted", `the ft_transfer would fail on chain: ${shorten(m)}.`);
|
|
261
|
+
}
|
|
262
|
+
throw new SettlementError(
|
|
263
|
+
`NEAR exact settle: the relayer could not submit the delegate (${shorten(m)}). The buyer's signed delegate is still valid \u2014 fund/fix the relayer and the buyer can re-present it.`,
|
|
264
|
+
{ cause: err }
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
if (!result.innerSuccess) {
|
|
268
|
+
return fail("tx_reverted", `the ft_transfer receipt did not succeed on chain (tx ${result.txHash}).`);
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
ok: true,
|
|
272
|
+
receipt: {
|
|
273
|
+
scheme: "exact",
|
|
274
|
+
success: true,
|
|
275
|
+
network: accept.network,
|
|
276
|
+
transaction: result.txHash,
|
|
277
|
+
asset: accept.asset,
|
|
278
|
+
amount: accept.amount,
|
|
279
|
+
payer: v.senderId,
|
|
280
|
+
payTo: accept.payTo,
|
|
281
|
+
verifiedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
95
286
|
// src/drivers/near/verify.ts
|
|
96
287
|
function parseFtTransferEvent(line) {
|
|
97
288
|
const marker = "EVENT_JSON:";
|
|
@@ -253,11 +444,6 @@ var nearDriver = {
|
|
|
253
444
|
return makeNearNetwork(NEAR_MAINNET, rpcUrl);
|
|
254
445
|
}
|
|
255
446
|
};
|
|
256
|
-
function isValidNearAccountId(id) {
|
|
257
|
-
if (id.startsWith("0x")) return false;
|
|
258
|
-
if (id.length < 2 || id.length > 64) return false;
|
|
259
|
-
return /^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/.test(id);
|
|
260
|
-
}
|
|
261
447
|
function makeNearNetwork(preset, rpcUrl) {
|
|
262
448
|
const provider = new JsonRpcProvider({ url: rpcUrl });
|
|
263
449
|
const network = preset.caip2;
|
|
@@ -358,7 +544,7 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
358
544
|
const outcome = await account.signAndSendTransaction({
|
|
359
545
|
receiverId: contractId,
|
|
360
546
|
actions: [
|
|
361
|
-
|
|
547
|
+
actions2.functionCall("ft_transfer", { receiver_id: receiverId, amount, memo }, gas, deposit)
|
|
362
548
|
]
|
|
363
549
|
});
|
|
364
550
|
return { hash: hashOf(outcome) };
|
|
@@ -366,7 +552,7 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
366
552
|
async nativeTransfer({ receiverId, amount }) {
|
|
367
553
|
const outcome = await account.signAndSendTransaction({
|
|
368
554
|
receiverId,
|
|
369
|
-
actions: [
|
|
555
|
+
actions: [actions2.transfer(BigInt(amount))]
|
|
370
556
|
});
|
|
371
557
|
return { hash: hashOf(outcome) };
|
|
372
558
|
}
|
|
@@ -445,6 +631,96 @@ function makeNearNetwork(preset, rpcUrl) {
|
|
|
445
631
|
async verify(ref, accept) {
|
|
446
632
|
const { senderId, hash } = decodeRef(ref);
|
|
447
633
|
return verifyNear({ reader, hash, senderId, accept });
|
|
634
|
+
},
|
|
635
|
+
// Standard x402 `exact` rail, BUYER side — build a NEP-366 SignedDelegateAction authorizing one
|
|
636
|
+
// NEP-141 ft_transfer (per scheme_exact_near.md). The buyer signs with its FULL-ACCESS key and
|
|
637
|
+
// spends ZERO NEAR; a keyless facilitator's relayer prepays the gas + 1 yoctoNEAR and submits.
|
|
638
|
+
// NEAR exact is NEP-141-only + facilitator-settled (see ./exact.ts for why) — native NEAR isn't
|
|
639
|
+
// exact-payable. Pre-reads the access-key nonce + final block height, then defers to payExactNear.
|
|
640
|
+
async payExact(wallet, accept) {
|
|
641
|
+
const { accountId, signer } = resolveNearWallet(wallet._native);
|
|
642
|
+
const publicKey = await signer.getPublicKey();
|
|
643
|
+
const [accessKey, block] = await Promise.all([
|
|
644
|
+
provider.query({
|
|
645
|
+
request_type: "view_access_key",
|
|
646
|
+
finality: "final",
|
|
647
|
+
account_id: accountId,
|
|
648
|
+
public_key: publicKey.toString()
|
|
649
|
+
}),
|
|
650
|
+
provider.viewBlock({ finality: "final" })
|
|
651
|
+
]);
|
|
652
|
+
const accessKeyNonce = BigInt(accessKey.nonce ?? 0);
|
|
653
|
+
const blockHeight = BigInt(block.header?.height ?? 0);
|
|
654
|
+
const { payload, payerFrom, nonce } = await payExactNear({
|
|
655
|
+
signer,
|
|
656
|
+
senderId: accountId,
|
|
657
|
+
blockHeight,
|
|
658
|
+
accessKeyNonce,
|
|
659
|
+
accept
|
|
660
|
+
});
|
|
661
|
+
return { payload, accepted: accept, payerFrom, nonce };
|
|
662
|
+
},
|
|
663
|
+
// The gate's rail-advertisement SPI. NEAR exact is NEP-141-only. The fee payer (the relayer that
|
|
664
|
+
// prepays gas + the 1 yocto, so the BUYER pays nothing) comes from EITHER the merchant's own bound
|
|
665
|
+
// `relayer` (SELF mode — what works today) OR a facilitator-provided `feePayer` (facilitator mode —
|
|
666
|
+
// for when a NEAR x402 facilitator ships; none does yet). `null` for native / non-NEP-141 / when no
|
|
667
|
+
// fee payer is available. The buyer's SignedDelegateAction is self-contained, so `feePayer` rides in
|
|
668
|
+
// `extra` only for observability + (future) facilitator forwarding.
|
|
669
|
+
async resolveExactRail({ asset, relayer, feePayer }) {
|
|
670
|
+
if (asset === "native" || !isValidNearAccountId(asset)) return null;
|
|
671
|
+
let fp = feePayer;
|
|
672
|
+
if (!fp && relayer) {
|
|
673
|
+
try {
|
|
674
|
+
fp = resolveNearWallet(relayer._native).accountId;
|
|
675
|
+
} catch {
|
|
676
|
+
return null;
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
if (!fp) return null;
|
|
680
|
+
return { method: "near", extra: { feePayer: fp } };
|
|
681
|
+
},
|
|
682
|
+
// Standard x402 `exact` rail, SELLER side (SELF-SETTLE) — decode + verify the inbound delegate
|
|
683
|
+
// against the trusted accept, then RELAY it from the merchant's own NEAR relayer (which prepays the
|
|
684
|
+
// sub-cent gas + the 1 yocto). The buyer stays gasless. THIS is how a NEAR gate gets paid today
|
|
685
|
+
// (no third-party facilitator settles NEAR yet). The drain guard (gas/deposit caps) lives in
|
|
686
|
+
// verifyAndSettleExactNear, invisible to the gate.
|
|
687
|
+
async settleExactSelf({ relayer, payload, accept }) {
|
|
688
|
+
if (!("signedDelegateAction" in payload)) {
|
|
689
|
+
return { ok: false, error: "signature_invalid", detail: "NEAR exact expects a { signedDelegateAction } payload." };
|
|
690
|
+
}
|
|
691
|
+
let relayerWallet;
|
|
692
|
+
try {
|
|
693
|
+
relayerWallet = resolveNearWallet(relayer._native);
|
|
694
|
+
} catch (err) {
|
|
695
|
+
throw new SettlementError(
|
|
696
|
+
`NEAR exact settle: the relayer wallet is invalid (${err instanceof Error ? err.message : String(err)}).`,
|
|
697
|
+
{ cause: err }
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
const relayerAccount = new Account(relayerWallet.accountId, provider, relayerWallet.signer);
|
|
701
|
+
const isSuccess = (s) => typeof s === "object" && s !== null && "SuccessValue" in s;
|
|
702
|
+
const client = {
|
|
703
|
+
async currentBlockHeight() {
|
|
704
|
+
try {
|
|
705
|
+
const b = await provider.viewBlock({ finality: "final" });
|
|
706
|
+
return b.header?.height != null ? BigInt(b.header.height) : null;
|
|
707
|
+
} catch {
|
|
708
|
+
return null;
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
async relay({ senderId, delegateAction, signature }) {
|
|
712
|
+
const outcome = await relayerAccount.signAndSendTransaction({
|
|
713
|
+
receiverId: senderId,
|
|
714
|
+
actions: [actions2.signedDelegate({ delegateAction, signature })],
|
|
715
|
+
waitUntil: "FINAL"
|
|
716
|
+
});
|
|
717
|
+
const txHash = outcome.transaction?.hash ?? "";
|
|
718
|
+
const tokenReceipt = (outcome.receipts_outcome ?? []).find((r) => r.outcome?.executor_id === accept.asset);
|
|
719
|
+
const innerSuccess = tokenReceipt ? isSuccess(tokenReceipt.outcome?.status) : isSuccess(outcome.status);
|
|
720
|
+
return { txHash, innerSuccess };
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
return verifyAndSettleExactNear({ client, payload, accept });
|
|
448
724
|
}
|
|
449
725
|
};
|
|
450
726
|
}
|
|
@@ -456,10 +732,10 @@ function decodeRef(ref) {
|
|
|
456
732
|
if (i < 0) return { senderId: "", hash: ref };
|
|
457
733
|
return { senderId: ref.slice(0, i), hash: ref.slice(i + 1) };
|
|
458
734
|
}
|
|
459
|
-
function sumTransferDeposits(
|
|
460
|
-
if (!Array.isArray(
|
|
735
|
+
function sumTransferDeposits(actions3) {
|
|
736
|
+
if (!Array.isArray(actions3)) return 0n;
|
|
461
737
|
let sum = 0n;
|
|
462
|
-
for (const a of
|
|
738
|
+
for (const a of actions3) {
|
|
463
739
|
const t = a.Transfer ?? a.transfer;
|
|
464
740
|
if (t && t.deposit != null) {
|
|
465
741
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@piprail/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Accept x402 crypto payments across 29 chains — every major EVM chain plus Solana, TON, Tron, NEAR, Sui, Aptos, Algorand, Stellar & XRPL — in a couple of lines. No backend, no database, no fee; payments settle straight to your wallet.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"@ton/crypto": ">=3 <4",
|
|
87
87
|
"@ton/ton": ">=15 <17",
|
|
88
88
|
"algosdk": ">=3 <4",
|
|
89
|
+
"borsh": ">=2 <3",
|
|
89
90
|
"bs58": "^5.0.0",
|
|
90
91
|
"near-api-js": ">=7 <8",
|
|
91
92
|
"tronweb": ">=6 <7",
|
|
@@ -131,6 +132,9 @@
|
|
|
131
132
|
},
|
|
132
133
|
"algosdk": {
|
|
133
134
|
"optional": true
|
|
135
|
+
},
|
|
136
|
+
"borsh": {
|
|
137
|
+
"optional": true
|
|
134
138
|
}
|
|
135
139
|
},
|
|
136
140
|
"devDependencies": {
|
|
@@ -144,6 +148,7 @@
|
|
|
144
148
|
"@ton/ton": "^16.2.4",
|
|
145
149
|
"@types/node": "^22.10.0",
|
|
146
150
|
"algosdk": "^3.5.2",
|
|
151
|
+
"borsh": "^2.0.0",
|
|
147
152
|
"bs58": "^5.0.0",
|
|
148
153
|
"near-api-js": "^7.2.0",
|
|
149
154
|
"tronweb": "^6.3.0",
|