@toon-protocol/client 4.1.0 → 4.1.2
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-4WH4G747.js → chunk-2FCRHYFJ.js} +23 -4
- package/dist/{chunk-4WH4G747.js.map → chunk-2FCRHYFJ.js.map} +1 -1
- package/dist/cli/main.js +1 -1
- package/dist/{client-GAU5TOT4.js → client-66Z6WVBV.js} +2 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +1 -1
- package/package.json +1 -1
- /package/dist/{client-GAU5TOT4.js.map → client-66Z6WVBV.js.map} +0 -0
|
@@ -6497,7 +6497,9 @@ async function signErc20ApprovalGasSponsoring(params) {
|
|
|
6497
6497
|
}
|
|
6498
6498
|
};
|
|
6499
6499
|
}
|
|
6500
|
-
|
|
6500
|
+
var VISIBLE_WITHIN_MS = 3e4;
|
|
6501
|
+
var POLL_INTERVAL_MS = 1e3;
|
|
6502
|
+
async function approvePermit2(wallet, token, seen) {
|
|
6501
6503
|
const hash = await wallet.writeContract({
|
|
6502
6504
|
address: getAddress2(token),
|
|
6503
6505
|
abi: ERC20_PERMIT2_ABI,
|
|
@@ -6505,6 +6507,17 @@ async function approvePermit2(wallet, token) {
|
|
|
6505
6507
|
args: [PERMIT2_ADDRESS, maxUint256]
|
|
6506
6508
|
});
|
|
6507
6509
|
await landed(wallet, hash, "the Permit2 approval");
|
|
6510
|
+
if (seen) {
|
|
6511
|
+
const deadline = Date.now() + VISIBLE_WITHIN_MS;
|
|
6512
|
+
while (await permit2Allowance(seen.reader, token, seen.owner) < seen.atLeast) {
|
|
6513
|
+
if (Date.now() >= deadline) {
|
|
6514
|
+
throw new NetworkError(
|
|
6515
|
+
`the Permit2 approval ${hash} landed, but the RPC did not show it within ${VISIBLE_WITHIN_MS / 1e3} s`
|
|
6516
|
+
);
|
|
6517
|
+
}
|
|
6518
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));
|
|
6519
|
+
}
|
|
6520
|
+
}
|
|
6508
6521
|
return hash;
|
|
6509
6522
|
}
|
|
6510
6523
|
function erc3009CollectorData(payload) {
|
|
@@ -7191,7 +7204,11 @@ var BatchSettlementPayer = class {
|
|
|
7191
7204
|
);
|
|
7192
7205
|
}
|
|
7193
7206
|
await this.payOwnGas(evm, `a one-time Permit2 approval of ${offer.asset}`, facilitatorUrl);
|
|
7194
|
-
await approvePermit2(this.requireWallet(evm), offer.asset
|
|
7207
|
+
await approvePermit2(this.requireWallet(evm), offer.asset, {
|
|
7208
|
+
reader: evm.reader,
|
|
7209
|
+
owner: evm.account.address,
|
|
7210
|
+
atLeast: amount
|
|
7211
|
+
});
|
|
7195
7212
|
}
|
|
7196
7213
|
}
|
|
7197
7214
|
}
|
|
@@ -7203,7 +7220,9 @@ var BatchSettlementPayer = class {
|
|
|
7203
7220
|
try {
|
|
7204
7221
|
await settleDeposit({
|
|
7205
7222
|
facilitatorUrl,
|
|
7206
|
-
|
|
7223
|
+
// The facilitator checks the payload against the requirements' method,
|
|
7224
|
+
// so they name the one signed, which the caller may have overridden.
|
|
7225
|
+
offer: { ...offer, extra: { ...offer.extra, assetTransferMethod: method } },
|
|
7207
7226
|
payload,
|
|
7208
7227
|
...extensions ? { extensions } : {},
|
|
7209
7228
|
...this.config.fetch ? { fetchImpl: this.config.fetch } : {}
|
|
@@ -8729,4 +8748,4 @@ export {
|
|
|
8729
8748
|
toEnvelopeRequest,
|
|
8730
8749
|
ToonClient
|
|
8731
8750
|
};
|
|
8732
|
-
//# sourceMappingURL=chunk-
|
|
8751
|
+
//# sourceMappingURL=chunk-2FCRHYFJ.js.map
|