multicoyn-sdk 0.1.9 → 0.1.10
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/{ccip-DpYR9KrU.cjs → ccip-C24Kx7fL.cjs} +1 -1
- package/dist/{ccip-DIsMfc62.js → ccip-RHKXqG9a.js} +1 -1
- package/dist/components/PaymentModal.d.ts +2 -1
- package/dist/constants/payment.d.ts +6 -0
- package/dist/index-BYCRbJsO.cjs +34 -0
- package/dist/{index-BqTi7WKI.js → index-CKIs5Pi7.js} +1211 -1167
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/multicoyn-sdk.css +1 -1
- package/package.json +1 -1
- package/dist/index-DqlG-QlC.cjs +0 -34
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as u, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useWriteContract as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { parseUnits as
|
|
6
|
-
import { QueryClientProvider as
|
|
7
|
-
import { getDefaultConfig as
|
|
1
|
+
import { jsx as u, jsxs as x, Fragment as mr } from "react/jsx-runtime";
|
|
2
|
+
import { useState as G, useMemo as yr, useEffect as ve, createContext as br, useContext as hr } from "react";
|
|
3
|
+
import { useWriteContract as xt, useWaitForTransactionReceipt as Tt, useReadContract as z, useAccount as He, useConfig as gr, useBalance as wr, useConnect as xr, WagmiProvider as Tr } from "wagmi";
|
|
4
|
+
import { createPortal as vr } from "react-dom";
|
|
5
|
+
import { parseUnits as Er, maxUint256 as Pr, formatUnits as Ce, defineChain as Sr } from "viem";
|
|
6
|
+
import { QueryClientProvider as Ar, QueryClient as $r } from "@tanstack/react-query";
|
|
7
|
+
import { getDefaultConfig as Cr, RainbowKitProvider as kr } from "@rainbow-me/rainbowkit";
|
|
8
8
|
const O = {
|
|
9
9
|
PAYMENT_ROUTER: "0x73Dbc7447E3B097cFc8b08ee7896a9D27D67e2B4",
|
|
10
10
|
TOKEN_REGISTRY: "0x1d2C6dfB2f127d6F3c14859c9E54cbc27bd7FcCE"
|
|
@@ -17,7 +17,7 @@ const O = {
|
|
|
17
17
|
WBTC: "0x1BEC7ec7F995B9bcd93F411B2cE7d289C6b05f03",
|
|
18
18
|
// Settlement Tokens
|
|
19
19
|
IDRX: "0x39B9205cDC53114c0B0F22F04C1215A13197b4d9"
|
|
20
|
-
}, kr = /* @__PURE__ */ JSON.parse('[{"inputs":[{"internalType":"address","name":"_tokenRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CashbackSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"CollectedTokensWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"EmergencyPoolWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"merchant","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MerchantSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newMinimum","type":"uint256"}],"name":"MinimumPoolBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"paymentId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"merchant","type":"address"},{"indexed":true,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalPaidUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"excessUSD","type":"uint256"},{"indexed":false,"internalType":"bool","name":"settleInIDR","type":"bool"},{"indexed":false,"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cashbackAmount","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"externalCallSuccess","type":"bool"}],"name":"PaymentExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SettlementPoolFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"idrx","type":"address"},{"indexed":true,"internalType":"address","name":"usdt","type":"address"}],"name":"SettlementTokensUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"FEE_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IDRX_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_CASHBACK_USD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDT_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"calculateTotalValue","outputs":[{"internalType":"uint256","name":"totalUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateUSDValue","outputs":[{"internalType":"uint256","name":"usdValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collectedBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdrawPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fundSettlementPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getCollectedBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"paymentId","type":"bytes32"}],"name":"getPayment","outputs":[{"components":[{"internalType":"address","name":"merchant","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"uint256","name":"totalPaidUSD","type":"uint256"},{"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"internalType":"uint256","name":"feeUSD","type":"uint256"},{"internalType":"uint256","name":"excessUSD","type":"uint256"},{"internalType":"bool","name":"settleInIDR","type":"bool"},{"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"internalType":"uint256","name":"cashbackAmount","type":"uint256"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct IPaymentRouter.Payment","name":"payment","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getSettlementPoolBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minimumPoolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"merchantAddress","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"internalType":"bool","name":"settleInIDR","type":"bool"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"pay","outputs":[{"internalType":"bytes32","name":"paymentId","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"setMinimumPoolBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_idrx","type":"address"},{"internalType":"address","name":"_usdt","type":"address"}],"name":"setSettlementTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"settlementPools","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"contract ITokenRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"expectedUSD","type":"uint256"}],"name":"validatePayment","outputs":[{"internalType":"bool","name":"valid","type":"bool"},{"internalType":"uint256","name":"actualUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawCollectedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]'), Ir = [
|
|
20
|
+
}, Ir = /* @__PURE__ */ JSON.parse('[{"inputs":[{"internalType":"address","name":"_tokenRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CashbackSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"CollectedTokensWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"}],"name":"EmergencyPoolWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"merchant","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MerchantSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"newMinimum","type":"uint256"}],"name":"MinimumPoolBalanceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"paymentId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"merchant","type":"address"},{"indexed":true,"internalType":"address","name":"payer","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalPaidUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeUSD","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"excessUSD","type":"uint256"},{"indexed":false,"internalType":"bool","name":"settleInIDR","type":"bool"},{"indexed":false,"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cashbackAmount","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"tokens","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bool","name":"externalCallSuccess","type":"bool"}],"name":"PaymentExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SettlementPoolFunded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"idrx","type":"address"},{"indexed":true,"internalType":"address","name":"usdt","type":"address"}],"name":"SettlementTokensUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"FEE_BASIS_POINTS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IDRX_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_CASHBACK_USD","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"USDT_TOKEN","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"calculateTotalValue","outputs":[{"internalType":"uint256","name":"totalUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"calculateUSDValue","outputs":[{"internalType":"uint256","name":"usdValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collectedBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdrawPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"fundSettlementPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getCollectedBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"paymentId","type":"bytes32"}],"name":"getPayment","outputs":[{"components":[{"internalType":"address","name":"merchant","type":"address"},{"internalType":"address","name":"payer","type":"address"},{"internalType":"uint256","name":"totalPaidUSD","type":"uint256"},{"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"internalType":"uint256","name":"feeUSD","type":"uint256"},{"internalType":"uint256","name":"excessUSD","type":"uint256"},{"internalType":"bool","name":"settleInIDR","type":"bool"},{"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"internalType":"uint256","name":"cashbackAmount","type":"uint256"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"internalType":"struct IPaymentRouter.Payment","name":"payment","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getSettlementPoolBalance","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minimumPoolBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"merchantAddress","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"productPriceUSD","type":"uint256"},{"internalType":"bool","name":"settleInIDR","type":"bool"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"}],"name":"pay","outputs":[{"internalType":"bytes32","name":"paymentId","type":"bytes32"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"setMinimumPoolBalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_idrx","type":"address"},{"internalType":"address","name":"_usdt","type":"address"}],"name":"setSettlementTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"settlementPools","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenRegistry","outputs":[{"internalType":"contract ITokenRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"},{"internalType":"uint256","name":"expectedUSD","type":"uint256"}],"name":"validatePayment","outputs":[{"internalType":"bool","name":"valid","type":"bool"},{"internalType":"uint256","name":"actualUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawCollectedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]'), Nr = [
|
|
21
21
|
{
|
|
22
22
|
inputs: [],
|
|
23
23
|
stateMutability: "nonpayable",
|
|
@@ -499,7 +499,7 @@ const O = {
|
|
|
499
499
|
stateMutability: "nonpayable",
|
|
500
500
|
type: "function"
|
|
501
501
|
}
|
|
502
|
-
],
|
|
502
|
+
], Rr = [
|
|
503
503
|
{
|
|
504
504
|
inputs: [],
|
|
505
505
|
stateMutability: "nonpayable",
|
|
@@ -918,95 +918,95 @@ const O = {
|
|
|
918
918
|
stateMutability: "nonpayable",
|
|
919
919
|
type: "function"
|
|
920
920
|
}
|
|
921
|
-
],
|
|
922
|
-
function
|
|
923
|
-
const { writeContract: e, data: t, isPending: n, error: r } =
|
|
921
|
+
], Oe = Ir, J = Nr, q = Rr;
|
|
922
|
+
function vt() {
|
|
923
|
+
const { writeContract: e, data: t, isPending: n, error: r } = xt(), { isLoading: s, isSuccess: a } = Tt({
|
|
924
924
|
hash: t
|
|
925
925
|
});
|
|
926
926
|
return {
|
|
927
927
|
// Write functions
|
|
928
|
-
registerToken: (
|
|
928
|
+
registerToken: (h, g, S, I) => {
|
|
929
929
|
e({
|
|
930
930
|
address: O.TOKEN_REGISTRY,
|
|
931
|
-
abi:
|
|
931
|
+
abi: J,
|
|
932
932
|
functionName: "registerToken",
|
|
933
|
-
args: [
|
|
933
|
+
args: [h, g, S, I]
|
|
934
934
|
});
|
|
935
935
|
},
|
|
936
|
-
setTokenEnabled: (
|
|
936
|
+
setTokenEnabled: (h, g) => {
|
|
937
937
|
e({
|
|
938
938
|
address: O.TOKEN_REGISTRY,
|
|
939
|
-
abi:
|
|
939
|
+
abi: J,
|
|
940
940
|
functionName: "setTokenEnabled",
|
|
941
|
-
args: [
|
|
941
|
+
args: [h, g]
|
|
942
942
|
});
|
|
943
943
|
},
|
|
944
|
-
updatePriceFeed: (
|
|
944
|
+
updatePriceFeed: (h, g) => {
|
|
945
945
|
e({
|
|
946
946
|
address: O.TOKEN_REGISTRY,
|
|
947
|
-
abi:
|
|
947
|
+
abi: J,
|
|
948
948
|
functionName: "updatePriceFeed",
|
|
949
|
-
args: [
|
|
949
|
+
args: [h, g]
|
|
950
950
|
});
|
|
951
951
|
},
|
|
952
|
-
setMinPaymentAmount: (
|
|
952
|
+
setMinPaymentAmount: (h, g) => {
|
|
953
953
|
e({
|
|
954
954
|
address: O.TOKEN_REGISTRY,
|
|
955
|
-
abi:
|
|
955
|
+
abi: J,
|
|
956
956
|
functionName: "setMinPaymentAmount",
|
|
957
|
-
args: [
|
|
957
|
+
args: [h, g]
|
|
958
958
|
});
|
|
959
959
|
},
|
|
960
|
-
grantRole: (
|
|
960
|
+
grantRole: (h, g) => {
|
|
961
961
|
e({
|
|
962
962
|
address: O.TOKEN_REGISTRY,
|
|
963
|
-
abi:
|
|
963
|
+
abi: J,
|
|
964
964
|
functionName: "grantRole",
|
|
965
|
-
args: [
|
|
965
|
+
args: [h, g]
|
|
966
966
|
});
|
|
967
967
|
},
|
|
968
|
-
revokeRole: (
|
|
968
|
+
revokeRole: (h, g) => {
|
|
969
969
|
e({
|
|
970
970
|
address: O.TOKEN_REGISTRY,
|
|
971
|
-
abi:
|
|
971
|
+
abi: J,
|
|
972
972
|
functionName: "revokeRole",
|
|
973
|
-
args: [
|
|
973
|
+
args: [h, g]
|
|
974
974
|
});
|
|
975
975
|
},
|
|
976
976
|
// Read hooks
|
|
977
|
-
useGetTokenConfig: (
|
|
977
|
+
useGetTokenConfig: (h) => z({
|
|
978
978
|
address: O.TOKEN_REGISTRY,
|
|
979
|
-
abi:
|
|
979
|
+
abi: J,
|
|
980
980
|
functionName: "getTokenConfig",
|
|
981
|
-
args: [
|
|
981
|
+
args: [h]
|
|
982
982
|
}),
|
|
983
|
-
useGetTokenPrice: (
|
|
983
|
+
useGetTokenPrice: (h) => z({
|
|
984
984
|
address: O.TOKEN_REGISTRY,
|
|
985
|
-
abi:
|
|
985
|
+
abi: J,
|
|
986
986
|
functionName: "getTokenPriceUSD",
|
|
987
|
-
args: [
|
|
987
|
+
args: [h]
|
|
988
988
|
}),
|
|
989
|
-
useGetRegisteredTokens: () =>
|
|
989
|
+
useGetRegisteredTokens: () => z({
|
|
990
990
|
address: O.TOKEN_REGISTRY,
|
|
991
|
-
abi:
|
|
991
|
+
abi: J,
|
|
992
992
|
functionName: "getRegisteredTokens"
|
|
993
993
|
}),
|
|
994
|
-
useGetRegisteredTokenCount: () =>
|
|
994
|
+
useGetRegisteredTokenCount: () => z({
|
|
995
995
|
address: O.TOKEN_REGISTRY,
|
|
996
|
-
abi:
|
|
996
|
+
abi: J,
|
|
997
997
|
functionName: "getRegisteredTokenCount"
|
|
998
998
|
}),
|
|
999
|
-
useIsTokenEnabled: (
|
|
999
|
+
useIsTokenEnabled: (h) => z({
|
|
1000
1000
|
address: O.TOKEN_REGISTRY,
|
|
1001
|
-
abi:
|
|
1001
|
+
abi: J,
|
|
1002
1002
|
functionName: "isTokenEnabled",
|
|
1003
|
-
args: [
|
|
1003
|
+
args: [h]
|
|
1004
1004
|
}),
|
|
1005
|
-
useHasRole: (
|
|
1005
|
+
useHasRole: (h, g) => z({
|
|
1006
1006
|
address: O.TOKEN_REGISTRY,
|
|
1007
|
-
abi:
|
|
1007
|
+
abi: J,
|
|
1008
1008
|
functionName: "hasRole",
|
|
1009
|
-
args: [
|
|
1009
|
+
args: [h, g]
|
|
1010
1010
|
}),
|
|
1011
1011
|
// Transaction state
|
|
1012
1012
|
hash: t,
|
|
@@ -1016,17 +1016,47 @@ function Tt() {
|
|
|
1016
1016
|
error: r
|
|
1017
1017
|
};
|
|
1018
1018
|
}
|
|
1019
|
-
const
|
|
1019
|
+
const go = 30, wo = 3e-3, xo = 5, Mr = 8, Dr = 10 ** Mr, To = BigInt(
|
|
1020
1020
|
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
|
1021
|
-
),
|
|
1022
|
-
ETH: {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1021
|
+
), D = {
|
|
1022
|
+
ETH: {
|
|
1023
|
+
symbol: "ETH",
|
|
1024
|
+
decimals: 18,
|
|
1025
|
+
name: "Ether",
|
|
1026
|
+
logo: "https://cryptologos.cc/logos/ethereum-eth-logo.svg"
|
|
1027
|
+
},
|
|
1028
|
+
USDC: {
|
|
1029
|
+
symbol: "USDC",
|
|
1030
|
+
decimals: 6,
|
|
1031
|
+
name: "USD Coin",
|
|
1032
|
+
logo: "https://cryptologos.cc/logos/usd-coin-usdc-logo.svg"
|
|
1033
|
+
},
|
|
1034
|
+
USDT: {
|
|
1035
|
+
symbol: "USDT",
|
|
1036
|
+
decimals: 6,
|
|
1037
|
+
name: "Tether USD",
|
|
1038
|
+
logo: "https://cryptologos.cc/logos/tether-usdt-logo.svg"
|
|
1039
|
+
},
|
|
1040
|
+
DAI: {
|
|
1041
|
+
symbol: "DAI",
|
|
1042
|
+
decimals: 18,
|
|
1043
|
+
name: "Dai Stablecoin",
|
|
1044
|
+
logo: "https://cryptologos.cc/logos/multi-collateral-dai-dai-logo.svg"
|
|
1045
|
+
},
|
|
1046
|
+
WBTC: {
|
|
1047
|
+
symbol: "WBTC",
|
|
1048
|
+
decimals: 8,
|
|
1049
|
+
name: "Wrapped Bitcoin",
|
|
1050
|
+
logo: "https://cryptologos.cc/logos/wrapped-bitcoin-wbtc-logo.svg"
|
|
1051
|
+
},
|
|
1052
|
+
IDRX: {
|
|
1053
|
+
symbol: "IDRX",
|
|
1054
|
+
decimals: 18,
|
|
1055
|
+
name: "Indonesian Rupiah",
|
|
1056
|
+
logo: "https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/info/logo.png"
|
|
1057
|
+
}
|
|
1028
1058
|
};
|
|
1029
|
-
function
|
|
1059
|
+
function Et(e) {
|
|
1030
1060
|
if (!e) return "USDT";
|
|
1031
1061
|
switch (e.toUpperCase()) {
|
|
1032
1062
|
case "IDR":
|
|
@@ -1041,7 +1071,7 @@ function be(e, t = 2) {
|
|
|
1041
1071
|
const n = e.toFixed(t), [r, s] = n.split("."), a = r.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
1042
1072
|
return s ? `${a}.${s}` : a;
|
|
1043
1073
|
}
|
|
1044
|
-
function
|
|
1074
|
+
function Or({ size: e = 26, className: t = "" }) {
|
|
1045
1075
|
return /* @__PURE__ */ u(
|
|
1046
1076
|
"svg",
|
|
1047
1077
|
{
|
|
@@ -1064,8 +1094,8 @@ function Dr({ size: e = 26, className: t = "" }) {
|
|
|
1064
1094
|
}
|
|
1065
1095
|
);
|
|
1066
1096
|
}
|
|
1067
|
-
function
|
|
1068
|
-
return /* @__PURE__ */
|
|
1097
|
+
function Br({ size: e = 16, className: t = "" }) {
|
|
1098
|
+
return /* @__PURE__ */ x(
|
|
1069
1099
|
"svg",
|
|
1070
1100
|
{
|
|
1071
1101
|
width: e,
|
|
@@ -1099,8 +1129,8 @@ function Or({ size: e = 16, className: t = "" }) {
|
|
|
1099
1129
|
}
|
|
1100
1130
|
);
|
|
1101
1131
|
}
|
|
1102
|
-
function
|
|
1103
|
-
return /* @__PURE__ */
|
|
1132
|
+
function Ur({ size: e = 16, className: t = "" }) {
|
|
1133
|
+
return /* @__PURE__ */ x(
|
|
1104
1134
|
"svg",
|
|
1105
1135
|
{
|
|
1106
1136
|
width: e,
|
|
@@ -1144,11 +1174,11 @@ function Br({ size: e = 16, className: t = "" }) {
|
|
|
1144
1174
|
}
|
|
1145
1175
|
);
|
|
1146
1176
|
}
|
|
1147
|
-
function
|
|
1177
|
+
function Lr({
|
|
1148
1178
|
size: e = 134,
|
|
1149
1179
|
className: t = ""
|
|
1150
1180
|
}) {
|
|
1151
|
-
return /* @__PURE__ */
|
|
1181
|
+
return /* @__PURE__ */ x(
|
|
1152
1182
|
"svg",
|
|
1153
1183
|
{
|
|
1154
1184
|
width: e,
|
|
@@ -1162,7 +1192,7 @@ function Ur({
|
|
|
1162
1192
|
/* @__PURE__ */ u("circle", { cx: "67", cy: "66", r: "45", fill: "#5EEAD4", fillOpacity: "0.3" }),
|
|
1163
1193
|
/* @__PURE__ */ u("rect", { x: "35", y: "30", width: "45", height: "72", rx: "4", fill: "#14B8A6" }),
|
|
1164
1194
|
/* @__PURE__ */ u("rect", { x: "38", y: "35", width: "39", height: "55", rx: "2", fill: "#0D9488" }),
|
|
1165
|
-
/* @__PURE__ */
|
|
1195
|
+
/* @__PURE__ */ x("g", { className: "animate-pulse", children: [
|
|
1166
1196
|
/* @__PURE__ */ u("rect", { x: "55", y: "50", width: "50", height: "32", rx: "3", fill: "#1E293B" }),
|
|
1167
1197
|
/* @__PURE__ */ u("rect", { x: "60", y: "56", width: "20", height: "3", rx: "1", fill: "#475569" }),
|
|
1168
1198
|
/* @__PURE__ */ u("rect", { x: "60", y: "62", width: "30", height: "2", rx: "1", fill: "#475569" }),
|
|
@@ -1179,8 +1209,8 @@ function Ur({
|
|
|
1179
1209
|
}
|
|
1180
1210
|
);
|
|
1181
1211
|
}
|
|
1182
|
-
function
|
|
1183
|
-
return /* @__PURE__ */
|
|
1212
|
+
function Fr({ size: e = 95, className: t = "" }) {
|
|
1213
|
+
return /* @__PURE__ */ x(
|
|
1184
1214
|
"svg",
|
|
1185
1215
|
{
|
|
1186
1216
|
width: e * 2.1,
|
|
@@ -1212,7 +1242,7 @@ function Lr({ size: e = 95, className: t = "" }) {
|
|
|
1212
1242
|
),
|
|
1213
1243
|
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "38", stroke: "#22C55E", strokeWidth: "2", strokeOpacity: "0.3" }),
|
|
1214
1244
|
/* @__PURE__ */ u("circle", { cx: "100", cy: "47", r: "42", stroke: "#22C55E", strokeWidth: "1", strokeOpacity: "0.2" }),
|
|
1215
|
-
/* @__PURE__ */ u("defs", { children: /* @__PURE__ */
|
|
1245
|
+
/* @__PURE__ */ u("defs", { children: /* @__PURE__ */ x("linearGradient", { id: "successGradient", x1: "65", y1: "12", x2: "135", y2: "82", gradientUnits: "userSpaceOnUse", children: [
|
|
1216
1246
|
/* @__PURE__ */ u("stop", { stopColor: "#4ADE80" }),
|
|
1217
1247
|
/* @__PURE__ */ u("stop", { offset: "1", stopColor: "#16A34A" })
|
|
1218
1248
|
] }) })
|
|
@@ -1220,21 +1250,21 @@ function Lr({ size: e = 95, className: t = "" }) {
|
|
|
1220
1250
|
}
|
|
1221
1251
|
);
|
|
1222
1252
|
}
|
|
1223
|
-
function
|
|
1253
|
+
function jr({
|
|
1224
1254
|
items: e,
|
|
1225
1255
|
fee: t = 0.3,
|
|
1226
1256
|
currency: n
|
|
1227
1257
|
}) {
|
|
1228
|
-
const s = e.reduce((i, o) => i + o.price, 0) + t, a =
|
|
1229
|
-
return /* @__PURE__ */
|
|
1258
|
+
const s = e.reduce((i, o) => i + o.price, 0) + t, a = Et(n);
|
|
1259
|
+
return /* @__PURE__ */ x("div", { className: "mc:bg-dark-4 mc:rounded-md mc:p-3 mc:flex mc:flex-col mc:gap-3 mc:w-full", children: [
|
|
1230
1260
|
/* @__PURE__ */ u("p", { className: "mc:font-medium mc:text-sm mc:sm:text-base mc:text-white mc:break-words", children: "Payment Summary" }),
|
|
1231
|
-
e.map((i, o) => /* @__PURE__ */
|
|
1261
|
+
e.map((i, o) => /* @__PURE__ */ x(
|
|
1232
1262
|
"div",
|
|
1233
1263
|
{
|
|
1234
1264
|
className: "mc:flex mc:items-center mc:justify-between mc:text-xs mc:text-white mc:gap-2",
|
|
1235
1265
|
children: [
|
|
1236
1266
|
/* @__PURE__ */ u("span", { className: "mc:flex-1 mc:min-w-0 mc:break-words", children: i.name }),
|
|
1237
|
-
/* @__PURE__ */
|
|
1267
|
+
/* @__PURE__ */ x("span", { className: "mc:text-right mc:flex-shrink-0", children: [
|
|
1238
1268
|
be(i.price),
|
|
1239
1269
|
" ",
|
|
1240
1270
|
a
|
|
@@ -1243,18 +1273,18 @@ function Fr({
|
|
|
1243
1273
|
},
|
|
1244
1274
|
o
|
|
1245
1275
|
)),
|
|
1246
|
-
/* @__PURE__ */
|
|
1276
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:justify-between mc:text-xs mc:text-white mc:gap-2", children: [
|
|
1247
1277
|
/* @__PURE__ */ u("span", { className: "mc:flex-1", children: "Fee" }),
|
|
1248
|
-
/* @__PURE__ */
|
|
1278
|
+
/* @__PURE__ */ x("span", { className: "mc:text-right mc:flex-shrink-0", children: [
|
|
1249
1279
|
be(t),
|
|
1250
1280
|
" ",
|
|
1251
1281
|
a
|
|
1252
1282
|
] })
|
|
1253
1283
|
] }),
|
|
1254
1284
|
/* @__PURE__ */ u("div", { className: "mc:h-px mc:bg-white/20" }),
|
|
1255
|
-
/* @__PURE__ */
|
|
1285
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:justify-between mc:text-white mc:gap-2", children: [
|
|
1256
1286
|
/* @__PURE__ */ u("span", { className: "mc:text-xs", children: "Total Payment" }),
|
|
1257
|
-
/* @__PURE__ */
|
|
1287
|
+
/* @__PURE__ */ x("span", { className: "mc:text-sm mc:sm:text-base mc:font-semibold mc:text-right mc:break-words", children: [
|
|
1258
1288
|
be(s),
|
|
1259
1289
|
" ",
|
|
1260
1290
|
a
|
|
@@ -1262,7 +1292,7 @@ function Fr({
|
|
|
1262
1292
|
] })
|
|
1263
1293
|
] });
|
|
1264
1294
|
}
|
|
1265
|
-
function
|
|
1295
|
+
function zr({
|
|
1266
1296
|
token: e,
|
|
1267
1297
|
onChange: t,
|
|
1268
1298
|
totalAmount: n,
|
|
@@ -1270,12 +1300,12 @@ function jr({
|
|
|
1270
1300
|
currency: s,
|
|
1271
1301
|
disabled: a = !1
|
|
1272
1302
|
}) {
|
|
1273
|
-
const i = (
|
|
1274
|
-
t(Number(
|
|
1275
|
-
}, o = n * e.percentage / 100, c = e.priceUSD > 0 ? o / e.priceUSD : 0, d = c <= e.amount, l = e.priceUSD > 0,
|
|
1276
|
-
return /* @__PURE__ */
|
|
1277
|
-
/* @__PURE__ */
|
|
1278
|
-
/* @__PURE__ */
|
|
1303
|
+
const i = (b) => {
|
|
1304
|
+
t(Number(b.target.value));
|
|
1305
|
+
}, o = n * e.percentage / 100, c = e.priceUSD > 0 ? o / e.priceUSD : 0, d = c <= e.amount, l = e.priceUSD > 0, m = Et(s), p = (r ?? n) * e.percentage / 100;
|
|
1306
|
+
return /* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:gap-1.5 mc:sm:gap-2 mc:w-full mc:flex-wrap", children: [
|
|
1307
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:gap-2 mc:sm:gap-3 mc:min-w-0 mc:flex-1 mc:sm:flex-initial", children: [
|
|
1308
|
+
/* @__PURE__ */ x("div", { className: "mc:relative mc:size-[30px] mc:shrink-0", children: [
|
|
1279
1309
|
/* @__PURE__ */ u(
|
|
1280
1310
|
"div",
|
|
1281
1311
|
{
|
|
@@ -1285,7 +1315,7 @@ function jr({
|
|
|
1285
1315
|
{
|
|
1286
1316
|
src: e.tokenIcon,
|
|
1287
1317
|
alt: e.name,
|
|
1288
|
-
className: "mc:size-full mc:object-
|
|
1318
|
+
className: "mc:size-full mc:object-contain"
|
|
1289
1319
|
}
|
|
1290
1320
|
) : /* @__PURE__ */ u("span", { className: "mc:text-xs mc:font-semibold mc:text-white", children: e.symbol.slice(0, 2) })
|
|
1291
1321
|
}
|
|
@@ -1299,9 +1329,9 @@ function jr({
|
|
|
1299
1329
|
}
|
|
1300
1330
|
) : /* @__PURE__ */ u("span", { className: "mc:text-[6px] mc:font-semibold mc:text-white", children: e.chain.slice(0, 1) }) })
|
|
1301
1331
|
] }),
|
|
1302
|
-
/* @__PURE__ */
|
|
1332
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:flex-col mc:gap-1 mc:text-xs mc:text-white mc:min-w-0", children: [
|
|
1303
1333
|
/* @__PURE__ */ u("span", { className: "mc:font-semibold mc:wrap-break-word", children: e.name }),
|
|
1304
|
-
/* @__PURE__ */
|
|
1334
|
+
/* @__PURE__ */ x("span", { className: "mc:font-normal mc:opacity-75 mc:wrap-break-word", children: [
|
|
1305
1335
|
e.amount.toFixed(4),
|
|
1306
1336
|
" ",
|
|
1307
1337
|
e.symbol
|
|
@@ -1315,7 +1345,7 @@ function jr({
|
|
|
1315
1345
|
)
|
|
1316
1346
|
] })
|
|
1317
1347
|
] }),
|
|
1318
|
-
/* @__PURE__ */
|
|
1348
|
+
/* @__PURE__ */ x(
|
|
1319
1349
|
"div",
|
|
1320
1350
|
{
|
|
1321
1351
|
className: `mc:flex-1 mc:relative mc:h-1.5 mc:min-w-[100px] ${a ? "mc:opacity-50" : ""}`,
|
|
@@ -1343,15 +1373,15 @@ function jr({
|
|
|
1343
1373
|
]
|
|
1344
1374
|
}
|
|
1345
1375
|
),
|
|
1346
|
-
/* @__PURE__ */
|
|
1347
|
-
/* @__PURE__ */
|
|
1376
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:flex-col mc:items-end mc:gap-0.5 mc:min-w-0 mc:w-full mc:sm:w-auto", children: [
|
|
1377
|
+
/* @__PURE__ */ x("span", { className: "mc:text-xs mc:font-semibold mc:text-white mc:text-right mc:wrap-break-word", children: [
|
|
1348
1378
|
e.percentage,
|
|
1349
1379
|
"% = ",
|
|
1350
|
-
be(
|
|
1380
|
+
be(p),
|
|
1351
1381
|
" ",
|
|
1352
|
-
|
|
1382
|
+
m
|
|
1353
1383
|
] }),
|
|
1354
|
-
e.percentage > 0 && /* @__PURE__ */
|
|
1384
|
+
e.percentage > 0 && /* @__PURE__ */ x(
|
|
1355
1385
|
"span",
|
|
1356
1386
|
{
|
|
1357
1387
|
className: `mc:text-[10px] mc:text-right mc:wrap-break-word ${d ? "mc:text-white/60" : "mc:text-red-500"}`,
|
|
@@ -1366,8 +1396,8 @@ function jr({
|
|
|
1366
1396
|
] })
|
|
1367
1397
|
] });
|
|
1368
1398
|
}
|
|
1369
|
-
const
|
|
1370
|
-
function
|
|
1399
|
+
const _r = 1e8;
|
|
1400
|
+
function Gr({
|
|
1371
1401
|
isOpen: e,
|
|
1372
1402
|
onClose: t,
|
|
1373
1403
|
totalAmount: n,
|
|
@@ -1379,196 +1409,202 @@ function _r({
|
|
|
1379
1409
|
transactionHash: c,
|
|
1380
1410
|
isProcessing: d,
|
|
1381
1411
|
isSuccess: l,
|
|
1412
|
+
isError: m,
|
|
1382
1413
|
conversionRate: y = 1
|
|
1383
1414
|
}) {
|
|
1384
|
-
const p =
|
|
1415
|
+
const p = vt(), { data: b } = p.useGetTokenPrice(E.NATIVE), { data: v } = p.useGetTokenPrice(E.USDC), { data: P } = p.useGetTokenPrice(E.USDT), { data: T } = p.useGetTokenPrice(E.DAI), { data: h } = p.useGetTokenPrice(E.WBTC), [g, S] = G([]), [I, Z] = G(""), [B, le] = G(!0), [V, _] = G("form"), [te, W] = G(0), [$, U] = G(""), [N, K] = G([]), [re, L] = G(
|
|
1385
1416
|
"Preparing payment..."
|
|
1386
|
-
),
|
|
1417
|
+
), me = yr(
|
|
1387
1418
|
() => JSON.stringify(
|
|
1388
|
-
a.map((
|
|
1389
|
-
id:
|
|
1390
|
-
amount:
|
|
1391
|
-
priceUSD:
|
|
1419
|
+
a.map((w) => ({
|
|
1420
|
+
id: w.id,
|
|
1421
|
+
amount: w.amount,
|
|
1422
|
+
priceUSD: w.priceUSD
|
|
1392
1423
|
}))
|
|
1393
1424
|
),
|
|
1394
1425
|
[a]
|
|
1395
|
-
),
|
|
1396
|
-
if (!
|
|
1397
|
-
if (Array.isArray(
|
|
1398
|
-
const A =
|
|
1426
|
+
), se = (w) => {
|
|
1427
|
+
if (!w) return 0;
|
|
1428
|
+
if (Array.isArray(w) && w.length >= 1) {
|
|
1429
|
+
const A = w[0];
|
|
1399
1430
|
if (typeof A == "bigint")
|
|
1400
|
-
return Number(A) /
|
|
1431
|
+
return Number(A) / _r;
|
|
1401
1432
|
}
|
|
1402
1433
|
return 0;
|
|
1403
1434
|
};
|
|
1404
1435
|
ve(() => {
|
|
1405
1436
|
if (e && a.length > 0) {
|
|
1406
|
-
const
|
|
1407
|
-
let
|
|
1408
|
-
return A.address === E.NATIVE &&
|
|
1437
|
+
const w = a.map((A) => {
|
|
1438
|
+
let R = A.priceUSD;
|
|
1439
|
+
return A.address === E.NATIVE && b ? R = se(b) : A.address === E.USDC && v ? R = se(v) : A.address === E.USDT && P ? R = se(P) : A.address === E.DAI && T ? R = se(T) : A.address === E.WBTC && h && (R = se(h)), { ...A, priceUSD: R };
|
|
1409
1440
|
});
|
|
1410
|
-
if (
|
|
1411
|
-
|
|
1441
|
+
if (B) {
|
|
1442
|
+
w.forEach((C) => {
|
|
1412
1443
|
C.percentage = 0;
|
|
1413
1444
|
});
|
|
1414
|
-
const A = n + o * n,
|
|
1445
|
+
const A = n + o * n, R = w.filter(
|
|
1415
1446
|
(C) => (C.address === E.USDC || C.address === E.USDT || C.address === E.DAI) && C.amount > 0 && C.priceUSD > 0
|
|
1416
|
-
),
|
|
1447
|
+
), Y = w.filter(
|
|
1417
1448
|
(C) => C.address !== E.USDC && C.address !== E.USDT && C.address !== E.DAI && C.amount > 0 && C.priceUSD > 0
|
|
1418
|
-
), xe =
|
|
1419
|
-
(C,
|
|
1449
|
+
), xe = R.reduce(
|
|
1450
|
+
(C, X) => C + X.amount * X.priceUSD,
|
|
1420
1451
|
0
|
|
1421
1452
|
);
|
|
1422
|
-
if (
|
|
1423
|
-
const C = Math.floor(100 /
|
|
1424
|
-
|
|
1425
|
-
|
|
1453
|
+
if (R.length > 0 && xe >= A) {
|
|
1454
|
+
const C = Math.floor(100 / R.length), X = 100 - C * R.length;
|
|
1455
|
+
R.forEach((De, ye) => {
|
|
1456
|
+
De.percentage = C + (ye === 0 ? X : 0);
|
|
1426
1457
|
});
|
|
1427
|
-
} else if (
|
|
1428
|
-
const C = xe / A * 100,
|
|
1429
|
-
C /
|
|
1458
|
+
} else if (R.length > 0) {
|
|
1459
|
+
const C = xe / A * 100, X = Math.floor(
|
|
1460
|
+
C / R.length
|
|
1430
1461
|
);
|
|
1431
|
-
|
|
1432
|
-
fe.percentage =
|
|
1462
|
+
R.forEach((fe) => {
|
|
1463
|
+
fe.percentage = X;
|
|
1433
1464
|
});
|
|
1434
|
-
const ye = 100 -
|
|
1435
|
-
(fe,
|
|
1465
|
+
const ye = 100 - R.reduce(
|
|
1466
|
+
(fe, Je) => fe + Je.percentage,
|
|
1436
1467
|
0
|
|
1437
1468
|
);
|
|
1438
|
-
if (
|
|
1469
|
+
if (Y.length > 0 && ye > 0) {
|
|
1439
1470
|
const fe = Math.floor(
|
|
1440
|
-
ye /
|
|
1441
|
-
),
|
|
1442
|
-
|
|
1443
|
-
|
|
1471
|
+
ye / Y.length
|
|
1472
|
+
), Je = ye - fe * Y.length;
|
|
1473
|
+
Y.forEach((fr, pr) => {
|
|
1474
|
+
fr.percentage = fe + (pr === 0 ? Je : 0);
|
|
1444
1475
|
});
|
|
1445
1476
|
}
|
|
1446
1477
|
} else {
|
|
1447
|
-
const C =
|
|
1448
|
-
(
|
|
1478
|
+
const C = w.filter(
|
|
1479
|
+
(X) => X.amount > 0 && X.priceUSD > 0
|
|
1449
1480
|
);
|
|
1450
1481
|
if (C.length > 0) {
|
|
1451
|
-
const
|
|
1482
|
+
const X = Math.floor(100 / C.length), De = 100 - X * C.length;
|
|
1452
1483
|
C.forEach((ye, fe) => {
|
|
1453
|
-
ye.percentage =
|
|
1484
|
+
ye.percentage = X + (fe === 0 ? De : 0);
|
|
1454
1485
|
});
|
|
1455
1486
|
}
|
|
1456
1487
|
}
|
|
1457
1488
|
}
|
|
1458
|
-
|
|
1489
|
+
S(w);
|
|
1459
1490
|
}
|
|
1460
1491
|
}, [
|
|
1461
1492
|
e,
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
h,
|
|
1493
|
+
me,
|
|
1494
|
+
b,
|
|
1465
1495
|
v,
|
|
1466
1496
|
P,
|
|
1467
1497
|
T,
|
|
1468
|
-
|
|
1498
|
+
h,
|
|
1499
|
+
B
|
|
1469
1500
|
]), ve(() => {
|
|
1470
|
-
e || (
|
|
1501
|
+
e || (_("form"), W(0), U(""));
|
|
1471
1502
|
}, [e]), ve(() => {
|
|
1472
|
-
l && c ? (
|
|
1473
|
-
}, [
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1503
|
+
l && c ? (W(100), U(c), _("success"), L("Payment completed!")) : d ? (W(80), L("Confirming transaction...")) : m && (_("form"), W(0), L("Preparing payment..."), K([]));
|
|
1504
|
+
}, [
|
|
1505
|
+
l,
|
|
1506
|
+
d,
|
|
1507
|
+
m,
|
|
1508
|
+
c
|
|
1509
|
+
]);
|
|
1510
|
+
const M = g.reduce((w, A) => w + A.percentage, 0), j = Et(r), Me = r === "IDR" ? 1 / y : 1, rr = s.map((w) => ({
|
|
1511
|
+
...w,
|
|
1512
|
+
price: w.price
|
|
1513
|
+
})), Ut = o * n, Ke = n + Ut, sr = Ut * Me, Ye = Ke * Me, Ze = g.some((w) => w.percentage === 0 ? !1 : !w.priceUSD || w.priceUSD <= 0), Xe = g.some((w) => {
|
|
1514
|
+
if (w.percentage === 0) return !1;
|
|
1515
|
+
const A = Ke * w.percentage / 100;
|
|
1516
|
+
return (w.priceUSD > 0 ? A / w.priceUSD : 0) > w.amount;
|
|
1517
|
+
}), ar = (w, A) => {
|
|
1518
|
+
S(
|
|
1519
|
+
(R) => R.map((Y) => Y.id === w ? { ...Y, percentage: A } : Y)
|
|
1484
1520
|
);
|
|
1485
|
-
},
|
|
1486
|
-
if (!
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1489
|
-
(
|
|
1521
|
+
}, ir = () => {
|
|
1522
|
+
if (!B) {
|
|
1523
|
+
const w = g.filter((Y) => Y.amount > 0 && Y.priceUSD > 0), A = Math.floor(100 / w.length), R = 100 - A * w.length;
|
|
1524
|
+
S(
|
|
1525
|
+
(Y) => Y.map((xe, C) => ({
|
|
1490
1526
|
...xe,
|
|
1491
|
-
percentage: xe.amount > 0 && xe.priceUSD > 0 ? A + (C === 0 ?
|
|
1527
|
+
percentage: xe.amount > 0 && xe.priceUSD > 0 ? A + (C === 0 ? R : 0) : 0
|
|
1492
1528
|
}))
|
|
1493
1529
|
);
|
|
1494
1530
|
}
|
|
1495
|
-
|
|
1496
|
-
},
|
|
1497
|
-
(
|
|
1498
|
-
),
|
|
1499
|
-
|
|
1500
|
-
const
|
|
1531
|
+
le(!B);
|
|
1532
|
+
}, or = g.filter(
|
|
1533
|
+
(w) => w.amount > 0 && (w.name.toLowerCase().includes(I.toLowerCase()) || w.symbol.toLowerCase().includes(I.toLowerCase()) || w.chain.toLowerCase().includes(I.toLowerCase()))
|
|
1534
|
+
), cr = async () => {
|
|
1535
|
+
_("processing"), W(10), L("Checking token approvals...");
|
|
1536
|
+
const w = g.filter(
|
|
1501
1537
|
(A) => A.percentage > 0 && A.address !== E.NATIVE
|
|
1502
1538
|
);
|
|
1503
|
-
|
|
1504
|
-
`Requesting approval for ${
|
|
1505
|
-
),
|
|
1506
|
-
},
|
|
1539
|
+
w.length > 0 && (L(
|
|
1540
|
+
`Requesting approval for ${w.length} token(s)...`
|
|
1541
|
+
), K(w.map((A) => A.symbol))), W(30), L("Processing payment..."), i(g), W(60);
|
|
1542
|
+
}, ur = () => {
|
|
1507
1543
|
t();
|
|
1508
|
-
},
|
|
1544
|
+
}, dr = () => (/* @__PURE__ */ new Date()).toLocaleDateString("en-US", {
|
|
1509
1545
|
day: "numeric",
|
|
1510
1546
|
month: "long",
|
|
1511
1547
|
year: "numeric"
|
|
1512
1548
|
});
|
|
1513
1549
|
if (!e) return null;
|
|
1514
|
-
const
|
|
1550
|
+
const lr = /* @__PURE__ */ x("div", { className: "multicoyn-sdk mc:fixed mc:inset-0 mc:z-9999 mc:flex mc:items-center mc:justify-center", children: [
|
|
1515
1551
|
/* @__PURE__ */ u(
|
|
1516
1552
|
"div",
|
|
1517
1553
|
{
|
|
1518
1554
|
className: "mc:absolute mc:inset-0 mc:bg-black/60 mc:backdrop-blur-sm",
|
|
1519
|
-
onClick:
|
|
1555
|
+
onClick: V === "form" ? t : void 0
|
|
1520
1556
|
}
|
|
1521
1557
|
),
|
|
1522
|
-
|
|
1523
|
-
/* @__PURE__ */ u(
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1558
|
+
V === "processing" && /* @__PURE__ */ x("div", { className: "mc:relative mc:bg-dark-2 mc:border mc:border-border mc:rounded-xl mc:p-4 mc:flex mc:flex-col mc:gap-5 mc:items-center mc:justify-center mc:w-full mc:max-w-[400px] mc:min-h-[280px] mc:mx-4 animate-slide-in-right", children: [
|
|
1559
|
+
/* @__PURE__ */ u(Lr, { size: 134 }),
|
|
1560
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:flex-col mc:gap-3 mc:items-center mc:w-full mc:max-w-[300px] mc:px-2", children: [
|
|
1561
|
+
/* @__PURE__ */ x("div", { className: "mc:relative mc:w-full mc:max-w-[234px] mc:h-1.5", children: [
|
|
1526
1562
|
/* @__PURE__ */ u("div", { className: "mc:absolute mc:inset-0 mc:bg-dark-4 mc:rounded-full" }),
|
|
1527
1563
|
/* @__PURE__ */ u(
|
|
1528
1564
|
"div",
|
|
1529
1565
|
{
|
|
1530
1566
|
className: "mc:absolute mc:left-0 mc:top-0 mc:h-full mc:bg-secondary mc:rounded-full mc:transition-all mc:duration-300",
|
|
1531
|
-
style: { width: `${Math.min(
|
|
1567
|
+
style: { width: `${Math.min(te, 100)}%` }
|
|
1532
1568
|
}
|
|
1533
1569
|
)
|
|
1534
1570
|
] }),
|
|
1535
|
-
/* @__PURE__ */ u("p", { className: "mc:text-sm mc:text-white mc:text-center mc:wrap-break-word mc:px-2", children:
|
|
1536
|
-
|
|
1571
|
+
/* @__PURE__ */ u("p", { className: "mc:text-sm mc:text-white mc:text-center mc:wrap-break-word mc:px-2", children: re }),
|
|
1572
|
+
N.length > 0 && /* @__PURE__ */ x("div", { className: "mc:text-xs mc:text-white/60 mc:text-center mc:wrap-break-word mc:px-2", children: [
|
|
1537
1573
|
"Approving: ",
|
|
1538
|
-
|
|
1574
|
+
N.join(", ")
|
|
1539
1575
|
] })
|
|
1540
1576
|
] })
|
|
1541
1577
|
] }),
|
|
1542
|
-
|
|
1543
|
-
/* @__PURE__ */
|
|
1544
|
-
/* @__PURE__ */ u(
|
|
1545
|
-
/* @__PURE__ */ u("div", { className: "mc:flex mc:flex-col mc:items-center mc:justify-center mc:w-full", children: /* @__PURE__ */
|
|
1578
|
+
V === "success" && /* @__PURE__ */ x("div", { className: "mc:relative mc:bg-dark-2 mc:border mc:border-border mc:rounded-xl mc:p-4 mc:flex mc:flex-col mc:gap-8 mc:items-start mc:w-full mc:max-w-[380px] mc:mx-4 animate-slide-in-right", children: [
|
|
1579
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:flex-col mc:gap-6 mc:items-center mc:w-full", children: [
|
|
1580
|
+
/* @__PURE__ */ u(Fr, { size: 95 }),
|
|
1581
|
+
/* @__PURE__ */ u("div", { className: "mc:flex mc:flex-col mc:items-center mc:justify-center mc:w-full", children: /* @__PURE__ */ x("div", { className: "mc:flex mc:flex-col mc:gap-1 mc:items-center mc:text-white mc:px-2", children: [
|
|
1546
1582
|
/* @__PURE__ */ u("p", { className: "mc:text-lg mc:font-semibold mc:text-center", children: "Payment Success" }),
|
|
1547
1583
|
/* @__PURE__ */ u("p", { className: "mc:text-sm mc:text-center", children: "Your payment has been successfully done." })
|
|
1548
1584
|
] }) }),
|
|
1549
|
-
/* @__PURE__ */ u("div", { className: "mc:bg-dark-4 mc:border mc:border-white/10 mc:rounded-lg mc:py-3 mc:px-4 mc:w-full mc:max-w-[348px] mc:flex mc:flex-col mc:items-center", children: /* @__PURE__ */
|
|
1585
|
+
/* @__PURE__ */ u("div", { className: "mc:bg-dark-4 mc:border mc:border-white/10 mc:rounded-lg mc:py-3 mc:px-4 mc:w-full mc:max-w-[348px] mc:flex mc:flex-col mc:items-center", children: /* @__PURE__ */ x("div", { className: "mc:flex mc:flex-col mc:gap-2 mc:w-full", children: [
|
|
1550
1586
|
/* @__PURE__ */ u("p", { className: "mc:text-xs mc:text-white", children: "Order Details:" }),
|
|
1551
|
-
/* @__PURE__ */
|
|
1587
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:gap-4 mc:sm:gap-8 mc:text-sm mc:text-white mc:w-full", children: [
|
|
1552
1588
|
/* @__PURE__ */ u("span", { className: "mc:min-w-[85px] mc:shrink-0", children: "Item" }),
|
|
1553
1589
|
/* @__PURE__ */ u("span", { className: "mc:flex-1 mc:text-right mc:wrap-break-word", children: s[0]?.name || "Item" })
|
|
1554
1590
|
] }),
|
|
1555
|
-
/* @__PURE__ */
|
|
1591
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:gap-4 mc:sm:gap-8 mc:text-white mc:w-full", children: [
|
|
1556
1592
|
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:min-w-[106px] mc:shrink-0", children: "Total Payment" }),
|
|
1557
|
-
/* @__PURE__ */
|
|
1558
|
-
be(
|
|
1593
|
+
/* @__PURE__ */ x("span", { className: "mc:flex-1 mc:text-base mc:font-semibold mc:text-right mc:wrap-break-word", children: [
|
|
1594
|
+
be(Ye),
|
|
1559
1595
|
" ",
|
|
1560
|
-
|
|
1596
|
+
j
|
|
1561
1597
|
] })
|
|
1562
1598
|
] })
|
|
1563
1599
|
] }) })
|
|
1564
1600
|
] }),
|
|
1565
1601
|
/* @__PURE__ */ u("div", { className: "mc:h-px mc:w-full mc:max-w-[320px] mc:bg-white/20" }),
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */ u("p", { className: "mc:text-center", children:
|
|
1568
|
-
|
|
1602
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:flex-col mc:gap-2 mc:items-center mc:justify-center mc:w-full mc:text-xs mc:text-white mc:px-5", children: [
|
|
1603
|
+
/* @__PURE__ */ u("p", { className: "mc:text-center", children: dr() }),
|
|
1604
|
+
$ && /* @__PURE__ */ u(
|
|
1569
1605
|
"a",
|
|
1570
1606
|
{
|
|
1571
|
-
href: `https://sepolia-blockscout.lisk.com/tx/${
|
|
1607
|
+
href: `https://sepolia-blockscout.lisk.com/tx/${$}`,
|
|
1572
1608
|
target: "_blank",
|
|
1573
1609
|
rel: "noopener noreferrer",
|
|
1574
1610
|
className: "mc:text-cyan hover:mc:underline mc:text-center mc:break-all",
|
|
@@ -1579,15 +1615,15 @@ function _r({
|
|
|
1579
1615
|
/* @__PURE__ */ u(
|
|
1580
1616
|
"button",
|
|
1581
1617
|
{
|
|
1582
|
-
onClick:
|
|
1618
|
+
onClick: ur,
|
|
1583
1619
|
className: "mc:w-full mc:h-[42px] mc:bg-secondary hover:mc:bg-secondary/90 mc:rounded-lg mc:flex mc:items-center mc:justify-center mc:text-sm mc:font-semibold mc:text-white mc:transition-all",
|
|
1584
1620
|
children: "Back to Home"
|
|
1585
1621
|
}
|
|
1586
1622
|
)
|
|
1587
1623
|
] }),
|
|
1588
|
-
|
|
1589
|
-
/* @__PURE__ */
|
|
1590
|
-
/* @__PURE__ */
|
|
1624
|
+
V === "form" && /* @__PURE__ */ x("div", { className: "mc:relative mc:bg-dark-2 mc:border mc:border-border mc:rounded-xl mc:p-4 mc:flex mc:flex-col mc:gap-5 mc:max-w-[1000px] mc:w-full mc:mx-4 mc:max-h-[90vh] mc:overflow-y-auto animate-slide-in-right", children: [
|
|
1625
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:gap-4", children: [
|
|
1626
|
+
/* @__PURE__ */ x("div", { className: "mc:flex-1 mc:flex mc:flex-col mc:gap-1 mc:min-w-0", children: [
|
|
1591
1627
|
/* @__PURE__ */ u("h2", { className: "mc:text-lg mc:sm:text-xl mc:text-white mc:font-normal mc:wrap-break-word", children: "Complete Payment" }),
|
|
1592
1628
|
/* @__PURE__ */ u("p", { className: "mc:text-sm mc:sm:text-base mc:text-white/70 mc:wrap-break-word", children: "Choose how you want to pay (supports multi-token for wallets)" })
|
|
1593
1629
|
] }),
|
|
@@ -1596,25 +1632,25 @@ function _r({
|
|
|
1596
1632
|
{
|
|
1597
1633
|
onClick: t,
|
|
1598
1634
|
className: "mc:text-white/60 hover:mc:text-white mc:transition-colors mc:shrink-0",
|
|
1599
|
-
children: /* @__PURE__ */ u(
|
|
1635
|
+
children: /* @__PURE__ */ u(Or, { size: 26 })
|
|
1600
1636
|
}
|
|
1601
1637
|
)
|
|
1602
1638
|
] }),
|
|
1603
|
-
/* @__PURE__ */
|
|
1604
|
-
/* @__PURE__ */
|
|
1605
|
-
/* @__PURE__ */
|
|
1639
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:gap-5 mc:flex-col mc:lg:flex-row", children: [
|
|
1640
|
+
/* @__PURE__ */ x("div", { className: "mc:flex-1 mc:flex mc:flex-col mc:gap-5", children: [
|
|
1641
|
+
/* @__PURE__ */ x("div", { className: "mc:bg-dark-4 mc:rounded-md mc:p-4 mc:flex mc:items-center mc:gap-3 mc:sm:gap-5 mc:flex-col mc:md:flex-row", children: [
|
|
1606
1642
|
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:sm:text-base mc:text-white/60 mc:min-w-[120px] mc:shrink-0", children: "Total Required" }),
|
|
1607
|
-
/* @__PURE__ */
|
|
1608
|
-
be(
|
|
1643
|
+
/* @__PURE__ */ x("span", { className: "mc:text-lg mc:sm:text-xl mc:font-bold mc:text-white mc:text-right mc:flex-1 mc:min-w-0 mc:wrap-break-word", children: [
|
|
1644
|
+
be(Ye),
|
|
1609
1645
|
" ",
|
|
1610
|
-
|
|
1646
|
+
j
|
|
1611
1647
|
] })
|
|
1612
1648
|
] }),
|
|
1613
|
-
/* @__PURE__ */
|
|
1649
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:gap-3 mc:sm:gap-5 mc:flex-wrap", children: [
|
|
1614
1650
|
/* @__PURE__ */ u("span", { className: "mc:text-sm mc:sm:text-base mc:text-white mc:flex-1 mc:min-w-0", children: "Use your tokens" }),
|
|
1615
|
-
/* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ x("div", { className: "mc:bg-dark-4 mc:rounded-md mc:px-3 mc:py-2 mc:flex mc:items-center mc:gap-2 mc:flex-1 mc:sm:flex-initial mc:min-w-0", children: [
|
|
1616
1652
|
/* @__PURE__ */ u(
|
|
1617
|
-
|
|
1653
|
+
Br,
|
|
1618
1654
|
{
|
|
1619
1655
|
size: 16,
|
|
1620
1656
|
className: "mc:text-white/60 mc:shrink-0"
|
|
@@ -1625,71 +1661,71 @@ function _r({
|
|
|
1625
1661
|
{
|
|
1626
1662
|
type: "text",
|
|
1627
1663
|
placeholder: "Search token or chain..",
|
|
1628
|
-
value:
|
|
1629
|
-
onChange: (
|
|
1664
|
+
value: I,
|
|
1665
|
+
onChange: (w) => Z(w.target.value),
|
|
1630
1666
|
className: "mc:bg-transparent mc:border-none mc:outline-none mc:text-sm mc:sm:text-base mc:text-white/60 placeholder:mc:text-white/60 mc:w-full mc:min-w-0"
|
|
1631
1667
|
}
|
|
1632
1668
|
)
|
|
1633
1669
|
] })
|
|
1634
1670
|
] }),
|
|
1635
|
-
/* @__PURE__ */
|
|
1636
|
-
/* @__PURE__ */
|
|
1637
|
-
/* @__PURE__ */
|
|
1671
|
+
/* @__PURE__ */ x("div", { className: "mc:bg-dark-3 mc:rounded-md mc:p-3 mc:flex mc:flex-col mc:gap-4", children: [
|
|
1672
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:gap-3 mc:sm:gap-6 mc:flex-col mc:md:flex-row", children: [
|
|
1673
|
+
/* @__PURE__ */ x("div", { className: "mc:flex-1 mc:flex mc:items-center mc:gap-2 mc:min-w-0 mc:flex-wrap", children: [
|
|
1638
1674
|
/* @__PURE__ */ u(
|
|
1639
|
-
|
|
1675
|
+
Ur,
|
|
1640
1676
|
{
|
|
1641
1677
|
size: 16,
|
|
1642
1678
|
className: "mc:text-white/60 mc:shrink-0"
|
|
1643
1679
|
}
|
|
1644
1680
|
),
|
|
1645
1681
|
/* @__PURE__ */ u("span", { className: "mc:text-xs mc:sm:text-sm mc:italic mc:text-white mc:wrap-break-word", children: "Set the coins amount until 100%" }),
|
|
1646
|
-
/* @__PURE__ */
|
|
1682
|
+
/* @__PURE__ */ x(
|
|
1647
1683
|
"span",
|
|
1648
1684
|
{
|
|
1649
|
-
className: `mc:bg-dark-4 mc:rounded-full mc:px-2 mc:py-1 mc:text-xs mc:font-semibold mc:shrink-0 ${
|
|
1685
|
+
className: `mc:bg-dark-4 mc:rounded-full mc:px-2 mc:py-1 mc:text-xs mc:font-semibold mc:shrink-0 ${M === 100 ? "mc:text-cyan" : "mc:text-warning"}`,
|
|
1650
1686
|
children: [
|
|
1651
|
-
|
|
1687
|
+
M,
|
|
1652
1688
|
"/100%"
|
|
1653
1689
|
]
|
|
1654
1690
|
}
|
|
1655
1691
|
)
|
|
1656
1692
|
] }),
|
|
1657
|
-
/* @__PURE__ */
|
|
1693
|
+
/* @__PURE__ */ x("div", { className: "mc:flex mc:items-center mc:gap-2 mc:shrink-0", children: [
|
|
1658
1694
|
/* @__PURE__ */ u("span", { className: "mc:text-xs mc:sm:text-sm mc:text-white", children: "Auto Optimize" }),
|
|
1659
1695
|
/* @__PURE__ */ u(
|
|
1660
1696
|
"button",
|
|
1661
1697
|
{
|
|
1662
|
-
onClick:
|
|
1663
|
-
className: `mc:w-7 mc:h-4 mc:rounded-full mc:relative mc:transition-colors ${
|
|
1698
|
+
onClick: ir,
|
|
1699
|
+
className: `mc:w-7 mc:h-4 mc:rounded-full mc:relative mc:transition-colors ${B ? "mc:bg-cyan" : "mc:bg-white/40"}`,
|
|
1664
1700
|
children: /* @__PURE__ */ u(
|
|
1665
1701
|
"div",
|
|
1666
1702
|
{
|
|
1667
|
-
className: `mc:absolute mc:top-0.5 mc:size-3 mc:rounded-full mc:bg-white mc:transition-transform ${
|
|
1703
|
+
className: `mc:absolute mc:top-0.5 mc:size-3 mc:rounded-full mc:bg-white mc:transition-transform ${B ? "mc:translate-x-3.5" : "mc:translate-x-0.5"}`
|
|
1668
1704
|
}
|
|
1669
1705
|
)
|
|
1670
1706
|
}
|
|
1671
1707
|
)
|
|
1672
1708
|
] })
|
|
1673
1709
|
] }),
|
|
1674
|
-
|
|
1675
|
-
|
|
1710
|
+
or.map((w) => /* @__PURE__ */ u(
|
|
1711
|
+
zr,
|
|
1676
1712
|
{
|
|
1677
|
-
token:
|
|
1678
|
-
totalAmount:
|
|
1679
|
-
displayAmount:
|
|
1713
|
+
token: w,
|
|
1714
|
+
totalAmount: Ke,
|
|
1715
|
+
displayAmount: Ye,
|
|
1680
1716
|
currency: r,
|
|
1681
|
-
onChange: (A) =>
|
|
1682
|
-
disabled:
|
|
1717
|
+
onChange: (A) => ar(w.id, A),
|
|
1718
|
+
disabled: B
|
|
1683
1719
|
},
|
|
1684
|
-
|
|
1720
|
+
w.id
|
|
1685
1721
|
))
|
|
1686
1722
|
] })
|
|
1687
1723
|
] }),
|
|
1688
1724
|
/* @__PURE__ */ u("div", { className: "mc:w-full mc:lg:w-[320px]", children: /* @__PURE__ */ u(
|
|
1689
|
-
|
|
1725
|
+
jr,
|
|
1690
1726
|
{
|
|
1691
|
-
items:
|
|
1692
|
-
fee:
|
|
1727
|
+
items: rr,
|
|
1728
|
+
fee: sr,
|
|
1693
1729
|
currency: r
|
|
1694
1730
|
}
|
|
1695
1731
|
) })
|
|
@@ -1697,18 +1733,18 @@ function _r({
|
|
|
1697
1733
|
/* @__PURE__ */ u(
|
|
1698
1734
|
"button",
|
|
1699
1735
|
{
|
|
1700
|
-
onClick:
|
|
1701
|
-
disabled:
|
|
1702
|
-
className: `mc:w-full mc:lg:w-[620px] mc:h-[42px] mc:rounded-lg mc:flex mc:items-center mc:justify-center mc:text-xs mc:sm:text-sm mc:font-semibold mc:text-white mc:transition-all mc:px-2 mc:wrap-break-word ${
|
|
1703
|
-
children: /* @__PURE__ */ u("span", { className: "mc:text-center", children:
|
|
1736
|
+
onClick: cr,
|
|
1737
|
+
disabled: M !== 100 || Xe || Ze,
|
|
1738
|
+
className: `mc:w-full mc:lg:w-[620px] mc:h-[42px] mc:rounded-lg mc:flex mc:items-center mc:justify-center mc:text-xs mc:sm:text-sm mc:font-semibold mc:text-white mc:transition-all mc:px-2 mc:wrap-break-word ${M === 100 && !Xe && !Ze ? "mc:bg-secondary hover:mc:bg-secondary/90" : "mc:bg-secondary/50 mc:cursor-not-allowed"}`,
|
|
1739
|
+
children: /* @__PURE__ */ u("span", { className: "mc:text-center", children: Ze ? "Price data unavailable - Please wait" : Xe ? "Insufficient Balance" : M !== 100 ? `Complete to 100% (${M}%)` : "Pay with MultiCoyn" })
|
|
1704
1740
|
}
|
|
1705
1741
|
)
|
|
1706
1742
|
] })
|
|
1707
1743
|
] });
|
|
1708
|
-
return
|
|
1744
|
+
return vr(lr, document.body);
|
|
1709
1745
|
}
|
|
1710
|
-
function
|
|
1711
|
-
const [e, t] =
|
|
1746
|
+
function vo() {
|
|
1747
|
+
const [e, t] = G(!1), [n, r] = G("form");
|
|
1712
1748
|
return {
|
|
1713
1749
|
isOpen: e,
|
|
1714
1750
|
view: n,
|
|
@@ -1723,7 +1759,7 @@ function To() {
|
|
|
1723
1759
|
showForm: () => r("form")
|
|
1724
1760
|
};
|
|
1725
1761
|
}
|
|
1726
|
-
const
|
|
1762
|
+
const Lt = [
|
|
1727
1763
|
{
|
|
1728
1764
|
inputs: [
|
|
1729
1765
|
{
|
|
@@ -1778,7 +1814,7 @@ const Ut = [
|
|
|
1778
1814
|
stateMutability: "view",
|
|
1779
1815
|
type: "function"
|
|
1780
1816
|
}
|
|
1781
|
-
],
|
|
1817
|
+
], Eo = [
|
|
1782
1818
|
{
|
|
1783
1819
|
name: "query",
|
|
1784
1820
|
type: "function",
|
|
@@ -1831,34 +1867,34 @@ const Ut = [
|
|
|
1831
1867
|
];
|
|
1832
1868
|
function Pe(e, { includeName: t = !1 } = {}) {
|
|
1833
1869
|
if (e.type !== "function" && e.type !== "event" && e.type !== "error")
|
|
1834
|
-
throw new
|
|
1835
|
-
return `${e.name}(${
|
|
1870
|
+
throw new ts(e.type);
|
|
1871
|
+
return `${e.name}(${Pt(e.inputs, { includeName: t })})`;
|
|
1836
1872
|
}
|
|
1837
|
-
function
|
|
1838
|
-
return e ? e.map((n) =>
|
|
1873
|
+
function Pt(e, { includeName: t = !1 } = {}) {
|
|
1874
|
+
return e ? e.map((n) => Hr(n, { includeName: t })).join(t ? ", " : ",") : "";
|
|
1839
1875
|
}
|
|
1840
|
-
function
|
|
1841
|
-
return e.type.startsWith("tuple") ? `(${
|
|
1876
|
+
function Hr(e, { includeName: t }) {
|
|
1877
|
+
return e.type.startsWith("tuple") ? `(${Pt(e.components, { includeName: t })})${e.type.slice(5)}` : e.type + (t && e.name ? ` ${e.name}` : "");
|
|
1842
1878
|
}
|
|
1843
1879
|
function Re(e, { strict: t = !0 } = {}) {
|
|
1844
1880
|
return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
|
|
1845
1881
|
}
|
|
1846
|
-
function
|
|
1882
|
+
function F(e) {
|
|
1847
1883
|
return Re(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
1848
1884
|
}
|
|
1849
|
-
const
|
|
1850
|
-
let
|
|
1885
|
+
const tn = "2.43.5";
|
|
1886
|
+
let Qe = {
|
|
1851
1887
|
getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: n }) => t ? `${e ?? "https://viem.sh"}${t}${n ? `#${n}` : ""}` : void 0,
|
|
1852
|
-
version: `viem@${
|
|
1853
|
-
}, f = class
|
|
1888
|
+
version: `viem@${tn}`
|
|
1889
|
+
}, f = class at extends Error {
|
|
1854
1890
|
constructor(t, n = {}) {
|
|
1855
|
-
const r = n.cause instanceof
|
|
1891
|
+
const r = n.cause instanceof at ? n.cause.details : n.cause?.message ? n.cause.message : n.details, s = n.cause instanceof at && n.cause.docsPath || n.docsPath, a = Qe.getDocsUrl?.({ ...n, docsPath: s }), i = [
|
|
1856
1892
|
t || "An error occurred.",
|
|
1857
1893
|
"",
|
|
1858
1894
|
...n.metaMessages ? [...n.metaMessages, ""] : [],
|
|
1859
1895
|
...a ? [`Docs: ${a}`] : [],
|
|
1860
1896
|
...r ? [`Details: ${r}`] : [],
|
|
1861
|
-
...
|
|
1897
|
+
...Qe.version ? [`Version: ${Qe.version}`] : []
|
|
1862
1898
|
].join(`
|
|
1863
1899
|
`);
|
|
1864
1900
|
super(i, n.cause ? { cause: n.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -1891,14 +1927,14 @@ let Je = {
|
|
|
1891
1927
|
configurable: !0,
|
|
1892
1928
|
writable: !0,
|
|
1893
1929
|
value: "BaseError"
|
|
1894
|
-
}), this.details = r, this.docsPath = s, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = t, this.version =
|
|
1930
|
+
}), this.details = r, this.docsPath = s, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = t, this.version = tn;
|
|
1895
1931
|
}
|
|
1896
1932
|
walk(t) {
|
|
1897
|
-
return
|
|
1933
|
+
return nn(this, t);
|
|
1898
1934
|
}
|
|
1899
1935
|
};
|
|
1900
|
-
function
|
|
1901
|
-
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ?
|
|
1936
|
+
function nn(e, t) {
|
|
1937
|
+
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? nn(e.cause, t) : t ? null : e;
|
|
1902
1938
|
}
|
|
1903
1939
|
class Vr extends f {
|
|
1904
1940
|
constructor({ docsPath: t }) {
|
|
@@ -1912,7 +1948,7 @@ class Vr extends f {
|
|
|
1912
1948
|
});
|
|
1913
1949
|
}
|
|
1914
1950
|
}
|
|
1915
|
-
class
|
|
1951
|
+
class Ft extends f {
|
|
1916
1952
|
constructor({ docsPath: t }) {
|
|
1917
1953
|
super([
|
|
1918
1954
|
"Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
|
|
@@ -1924,12 +1960,12 @@ class Lt extends f {
|
|
|
1924
1960
|
});
|
|
1925
1961
|
}
|
|
1926
1962
|
}
|
|
1927
|
-
class
|
|
1963
|
+
class Wr extends f {
|
|
1928
1964
|
constructor({ data: t, params: n, size: r }) {
|
|
1929
1965
|
super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
1930
1966
|
`), {
|
|
1931
1967
|
metaMessages: [
|
|
1932
|
-
`Params: (${
|
|
1968
|
+
`Params: (${Pt(n, { includeName: !0 })})`,
|
|
1933
1969
|
`Data: ${t} (${r} bytes)`
|
|
1934
1970
|
],
|
|
1935
1971
|
name: "AbiDecodingDataSizeTooSmallError"
|
|
@@ -1951,14 +1987,14 @@ class Hr extends f {
|
|
|
1951
1987
|
}), this.data = t, this.params = n, this.size = r;
|
|
1952
1988
|
}
|
|
1953
1989
|
}
|
|
1954
|
-
class
|
|
1990
|
+
class St extends f {
|
|
1955
1991
|
constructor() {
|
|
1956
1992
|
super('Cannot decode zero data ("0x") with ABI parameters.', {
|
|
1957
1993
|
name: "AbiDecodingZeroDataError"
|
|
1958
1994
|
});
|
|
1959
1995
|
}
|
|
1960
1996
|
}
|
|
1961
|
-
class
|
|
1997
|
+
class Kr extends f {
|
|
1962
1998
|
constructor({ expectedLength: t, givenLength: n, type: r }) {
|
|
1963
1999
|
super([
|
|
1964
2000
|
`ABI encoding array length mismatch for type ${r}.`,
|
|
@@ -1968,12 +2004,12 @@ class Wr extends f {
|
|
|
1968
2004
|
`), { name: "AbiEncodingArrayLengthMismatchError" });
|
|
1969
2005
|
}
|
|
1970
2006
|
}
|
|
1971
|
-
class
|
|
2007
|
+
class Yr extends f {
|
|
1972
2008
|
constructor({ expectedSize: t, value: n }) {
|
|
1973
|
-
super(`Size of bytes "${n}" (bytes${
|
|
2009
|
+
super(`Size of bytes "${n}" (bytes${F(n)}) does not match expected size (bytes${t}).`, { name: "AbiEncodingBytesSizeMismatchError" });
|
|
1974
2010
|
}
|
|
1975
2011
|
}
|
|
1976
|
-
class
|
|
2012
|
+
class Zr extends f {
|
|
1977
2013
|
constructor({ expectedLength: t, givenLength: n }) {
|
|
1978
2014
|
super([
|
|
1979
2015
|
"ABI encoding params/values length mismatch.",
|
|
@@ -1983,7 +2019,7 @@ class Yr extends f {
|
|
|
1983
2019
|
`), { name: "AbiEncodingLengthMismatchError" });
|
|
1984
2020
|
}
|
|
1985
2021
|
}
|
|
1986
|
-
class
|
|
2022
|
+
class Po extends f {
|
|
1987
2023
|
constructor(t, { docsPath: n }) {
|
|
1988
2024
|
super([
|
|
1989
2025
|
`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,
|
|
@@ -1996,7 +2032,7 @@ class Eo extends f {
|
|
|
1996
2032
|
});
|
|
1997
2033
|
}
|
|
1998
2034
|
}
|
|
1999
|
-
class
|
|
2035
|
+
class So extends f {
|
|
2000
2036
|
constructor(t, { docsPath: n } = {}) {
|
|
2001
2037
|
super([
|
|
2002
2038
|
`Error ${t ? `"${t}" ` : ""}not found on ABI.`,
|
|
@@ -2008,7 +2044,7 @@ class Po extends f {
|
|
|
2008
2044
|
});
|
|
2009
2045
|
}
|
|
2010
2046
|
}
|
|
2011
|
-
class
|
|
2047
|
+
class rn extends f {
|
|
2012
2048
|
constructor(t, { docsPath: n }) {
|
|
2013
2049
|
super([
|
|
2014
2050
|
`Encoded error signature "${t}" not found on ABI.`,
|
|
@@ -2026,7 +2062,7 @@ class nn extends f {
|
|
|
2026
2062
|
}), this.signature = t;
|
|
2027
2063
|
}
|
|
2028
2064
|
}
|
|
2029
|
-
class
|
|
2065
|
+
class Le extends f {
|
|
2030
2066
|
constructor(t, { docsPath: n } = {}) {
|
|
2031
2067
|
super([
|
|
2032
2068
|
`Function ${t ? `"${t}" ` : ""}not found on ABI.`,
|
|
@@ -2038,7 +2074,7 @@ class Ue extends f {
|
|
|
2038
2074
|
});
|
|
2039
2075
|
}
|
|
2040
2076
|
}
|
|
2041
|
-
class
|
|
2077
|
+
class Xr extends f {
|
|
2042
2078
|
constructor(t, { docsPath: n }) {
|
|
2043
2079
|
super([
|
|
2044
2080
|
`Function "${t}" does not contain any \`outputs\` on ABI.`,
|
|
@@ -2051,7 +2087,7 @@ class Zr extends f {
|
|
|
2051
2087
|
});
|
|
2052
2088
|
}
|
|
2053
2089
|
}
|
|
2054
|
-
class
|
|
2090
|
+
class Ao extends f {
|
|
2055
2091
|
constructor(t, { docsPath: n }) {
|
|
2056
2092
|
super([
|
|
2057
2093
|
`Encoded function signature "${t}" not found on ABI.`,
|
|
@@ -2064,7 +2100,7 @@ class So extends f {
|
|
|
2064
2100
|
});
|
|
2065
2101
|
}
|
|
2066
2102
|
}
|
|
2067
|
-
class
|
|
2103
|
+
class Jr extends f {
|
|
2068
2104
|
constructor(t, n) {
|
|
2069
2105
|
super("Found ambiguous types in overloaded ABI items.", {
|
|
2070
2106
|
metaMessages: [
|
|
@@ -2078,7 +2114,7 @@ class Xr extends f {
|
|
|
2078
2114
|
});
|
|
2079
2115
|
}
|
|
2080
2116
|
}
|
|
2081
|
-
class
|
|
2117
|
+
class Qr extends f {
|
|
2082
2118
|
constructor(t, { docsPath: n }) {
|
|
2083
2119
|
super([
|
|
2084
2120
|
`Type "${t}" is not a valid encoding type.`,
|
|
@@ -2087,7 +2123,7 @@ class Jr extends f {
|
|
|
2087
2123
|
`), { docsPath: n, name: "InvalidAbiEncodingType" });
|
|
2088
2124
|
}
|
|
2089
2125
|
}
|
|
2090
|
-
class
|
|
2126
|
+
class qr extends f {
|
|
2091
2127
|
constructor(t, { docsPath: n }) {
|
|
2092
2128
|
super([
|
|
2093
2129
|
`Type "${t}" is not a valid decoding type.`,
|
|
@@ -2096,7 +2132,7 @@ class Qr extends f {
|
|
|
2096
2132
|
`), { docsPath: n, name: "InvalidAbiDecodingType" });
|
|
2097
2133
|
}
|
|
2098
2134
|
}
|
|
2099
|
-
class
|
|
2135
|
+
class es extends f {
|
|
2100
2136
|
constructor(t) {
|
|
2101
2137
|
super([`Value "${t}" is not a valid array.`].join(`
|
|
2102
2138
|
`), {
|
|
@@ -2104,7 +2140,7 @@ class qr extends f {
|
|
|
2104
2140
|
});
|
|
2105
2141
|
}
|
|
2106
2142
|
}
|
|
2107
|
-
class
|
|
2143
|
+
class ts extends f {
|
|
2108
2144
|
constructor(t) {
|
|
2109
2145
|
super([
|
|
2110
2146
|
`"${t}" is not a valid definition type.`,
|
|
@@ -2113,7 +2149,7 @@ class es extends f {
|
|
|
2113
2149
|
`), { name: "InvalidDefinitionTypeError" });
|
|
2114
2150
|
}
|
|
2115
2151
|
}
|
|
2116
|
-
class
|
|
2152
|
+
class Fe extends f {
|
|
2117
2153
|
constructor({ address: t }) {
|
|
2118
2154
|
super(`Address "${t}" is invalid.`, {
|
|
2119
2155
|
metaMessages: [
|
|
@@ -2124,41 +2160,41 @@ class Le extends f {
|
|
|
2124
2160
|
});
|
|
2125
2161
|
}
|
|
2126
2162
|
}
|
|
2127
|
-
class
|
|
2163
|
+
class sn extends f {
|
|
2128
2164
|
constructor({ offset: t, position: n, size: r }) {
|
|
2129
2165
|
super(`Slice ${n === "start" ? "starting" : "ending"} at offset "${t}" is out-of-bounds (size: ${r}).`, { name: "SliceOffsetOutOfBoundsError" });
|
|
2130
2166
|
}
|
|
2131
2167
|
}
|
|
2132
|
-
let
|
|
2168
|
+
let an = class extends f {
|
|
2133
2169
|
constructor({ size: t, targetSize: n, type: r }) {
|
|
2134
2170
|
super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
2135
2171
|
}
|
|
2136
2172
|
};
|
|
2137
|
-
class
|
|
2173
|
+
class jt extends f {
|
|
2138
2174
|
constructor({ size: t, targetSize: n, type: r }) {
|
|
2139
2175
|
super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`, { name: "InvalidBytesLengthError" });
|
|
2140
2176
|
}
|
|
2141
2177
|
}
|
|
2142
2178
|
function Ae(e, { dir: t, size: n = 32 } = {}) {
|
|
2143
|
-
return typeof e == "string" ? pe(e, { dir: t, size: n }) :
|
|
2179
|
+
return typeof e == "string" ? pe(e, { dir: t, size: n }) : ns(e, { dir: t, size: n });
|
|
2144
2180
|
}
|
|
2145
2181
|
function pe(e, { dir: t, size: n = 32 } = {}) {
|
|
2146
2182
|
if (n === null)
|
|
2147
2183
|
return e;
|
|
2148
2184
|
const r = e.replace("0x", "");
|
|
2149
2185
|
if (r.length > n * 2)
|
|
2150
|
-
throw new
|
|
2186
|
+
throw new an({
|
|
2151
2187
|
size: Math.ceil(r.length / 2),
|
|
2152
2188
|
targetSize: n,
|
|
2153
2189
|
type: "hex"
|
|
2154
2190
|
});
|
|
2155
2191
|
return `0x${r[t === "right" ? "padEnd" : "padStart"](n * 2, "0")}`;
|
|
2156
2192
|
}
|
|
2157
|
-
function
|
|
2193
|
+
function ns(e, { dir: t, size: n = 32 } = {}) {
|
|
2158
2194
|
if (n === null)
|
|
2159
2195
|
return e;
|
|
2160
2196
|
if (e.length > n)
|
|
2161
|
-
throw new
|
|
2197
|
+
throw new an({
|
|
2162
2198
|
size: e.length,
|
|
2163
2199
|
targetSize: n,
|
|
2164
2200
|
type: "bytes"
|
|
@@ -2170,62 +2206,62 @@ function ts(e, { dir: t, size: n = 32 } = {}) {
|
|
|
2170
2206
|
}
|
|
2171
2207
|
return r;
|
|
2172
2208
|
}
|
|
2173
|
-
let
|
|
2209
|
+
let on = class extends f {
|
|
2174
2210
|
constructor({ max: t, min: n, signed: r, size: s, value: a }) {
|
|
2175
2211
|
super(`Number "${a}" is not in safe ${s ? `${s * 8}-bit ${r ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${n} to ${t})` : `(above ${n})`}`, { name: "IntegerOutOfRangeError" });
|
|
2176
2212
|
}
|
|
2177
2213
|
};
|
|
2178
|
-
class
|
|
2214
|
+
class rs extends f {
|
|
2179
2215
|
constructor(t) {
|
|
2180
2216
|
super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {
|
|
2181
2217
|
name: "InvalidBytesBooleanError"
|
|
2182
2218
|
});
|
|
2183
2219
|
}
|
|
2184
2220
|
}
|
|
2185
|
-
class
|
|
2221
|
+
class ss extends f {
|
|
2186
2222
|
constructor({ givenSize: t, maxSize: n }) {
|
|
2187
2223
|
super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
2188
2224
|
}
|
|
2189
2225
|
}
|
|
2190
|
-
function
|
|
2226
|
+
function At(e, { dir: t = "left" } = {}) {
|
|
2191
2227
|
let n = typeof e == "string" ? e.replace("0x", "") : e, r = 0;
|
|
2192
2228
|
for (let s = 0; s < n.length - 1 && n[t === "left" ? s : n.length - s - 1].toString() === "0"; s++)
|
|
2193
2229
|
r++;
|
|
2194
2230
|
return n = t === "left" ? n.slice(r) : n.slice(0, n.length - r), typeof e == "string" ? (n.length === 1 && t === "right" && (n = `${n}0`), `0x${n.length % 2 === 1 ? `0${n}` : n}`) : n;
|
|
2195
2231
|
}
|
|
2196
|
-
function
|
|
2197
|
-
if (
|
|
2198
|
-
throw new
|
|
2199
|
-
givenSize:
|
|
2232
|
+
function ne(e, { size: t }) {
|
|
2233
|
+
if (F(e) > t)
|
|
2234
|
+
throw new ss({
|
|
2235
|
+
givenSize: F(e),
|
|
2200
2236
|
maxSize: t
|
|
2201
2237
|
});
|
|
2202
2238
|
}
|
|
2203
|
-
function
|
|
2239
|
+
function cn(e, t = {}) {
|
|
2204
2240
|
const { signed: n } = t;
|
|
2205
|
-
t.size &&
|
|
2241
|
+
t.size && ne(e, { size: t.size });
|
|
2206
2242
|
const r = BigInt(e);
|
|
2207
2243
|
if (!n)
|
|
2208
2244
|
return r;
|
|
2209
2245
|
const s = (e.length - 2) / 2, a = (1n << BigInt(s) * 8n - 1n) - 1n;
|
|
2210
2246
|
return r <= a ? r : r - BigInt(`0x${"f".padStart(s * 2, "f")}`) - 1n;
|
|
2211
2247
|
}
|
|
2212
|
-
function
|
|
2213
|
-
return Number(
|
|
2248
|
+
function as(e, t = {}) {
|
|
2249
|
+
return Number(cn(e, t));
|
|
2214
2250
|
}
|
|
2215
|
-
const
|
|
2216
|
-
function
|
|
2217
|
-
return typeof e == "number" || typeof e == "bigint" ? k(e, t) : typeof e == "string" ?
|
|
2251
|
+
const is = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
|
|
2252
|
+
function os(e, t = {}) {
|
|
2253
|
+
return typeof e == "number" || typeof e == "bigint" ? k(e, t) : typeof e == "string" ? dn(e, t) : typeof e == "boolean" ? un(e, t) : ue(e, t);
|
|
2218
2254
|
}
|
|
2219
|
-
function
|
|
2255
|
+
function un(e, t = {}) {
|
|
2220
2256
|
const n = `0x${Number(e)}`;
|
|
2221
|
-
return typeof t.size == "number" ? (
|
|
2257
|
+
return typeof t.size == "number" ? (ne(n, { size: t.size }), Ae(n, { size: t.size })) : n;
|
|
2222
2258
|
}
|
|
2223
2259
|
function ue(e, t = {}) {
|
|
2224
2260
|
let n = "";
|
|
2225
2261
|
for (let s = 0; s < e.length; s++)
|
|
2226
|
-
n +=
|
|
2262
|
+
n += is[e[s]];
|
|
2227
2263
|
const r = `0x${n}`;
|
|
2228
|
-
return typeof t.size == "number" ? (
|
|
2264
|
+
return typeof t.size == "number" ? (ne(r, { size: t.size }), Ae(r, { dir: "right", size: t.size })) : r;
|
|
2229
2265
|
}
|
|
2230
2266
|
function k(e, t = {}) {
|
|
2231
2267
|
const { signed: n, size: r } = t, s = BigInt(e);
|
|
@@ -2234,7 +2270,7 @@ function k(e, t = {}) {
|
|
|
2234
2270
|
const i = typeof a == "bigint" && n ? -a - 1n : 0;
|
|
2235
2271
|
if (a && s > a || s < i) {
|
|
2236
2272
|
const c = typeof e == "bigint" ? "n" : "";
|
|
2237
|
-
throw new
|
|
2273
|
+
throw new on({
|
|
2238
2274
|
max: a ? `${a}${c}` : void 0,
|
|
2239
2275
|
min: `${i}${c}`,
|
|
2240
2276
|
signed: n,
|
|
@@ -2245,18 +2281,18 @@ function k(e, t = {}) {
|
|
|
2245
2281
|
const o = `0x${(n && s < 0 ? (1n << BigInt(r * 8)) + BigInt(s) : s).toString(16)}`;
|
|
2246
2282
|
return r ? Ae(o, { size: r }) : o;
|
|
2247
2283
|
}
|
|
2248
|
-
const os = /* @__PURE__ */ new TextEncoder();
|
|
2249
|
-
function un(e, t = {}) {
|
|
2250
|
-
const n = os.encode(e);
|
|
2251
|
-
return ue(n, t);
|
|
2252
|
-
}
|
|
2253
2284
|
const cs = /* @__PURE__ */ new TextEncoder();
|
|
2254
2285
|
function dn(e, t = {}) {
|
|
2255
|
-
|
|
2286
|
+
const n = cs.encode(e);
|
|
2287
|
+
return ue(n, t);
|
|
2288
|
+
}
|
|
2289
|
+
const us = /* @__PURE__ */ new TextEncoder();
|
|
2290
|
+
function ln(e, t = {}) {
|
|
2291
|
+
return typeof e == "number" || typeof e == "bigint" ? ls(e, t) : typeof e == "boolean" ? ds(e, t) : Re(e) ? $t(e, t) : fn(e, t);
|
|
2256
2292
|
}
|
|
2257
|
-
function
|
|
2293
|
+
function ds(e, t = {}) {
|
|
2258
2294
|
const n = new Uint8Array(1);
|
|
2259
|
-
return n[0] = Number(e), typeof t.size == "number" ? (
|
|
2295
|
+
return n[0] = Number(e), typeof t.size == "number" ? (ne(n, { size: t.size }), Ae(n, { size: t.size })) : n;
|
|
2260
2296
|
}
|
|
2261
2297
|
const ae = {
|
|
2262
2298
|
zero: 48,
|
|
@@ -2266,7 +2302,7 @@ const ae = {
|
|
|
2266
2302
|
a: 97,
|
|
2267
2303
|
f: 102
|
|
2268
2304
|
};
|
|
2269
|
-
function
|
|
2305
|
+
function zt(e) {
|
|
2270
2306
|
if (e >= ae.zero && e <= ae.nine)
|
|
2271
2307
|
return e - ae.zero;
|
|
2272
2308
|
if (e >= ae.A && e <= ae.F)
|
|
@@ -2274,120 +2310,120 @@ function jt(e) {
|
|
|
2274
2310
|
if (e >= ae.a && e <= ae.f)
|
|
2275
2311
|
return e - (ae.a - 10);
|
|
2276
2312
|
}
|
|
2277
|
-
function
|
|
2313
|
+
function $t(e, t = {}) {
|
|
2278
2314
|
let n = e;
|
|
2279
|
-
t.size && (
|
|
2315
|
+
t.size && (ne(n, { size: t.size }), n = Ae(n, { dir: "right", size: t.size }));
|
|
2280
2316
|
let r = n.slice(2);
|
|
2281
2317
|
r.length % 2 && (r = `0${r}`);
|
|
2282
2318
|
const s = r.length / 2, a = new Uint8Array(s);
|
|
2283
2319
|
for (let i = 0, o = 0; i < s; i++) {
|
|
2284
|
-
const c =
|
|
2320
|
+
const c = zt(r.charCodeAt(o++)), d = zt(r.charCodeAt(o++));
|
|
2285
2321
|
if (c === void 0 || d === void 0)
|
|
2286
2322
|
throw new f(`Invalid byte sequence ("${r[o - 2]}${r[o - 1]}" in "${r}").`);
|
|
2287
2323
|
a[i] = c * 16 + d;
|
|
2288
2324
|
}
|
|
2289
2325
|
return a;
|
|
2290
2326
|
}
|
|
2291
|
-
function
|
|
2327
|
+
function ls(e, t) {
|
|
2292
2328
|
const n = k(e, t);
|
|
2293
|
-
return
|
|
2294
|
-
}
|
|
2295
|
-
function ln(e, t = {}) {
|
|
2296
|
-
const n = cs.encode(e);
|
|
2297
|
-
return typeof t.size == "number" ? (se(n, { size: t.size }), Ae(n, { dir: "right", size: t.size })) : n;
|
|
2329
|
+
return $t(n);
|
|
2298
2330
|
}
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
return t ? {
|
|
2331
|
+
function fn(e, t = {}) {
|
|
2332
|
+
const n = us.encode(e);
|
|
2333
|
+
return typeof t.size == "number" ? (ne(n, { size: t.size }), Ae(n, { dir: "right", size: t.size })) : n;
|
|
2302
2334
|
}
|
|
2335
|
+
const Be = /* @__PURE__ */ BigInt(2 ** 32 - 1), _t = /* @__PURE__ */ BigInt(32);
|
|
2303
2336
|
function fs(e, t = !1) {
|
|
2337
|
+
return t ? { h: Number(e & Be), l: Number(e >> _t & Be) } : { h: Number(e >> _t & Be) | 0, l: Number(e & Be) | 0 };
|
|
2338
|
+
}
|
|
2339
|
+
function ps(e, t = !1) {
|
|
2304
2340
|
const n = e.length;
|
|
2305
2341
|
let r = new Uint32Array(n), s = new Uint32Array(n);
|
|
2306
2342
|
for (let a = 0; a < n; a++) {
|
|
2307
|
-
const { h: i, l: o } =
|
|
2343
|
+
const { h: i, l: o } = fs(e[a], t);
|
|
2308
2344
|
[r[a], s[a]] = [i, o];
|
|
2309
2345
|
}
|
|
2310
2346
|
return [r, s];
|
|
2311
2347
|
}
|
|
2312
|
-
const
|
|
2313
|
-
function
|
|
2348
|
+
const ms = (e, t, n) => e << n | t >>> 32 - n, ys = (e, t, n) => t << n | e >>> 32 - n, bs = (e, t, n) => t << n - 32 | e >>> 64 - n, hs = (e, t, n) => e << n - 32 | t >>> 64 - n;
|
|
2349
|
+
function gs(e) {
|
|
2314
2350
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
2315
2351
|
}
|
|
2316
|
-
function
|
|
2352
|
+
function Gt(e) {
|
|
2317
2353
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
2318
2354
|
throw new Error("positive integer expected, got " + e);
|
|
2319
2355
|
}
|
|
2320
|
-
function
|
|
2321
|
-
if (!
|
|
2356
|
+
function je(e, ...t) {
|
|
2357
|
+
if (!gs(e))
|
|
2322
2358
|
throw new Error("Uint8Array expected");
|
|
2323
2359
|
if (t.length > 0 && !t.includes(e.length))
|
|
2324
2360
|
throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
|
|
2325
2361
|
}
|
|
2326
|
-
function
|
|
2362
|
+
function Ht(e, t = !0) {
|
|
2327
2363
|
if (e.destroyed)
|
|
2328
2364
|
throw new Error("Hash instance has been destroyed");
|
|
2329
2365
|
if (t && e.finished)
|
|
2330
2366
|
throw new Error("Hash#digest() has already been called");
|
|
2331
2367
|
}
|
|
2332
|
-
function
|
|
2333
|
-
|
|
2368
|
+
function ws(e, t) {
|
|
2369
|
+
je(e);
|
|
2334
2370
|
const n = t.outputLen;
|
|
2335
2371
|
if (e.length < n)
|
|
2336
2372
|
throw new Error("digestInto() expects output buffer of length at least " + n);
|
|
2337
2373
|
}
|
|
2338
|
-
function
|
|
2374
|
+
function xs(e) {
|
|
2339
2375
|
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
2340
2376
|
}
|
|
2341
|
-
function
|
|
2377
|
+
function pn(...e) {
|
|
2342
2378
|
for (let t = 0; t < e.length; t++)
|
|
2343
2379
|
e[t].fill(0);
|
|
2344
2380
|
}
|
|
2345
|
-
const
|
|
2346
|
-
function
|
|
2381
|
+
const Ts = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
2382
|
+
function vs(e) {
|
|
2347
2383
|
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
2348
2384
|
}
|
|
2349
|
-
function
|
|
2385
|
+
function Es(e) {
|
|
2350
2386
|
for (let t = 0; t < e.length; t++)
|
|
2351
|
-
e[t] =
|
|
2387
|
+
e[t] = vs(e[t]);
|
|
2352
2388
|
return e;
|
|
2353
2389
|
}
|
|
2354
|
-
const Vt =
|
|
2355
|
-
function
|
|
2390
|
+
const Vt = Ts ? (e) => e : Es;
|
|
2391
|
+
function Ps(e) {
|
|
2356
2392
|
if (typeof e != "string")
|
|
2357
2393
|
throw new Error("string expected");
|
|
2358
2394
|
return new Uint8Array(new TextEncoder().encode(e));
|
|
2359
2395
|
}
|
|
2360
|
-
function
|
|
2361
|
-
return typeof e == "string" && (e =
|
|
2396
|
+
function mn(e) {
|
|
2397
|
+
return typeof e == "string" && (e = Ps(e)), je(e), e;
|
|
2362
2398
|
}
|
|
2363
|
-
class
|
|
2399
|
+
class Ss {
|
|
2364
2400
|
}
|
|
2365
|
-
function
|
|
2366
|
-
const t = (r) => e().update(
|
|
2401
|
+
function As(e) {
|
|
2402
|
+
const t = (r) => e().update(mn(r)).digest(), n = e();
|
|
2367
2403
|
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
|
|
2368
2404
|
}
|
|
2369
|
-
const
|
|
2405
|
+
const $s = BigInt(0), ke = BigInt(1), Cs = BigInt(2), ks = BigInt(7), Is = BigInt(256), Ns = BigInt(113), yn = [], bn = [], hn = [];
|
|
2370
2406
|
for (let e = 0, t = ke, n = 1, r = 0; e < 24; e++) {
|
|
2371
|
-
[n, r] = [r, (2 * n + 3 * r) % 5],
|
|
2372
|
-
let s =
|
|
2407
|
+
[n, r] = [r, (2 * n + 3 * r) % 5], yn.push(2 * (5 * r + n)), bn.push((e + 1) * (e + 2) / 2 % 64);
|
|
2408
|
+
let s = $s;
|
|
2373
2409
|
for (let a = 0; a < 7; a++)
|
|
2374
|
-
t = (t << ke ^ (t >>
|
|
2375
|
-
|
|
2410
|
+
t = (t << ke ^ (t >> ks) * Ns) % Is, t & Cs && (s ^= ke << (ke << /* @__PURE__ */ BigInt(a)) - ke);
|
|
2411
|
+
hn.push(s);
|
|
2376
2412
|
}
|
|
2377
|
-
const
|
|
2378
|
-
function
|
|
2413
|
+
const gn = ps(hn, !0), Rs = gn[0], Ms = gn[1], Wt = (e, t, n) => n > 32 ? bs(e, t, n) : ms(e, t, n), Kt = (e, t, n) => n > 32 ? hs(e, t, n) : ys(e, t, n);
|
|
2414
|
+
function Ds(e, t = 24) {
|
|
2379
2415
|
const n = new Uint32Array(10);
|
|
2380
2416
|
for (let r = 24 - t; r < 24; r++) {
|
|
2381
2417
|
for (let i = 0; i < 10; i++)
|
|
2382
2418
|
n[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40];
|
|
2383
2419
|
for (let i = 0; i < 10; i += 2) {
|
|
2384
|
-
const o = (i + 8) % 10, c = (i + 2) % 10, d = n[c], l = n[c + 1],
|
|
2385
|
-
for (let
|
|
2386
|
-
e[i +
|
|
2420
|
+
const o = (i + 8) % 10, c = (i + 2) % 10, d = n[c], l = n[c + 1], m = Wt(d, l, 1) ^ n[o], y = Kt(d, l, 1) ^ n[o + 1];
|
|
2421
|
+
for (let p = 0; p < 50; p += 10)
|
|
2422
|
+
e[i + p] ^= m, e[i + p + 1] ^= y;
|
|
2387
2423
|
}
|
|
2388
2424
|
let s = e[2], a = e[3];
|
|
2389
2425
|
for (let i = 0; i < 24; i++) {
|
|
2390
|
-
const o =
|
|
2426
|
+
const o = bn[i], c = Wt(s, a, o), d = Kt(s, a, o), l = yn[i];
|
|
2391
2427
|
s = e[l], a = e[l + 1], e[l] = c, e[l + 1] = d;
|
|
2392
2428
|
}
|
|
2393
2429
|
for (let i = 0; i < 50; i += 10) {
|
|
@@ -2396,25 +2432,25 @@ function Ms(e, t = 24) {
|
|
|
2396
2432
|
for (let o = 0; o < 10; o++)
|
|
2397
2433
|
e[i + o] ^= ~n[(o + 2) % 10] & n[(o + 4) % 10];
|
|
2398
2434
|
}
|
|
2399
|
-
e[0] ^=
|
|
2435
|
+
e[0] ^= Rs[r], e[1] ^= Ms[r];
|
|
2400
2436
|
}
|
|
2401
|
-
|
|
2437
|
+
pn(n);
|
|
2402
2438
|
}
|
|
2403
|
-
class
|
|
2439
|
+
class Ct extends Ss {
|
|
2404
2440
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
2405
2441
|
constructor(t, n, r, s = !1, a = 24) {
|
|
2406
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = a,
|
|
2442
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = a, Gt(r), !(0 < t && t < 200))
|
|
2407
2443
|
throw new Error("only keccak-f1600 function is supported");
|
|
2408
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
2444
|
+
this.state = new Uint8Array(200), this.state32 = xs(this.state);
|
|
2409
2445
|
}
|
|
2410
2446
|
clone() {
|
|
2411
2447
|
return this._cloneInto();
|
|
2412
2448
|
}
|
|
2413
2449
|
keccak() {
|
|
2414
|
-
Vt(this.state32),
|
|
2450
|
+
Vt(this.state32), Ds(this.state32, this.rounds), Vt(this.state32), this.posOut = 0, this.pos = 0;
|
|
2415
2451
|
}
|
|
2416
2452
|
update(t) {
|
|
2417
|
-
|
|
2453
|
+
Ht(this), t = mn(t), je(t);
|
|
2418
2454
|
const { blockLen: n, state: r } = this, s = t.length;
|
|
2419
2455
|
for (let a = 0; a < s; ) {
|
|
2420
2456
|
const i = Math.min(n - this.pos, s - a);
|
|
@@ -2432,7 +2468,7 @@ class $t extends Ps {
|
|
|
2432
2468
|
t[r] ^= n, (n & 128) !== 0 && r === s - 1 && this.keccak(), t[s - 1] ^= 128, this.keccak();
|
|
2433
2469
|
}
|
|
2434
2470
|
writeInto(t) {
|
|
2435
|
-
|
|
2471
|
+
Ht(this, !1), je(t), this.finish();
|
|
2436
2472
|
const n = this.state, { blockLen: r } = this;
|
|
2437
2473
|
for (let s = 0, a = t.length; s < a; ) {
|
|
2438
2474
|
this.posOut >= r && this.keccak();
|
|
@@ -2447,10 +2483,10 @@ class $t extends Ps {
|
|
|
2447
2483
|
return this.writeInto(t);
|
|
2448
2484
|
}
|
|
2449
2485
|
xof(t) {
|
|
2450
|
-
return
|
|
2486
|
+
return Gt(t), this.xofInto(new Uint8Array(t));
|
|
2451
2487
|
}
|
|
2452
2488
|
digestInto(t) {
|
|
2453
|
-
if (
|
|
2489
|
+
if (ws(t, this), this.finished)
|
|
2454
2490
|
throw new Error("digest() was already called");
|
|
2455
2491
|
return this.writeInto(t), this.destroy(), t;
|
|
2456
2492
|
}
|
|
@@ -2458,19 +2494,19 @@ class $t extends Ps {
|
|
|
2458
2494
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
2459
2495
|
}
|
|
2460
2496
|
destroy() {
|
|
2461
|
-
this.destroyed = !0,
|
|
2497
|
+
this.destroyed = !0, pn(this.state);
|
|
2462
2498
|
}
|
|
2463
2499
|
_cloneInto(t) {
|
|
2464
2500
|
const { blockLen: n, suffix: r, outputLen: s, rounds: a, enableXOF: i } = this;
|
|
2465
|
-
return t || (t = new
|
|
2501
|
+
return t || (t = new Ct(n, r, s, i, a)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = a, t.suffix = r, t.outputLen = s, t.enableXOF = i, t.destroyed = this.destroyed, t;
|
|
2466
2502
|
}
|
|
2467
2503
|
}
|
|
2468
|
-
const
|
|
2469
|
-
function
|
|
2470
|
-
const n = t || "hex", r =
|
|
2471
|
-
return n === "bytes" ? r :
|
|
2504
|
+
const Os = (e, t, n) => As(() => new Ct(t, e, n)), Bs = Os(1, 136, 256 / 8);
|
|
2505
|
+
function wn(e, t) {
|
|
2506
|
+
const n = t || "hex", r = Bs(Re(e, { strict: !1 }) ? ln(e) : e);
|
|
2507
|
+
return n === "bytes" ? r : os(r);
|
|
2472
2508
|
}
|
|
2473
|
-
class
|
|
2509
|
+
class xn extends Map {
|
|
2474
2510
|
constructor(t) {
|
|
2475
2511
|
super(), Object.defineProperty(this, "maxSize", {
|
|
2476
2512
|
enumerable: !0,
|
|
@@ -2491,42 +2527,42 @@ class wn extends Map {
|
|
|
2491
2527
|
return this;
|
|
2492
2528
|
}
|
|
2493
2529
|
}
|
|
2494
|
-
const
|
|
2530
|
+
const Us = /^0x[a-fA-F0-9]{40}$/, qe = /* @__PURE__ */ new xn(8192);
|
|
2495
2531
|
function ge(e, t) {
|
|
2496
2532
|
const { strict: n = !0 } = t ?? {}, r = `${e}.${n}`;
|
|
2497
|
-
if (
|
|
2498
|
-
return
|
|
2499
|
-
const s =
|
|
2500
|
-
return
|
|
2501
|
-
}
|
|
2502
|
-
const
|
|
2503
|
-
function
|
|
2504
|
-
if (
|
|
2505
|
-
return
|
|
2506
|
-
const n = e.substring(2).toLowerCase(), r =
|
|
2533
|
+
if (qe.has(r))
|
|
2534
|
+
return qe.get(r);
|
|
2535
|
+
const s = Us.test(e) ? e.toLowerCase() === e ? !0 : n ? Tn(e) === e : !0 : !1;
|
|
2536
|
+
return qe.set(r, s), s;
|
|
2537
|
+
}
|
|
2538
|
+
const et = /* @__PURE__ */ new xn(8192);
|
|
2539
|
+
function Tn(e, t) {
|
|
2540
|
+
if (et.has(`${e}.${t}`))
|
|
2541
|
+
return et.get(`${e}.${t}`);
|
|
2542
|
+
const n = e.substring(2).toLowerCase(), r = wn(fn(n), "bytes"), s = n.split("");
|
|
2507
2543
|
for (let i = 0; i < 40; i += 2)
|
|
2508
2544
|
r[i >> 1] >> 4 >= 8 && s[i] && (s[i] = s[i].toUpperCase()), (r[i >> 1] & 15) >= 8 && s[i + 1] && (s[i + 1] = s[i + 1].toUpperCase());
|
|
2509
2545
|
const a = `0x${s.join("")}`;
|
|
2510
|
-
return
|
|
2546
|
+
return et.set(`${e}.${t}`, a), a;
|
|
2511
2547
|
}
|
|
2512
|
-
class
|
|
2548
|
+
class Yt extends f {
|
|
2513
2549
|
constructor({ offset: t }) {
|
|
2514
2550
|
super(`Offset \`${t}\` cannot be negative.`, {
|
|
2515
2551
|
name: "NegativeOffsetError"
|
|
2516
2552
|
});
|
|
2517
2553
|
}
|
|
2518
2554
|
}
|
|
2519
|
-
class
|
|
2555
|
+
class Ls extends f {
|
|
2520
2556
|
constructor({ length: t, position: n }) {
|
|
2521
2557
|
super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`, { name: "PositionOutOfBoundsError" });
|
|
2522
2558
|
}
|
|
2523
2559
|
}
|
|
2524
|
-
class
|
|
2560
|
+
class Fs extends f {
|
|
2525
2561
|
constructor({ count: t, limit: n }) {
|
|
2526
2562
|
super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`, { name: "RecursiveReadLimitExceededError" });
|
|
2527
2563
|
}
|
|
2528
2564
|
}
|
|
2529
|
-
const
|
|
2565
|
+
const js = {
|
|
2530
2566
|
bytes: new Uint8Array(),
|
|
2531
2567
|
dataView: new DataView(new ArrayBuffer(0)),
|
|
2532
2568
|
position: 0,
|
|
@@ -2535,21 +2571,21 @@ const Fs = {
|
|
|
2535
2571
|
recursiveReadLimit: Number.POSITIVE_INFINITY,
|
|
2536
2572
|
assertReadLimit() {
|
|
2537
2573
|
if (this.recursiveReadCount >= this.recursiveReadLimit)
|
|
2538
|
-
throw new
|
|
2574
|
+
throw new Fs({
|
|
2539
2575
|
count: this.recursiveReadCount + 1,
|
|
2540
2576
|
limit: this.recursiveReadLimit
|
|
2541
2577
|
});
|
|
2542
2578
|
},
|
|
2543
2579
|
assertPosition(e) {
|
|
2544
2580
|
if (e < 0 || e > this.bytes.length - 1)
|
|
2545
|
-
throw new
|
|
2581
|
+
throw new Ls({
|
|
2546
2582
|
length: this.bytes.length,
|
|
2547
2583
|
position: e
|
|
2548
2584
|
});
|
|
2549
2585
|
},
|
|
2550
2586
|
decrementPosition(e) {
|
|
2551
2587
|
if (e < 0)
|
|
2552
|
-
throw new
|
|
2588
|
+
throw new Yt({ offset: e });
|
|
2553
2589
|
const t = this.position - e;
|
|
2554
2590
|
this.assertPosition(t), this.position = t;
|
|
2555
2591
|
},
|
|
@@ -2558,7 +2594,7 @@ const Fs = {
|
|
|
2558
2594
|
},
|
|
2559
2595
|
incrementPosition(e) {
|
|
2560
2596
|
if (e < 0)
|
|
2561
|
-
throw new
|
|
2597
|
+
throw new Yt({ offset: e });
|
|
2562
2598
|
const t = this.position + e;
|
|
2563
2599
|
this.assertPosition(t), this.position = t;
|
|
2564
2600
|
},
|
|
@@ -2648,67 +2684,67 @@ const Fs = {
|
|
|
2648
2684
|
this.positionReadCount.set(this.position, e + 1), e > 0 && this.recursiveReadCount++;
|
|
2649
2685
|
}
|
|
2650
2686
|
};
|
|
2651
|
-
function
|
|
2652
|
-
const n = Object.create(
|
|
2687
|
+
function zs(e, { recursiveReadLimit: t = 8192 } = {}) {
|
|
2688
|
+
const n = Object.create(js);
|
|
2653
2689
|
return n.bytes = e, n.dataView = new DataView(e.buffer ?? e, e.byteOffset, e.byteLength), n.positionReadCount = /* @__PURE__ */ new Map(), n.recursiveReadLimit = t, n;
|
|
2654
2690
|
}
|
|
2655
|
-
function
|
|
2656
|
-
return Re(e, { strict: !1 }) ?
|
|
2691
|
+
function ze(e, t, n, { strict: r } = {}) {
|
|
2692
|
+
return Re(e, { strict: !1 }) ? _s(e, t, n, {
|
|
2657
2693
|
strict: r
|
|
2658
|
-
}) :
|
|
2694
|
+
}) : Pn(e, t, n, {
|
|
2659
2695
|
strict: r
|
|
2660
2696
|
});
|
|
2661
2697
|
}
|
|
2662
|
-
function
|
|
2663
|
-
if (typeof t == "number" && t > 0 && t >
|
|
2664
|
-
throw new
|
|
2698
|
+
function vn(e, t) {
|
|
2699
|
+
if (typeof t == "number" && t > 0 && t > F(e) - 1)
|
|
2700
|
+
throw new sn({
|
|
2665
2701
|
offset: t,
|
|
2666
2702
|
position: "start",
|
|
2667
|
-
size:
|
|
2703
|
+
size: F(e)
|
|
2668
2704
|
});
|
|
2669
2705
|
}
|
|
2670
|
-
function
|
|
2671
|
-
if (typeof t == "number" && typeof n == "number" &&
|
|
2672
|
-
throw new
|
|
2706
|
+
function En(e, t, n) {
|
|
2707
|
+
if (typeof t == "number" && typeof n == "number" && F(e) !== n - t)
|
|
2708
|
+
throw new sn({
|
|
2673
2709
|
offset: n,
|
|
2674
2710
|
position: "end",
|
|
2675
|
-
size:
|
|
2711
|
+
size: F(e)
|
|
2676
2712
|
});
|
|
2677
2713
|
}
|
|
2678
|
-
function
|
|
2679
|
-
|
|
2714
|
+
function Pn(e, t, n, { strict: r } = {}) {
|
|
2715
|
+
vn(e, t);
|
|
2680
2716
|
const s = e.slice(t, n);
|
|
2681
|
-
return r &&
|
|
2717
|
+
return r && En(s, t, n), s;
|
|
2682
2718
|
}
|
|
2683
|
-
function
|
|
2684
|
-
|
|
2719
|
+
function _s(e, t, n, { strict: r } = {}) {
|
|
2720
|
+
vn(e, t);
|
|
2685
2721
|
const s = `0x${e.replace("0x", "").slice((t ?? 0) * 2, (n ?? e.length) * 2)}`;
|
|
2686
|
-
return r &&
|
|
2722
|
+
return r && En(s, t, n), s;
|
|
2687
2723
|
}
|
|
2688
|
-
function
|
|
2689
|
-
typeof t.size < "u" &&
|
|
2724
|
+
function Gs(e, t = {}) {
|
|
2725
|
+
typeof t.size < "u" && ne(e, { size: t.size });
|
|
2690
2726
|
const n = ue(e, t);
|
|
2691
|
-
return
|
|
2727
|
+
return cn(n, t);
|
|
2692
2728
|
}
|
|
2693
|
-
function
|
|
2729
|
+
function Hs(e, t = {}) {
|
|
2694
2730
|
let n = e;
|
|
2695
|
-
if (typeof t.size < "u" && (
|
|
2696
|
-
throw new
|
|
2731
|
+
if (typeof t.size < "u" && (ne(n, { size: t.size }), n = At(n)), n.length > 1 || n[0] > 1)
|
|
2732
|
+
throw new rs(n);
|
|
2697
2733
|
return !!n[0];
|
|
2698
2734
|
}
|
|
2699
2735
|
function ce(e, t = {}) {
|
|
2700
|
-
typeof t.size < "u" &&
|
|
2736
|
+
typeof t.size < "u" && ne(e, { size: t.size });
|
|
2701
2737
|
const n = ue(e, t);
|
|
2702
|
-
return
|
|
2738
|
+
return as(n, t);
|
|
2703
2739
|
}
|
|
2704
2740
|
function Vs(e, t = {}) {
|
|
2705
2741
|
let n = e;
|
|
2706
|
-
return typeof t.size < "u" && (
|
|
2742
|
+
return typeof t.size < "u" && (ne(n, { size: t.size }), n = At(n, { dir: "right" })), new TextDecoder().decode(n);
|
|
2707
2743
|
}
|
|
2708
2744
|
function Se(e) {
|
|
2709
|
-
return typeof e[0] == "string" ?
|
|
2745
|
+
return typeof e[0] == "string" ? kt(e) : Ws(e);
|
|
2710
2746
|
}
|
|
2711
|
-
function
|
|
2747
|
+
function Ws(e) {
|
|
2712
2748
|
let t = 0;
|
|
2713
2749
|
for (const s of e)
|
|
2714
2750
|
t += s.length;
|
|
@@ -2718,82 +2754,82 @@ function Hs(e) {
|
|
|
2718
2754
|
n.set(s, r), r += s.length;
|
|
2719
2755
|
return n;
|
|
2720
2756
|
}
|
|
2721
|
-
function
|
|
2757
|
+
function kt(e) {
|
|
2722
2758
|
return `0x${e.reduce((t, n) => t + n.replace("0x", ""), "")}`;
|
|
2723
2759
|
}
|
|
2724
|
-
const
|
|
2725
|
-
function
|
|
2760
|
+
const Ks = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
2761
|
+
function Sn(e, t) {
|
|
2726
2762
|
if (e.length !== t.length)
|
|
2727
|
-
throw new
|
|
2763
|
+
throw new Zr({
|
|
2728
2764
|
expectedLength: e.length,
|
|
2729
2765
|
givenLength: t.length
|
|
2730
2766
|
});
|
|
2731
|
-
const n =
|
|
2767
|
+
const n = Ys({
|
|
2732
2768
|
params: e,
|
|
2733
2769
|
values: t
|
|
2734
|
-
}), r =
|
|
2770
|
+
}), r = Nt(n);
|
|
2735
2771
|
return r.length === 0 ? "0x" : r;
|
|
2736
2772
|
}
|
|
2737
|
-
function
|
|
2773
|
+
function Ys({ params: e, values: t }) {
|
|
2738
2774
|
const n = [];
|
|
2739
2775
|
for (let r = 0; r < e.length; r++)
|
|
2740
|
-
n.push(
|
|
2776
|
+
n.push(It({ param: e[r], value: t[r] }));
|
|
2741
2777
|
return n;
|
|
2742
2778
|
}
|
|
2743
|
-
function
|
|
2744
|
-
const n =
|
|
2779
|
+
function It({ param: e, value: t }) {
|
|
2780
|
+
const n = Rt(e.type);
|
|
2745
2781
|
if (n) {
|
|
2746
2782
|
const [r, s] = n;
|
|
2747
|
-
return
|
|
2783
|
+
return Xs(t, { length: r, param: { ...e, type: s } });
|
|
2748
2784
|
}
|
|
2749
2785
|
if (e.type === "tuple")
|
|
2750
|
-
return
|
|
2786
|
+
return ta(t, {
|
|
2751
2787
|
param: e
|
|
2752
2788
|
});
|
|
2753
2789
|
if (e.type === "address")
|
|
2754
|
-
return
|
|
2790
|
+
return Zs(t);
|
|
2755
2791
|
if (e.type === "bool")
|
|
2756
|
-
return
|
|
2792
|
+
return Qs(t);
|
|
2757
2793
|
if (e.type.startsWith("uint") || e.type.startsWith("int")) {
|
|
2758
|
-
const r = e.type.startsWith("int"), [, , s = "256"] =
|
|
2759
|
-
return
|
|
2794
|
+
const r = e.type.startsWith("int"), [, , s = "256"] = Ks.exec(e.type) ?? [];
|
|
2795
|
+
return qs(t, {
|
|
2760
2796
|
signed: r,
|
|
2761
2797
|
size: Number(s)
|
|
2762
2798
|
});
|
|
2763
2799
|
}
|
|
2764
2800
|
if (e.type.startsWith("bytes"))
|
|
2765
|
-
return
|
|
2801
|
+
return Js(t, { param: e });
|
|
2766
2802
|
if (e.type === "string")
|
|
2767
|
-
return
|
|
2768
|
-
throw new
|
|
2803
|
+
return ea(t);
|
|
2804
|
+
throw new Qr(e.type, {
|
|
2769
2805
|
docsPath: "/docs/contract/encodeAbiParameters"
|
|
2770
2806
|
});
|
|
2771
2807
|
}
|
|
2772
|
-
function
|
|
2808
|
+
function Nt(e) {
|
|
2773
2809
|
let t = 0;
|
|
2774
2810
|
for (let a = 0; a < e.length; a++) {
|
|
2775
2811
|
const { dynamic: i, encoded: o } = e[a];
|
|
2776
|
-
i ? t += 32 : t +=
|
|
2812
|
+
i ? t += 32 : t += F(o);
|
|
2777
2813
|
}
|
|
2778
2814
|
const n = [], r = [];
|
|
2779
2815
|
let s = 0;
|
|
2780
2816
|
for (let a = 0; a < e.length; a++) {
|
|
2781
2817
|
const { dynamic: i, encoded: o } = e[a];
|
|
2782
|
-
i ? (n.push(k(t + s, { size: 32 })), r.push(o), s +=
|
|
2818
|
+
i ? (n.push(k(t + s, { size: 32 })), r.push(o), s += F(o)) : n.push(o);
|
|
2783
2819
|
}
|
|
2784
2820
|
return Se([...n, ...r]);
|
|
2785
2821
|
}
|
|
2786
|
-
function
|
|
2822
|
+
function Zs(e) {
|
|
2787
2823
|
if (!ge(e))
|
|
2788
|
-
throw new
|
|
2824
|
+
throw new Fe({ address: e });
|
|
2789
2825
|
return { dynamic: !1, encoded: pe(e.toLowerCase()) };
|
|
2790
2826
|
}
|
|
2791
|
-
function
|
|
2827
|
+
function Xs(e, { length: t, param: n }) {
|
|
2792
2828
|
const r = t === null;
|
|
2793
2829
|
if (!Array.isArray(e))
|
|
2794
|
-
throw new
|
|
2830
|
+
throw new es(e);
|
|
2795
2831
|
if (!r && e.length !== t)
|
|
2796
|
-
throw new
|
|
2832
|
+
throw new Kr({
|
|
2797
2833
|
expectedLength: t,
|
|
2798
2834
|
givenLength: e.length,
|
|
2799
2835
|
type: `${n.type}[${t}]`
|
|
@@ -2801,11 +2837,11 @@ function Zs(e, { length: t, param: n }) {
|
|
|
2801
2837
|
let s = !1;
|
|
2802
2838
|
const a = [];
|
|
2803
2839
|
for (let i = 0; i < e.length; i++) {
|
|
2804
|
-
const o =
|
|
2840
|
+
const o = It({ param: n, value: e[i] });
|
|
2805
2841
|
o.dynamic && (s = !0), a.push(o);
|
|
2806
2842
|
}
|
|
2807
2843
|
if (r || s) {
|
|
2808
|
-
const i =
|
|
2844
|
+
const i = Nt(a);
|
|
2809
2845
|
if (r) {
|
|
2810
2846
|
const o = k(a.length, { size: 32 });
|
|
2811
2847
|
return {
|
|
@@ -2821,8 +2857,8 @@ function Zs(e, { length: t, param: n }) {
|
|
|
2821
2857
|
encoded: Se(a.map(({ encoded: i }) => i))
|
|
2822
2858
|
};
|
|
2823
2859
|
}
|
|
2824
|
-
function
|
|
2825
|
-
const [, n] = t.type.split("bytes"), r =
|
|
2860
|
+
function Js(e, { param: t }) {
|
|
2861
|
+
const [, n] = t.type.split("bytes"), r = F(e);
|
|
2826
2862
|
if (!n) {
|
|
2827
2863
|
let s = e;
|
|
2828
2864
|
return r % 32 !== 0 && (s = pe(s, {
|
|
@@ -2834,22 +2870,22 @@ function Xs(e, { param: t }) {
|
|
|
2834
2870
|
};
|
|
2835
2871
|
}
|
|
2836
2872
|
if (r !== Number.parseInt(n, 10))
|
|
2837
|
-
throw new
|
|
2873
|
+
throw new Yr({
|
|
2838
2874
|
expectedSize: Number.parseInt(n, 10),
|
|
2839
2875
|
value: e
|
|
2840
2876
|
});
|
|
2841
2877
|
return { dynamic: !1, encoded: pe(e, { dir: "right" }) };
|
|
2842
2878
|
}
|
|
2843
|
-
function
|
|
2879
|
+
function Qs(e) {
|
|
2844
2880
|
if (typeof e != "boolean")
|
|
2845
2881
|
throw new f(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
|
|
2846
|
-
return { dynamic: !1, encoded: pe(
|
|
2882
|
+
return { dynamic: !1, encoded: pe(un(e)) };
|
|
2847
2883
|
}
|
|
2848
|
-
function
|
|
2884
|
+
function qs(e, { signed: t, size: n = 256 }) {
|
|
2849
2885
|
if (typeof n == "number") {
|
|
2850
2886
|
const r = 2n ** (BigInt(n) - (t ? 1n : 0n)) - 1n, s = t ? -r - 1n : 0n;
|
|
2851
2887
|
if (e > r || e < s)
|
|
2852
|
-
throw new
|
|
2888
|
+
throw new on({
|
|
2853
2889
|
max: r.toString(),
|
|
2854
2890
|
min: s.toString(),
|
|
2855
2891
|
signed: t,
|
|
@@ -2865,25 +2901,25 @@ function Qs(e, { signed: t, size: n = 256 }) {
|
|
|
2865
2901
|
})
|
|
2866
2902
|
};
|
|
2867
2903
|
}
|
|
2868
|
-
function
|
|
2869
|
-
const t =
|
|
2904
|
+
function ea(e) {
|
|
2905
|
+
const t = dn(e), n = Math.ceil(F(t) / 32), r = [];
|
|
2870
2906
|
for (let s = 0; s < n; s++)
|
|
2871
|
-
r.push(pe(
|
|
2907
|
+
r.push(pe(ze(t, s * 32, (s + 1) * 32), {
|
|
2872
2908
|
dir: "right"
|
|
2873
2909
|
}));
|
|
2874
2910
|
return {
|
|
2875
2911
|
dynamic: !0,
|
|
2876
2912
|
encoded: Se([
|
|
2877
|
-
pe(k(
|
|
2913
|
+
pe(k(F(t), { size: 32 })),
|
|
2878
2914
|
...r
|
|
2879
2915
|
])
|
|
2880
2916
|
};
|
|
2881
2917
|
}
|
|
2882
|
-
function
|
|
2918
|
+
function ta(e, { param: t }) {
|
|
2883
2919
|
let n = !1;
|
|
2884
2920
|
const r = [];
|
|
2885
2921
|
for (let s = 0; s < t.components.length; s++) {
|
|
2886
|
-
const a = t.components[s], i = Array.isArray(e) ? s : a.name, o =
|
|
2922
|
+
const a = t.components[s], i = Array.isArray(e) ? s : a.name, o = It({
|
|
2887
2923
|
param: a,
|
|
2888
2924
|
value: e[i]
|
|
2889
2925
|
});
|
|
@@ -2891,25 +2927,25 @@ function ea(e, { param: t }) {
|
|
|
2891
2927
|
}
|
|
2892
2928
|
return {
|
|
2893
2929
|
dynamic: n,
|
|
2894
|
-
encoded: n ?
|
|
2930
|
+
encoded: n ? Nt(r) : Se(r.map(({ encoded: s }) => s))
|
|
2895
2931
|
};
|
|
2896
2932
|
}
|
|
2897
|
-
function
|
|
2933
|
+
function Rt(e) {
|
|
2898
2934
|
const t = e.match(/^(.*)\[(\d+)?\]$/);
|
|
2899
2935
|
return t ? (
|
|
2900
2936
|
// Return `null` if the array is dynamic.
|
|
2901
2937
|
[t[2] ? Number(t[2]) : null, t[1]]
|
|
2902
2938
|
) : void 0;
|
|
2903
2939
|
}
|
|
2904
|
-
function
|
|
2905
|
-
const n = typeof t == "string" ?
|
|
2906
|
-
if (
|
|
2907
|
-
throw new
|
|
2908
|
-
if (
|
|
2909
|
-
throw new
|
|
2940
|
+
function An(e, t) {
|
|
2941
|
+
const n = typeof t == "string" ? $t(t) : t, r = zs(n);
|
|
2942
|
+
if (F(n) === 0 && e.length > 0)
|
|
2943
|
+
throw new St();
|
|
2944
|
+
if (F(t) && F(t) < 32)
|
|
2945
|
+
throw new Wr({
|
|
2910
2946
|
data: typeof t == "string" ? t : ue(t),
|
|
2911
2947
|
params: e,
|
|
2912
|
-
size:
|
|
2948
|
+
size: F(t)
|
|
2913
2949
|
});
|
|
2914
2950
|
let s = 0;
|
|
2915
2951
|
const a = [];
|
|
@@ -2924,50 +2960,50 @@ function Sn(e, t) {
|
|
|
2924
2960
|
return a;
|
|
2925
2961
|
}
|
|
2926
2962
|
function Ee(e, t, { staticPosition: n }) {
|
|
2927
|
-
const r =
|
|
2963
|
+
const r = Rt(t.type);
|
|
2928
2964
|
if (r) {
|
|
2929
2965
|
const [s, a] = r;
|
|
2930
|
-
return
|
|
2966
|
+
return ra(e, { ...t, type: a }, { length: s, staticPosition: n });
|
|
2931
2967
|
}
|
|
2932
2968
|
if (t.type === "tuple")
|
|
2933
|
-
return
|
|
2969
|
+
return oa(e, t, { staticPosition: n });
|
|
2934
2970
|
if (t.type === "address")
|
|
2935
|
-
return
|
|
2971
|
+
return na(e);
|
|
2936
2972
|
if (t.type === "bool")
|
|
2937
|
-
return
|
|
2973
|
+
return sa(e);
|
|
2938
2974
|
if (t.type.startsWith("bytes"))
|
|
2939
|
-
return
|
|
2975
|
+
return aa(e, t, { staticPosition: n });
|
|
2940
2976
|
if (t.type.startsWith("uint") || t.type.startsWith("int"))
|
|
2941
|
-
return
|
|
2977
|
+
return ia(e, t);
|
|
2942
2978
|
if (t.type === "string")
|
|
2943
|
-
return
|
|
2944
|
-
throw new
|
|
2979
|
+
return ca(e, { staticPosition: n });
|
|
2980
|
+
throw new qr(t.type, {
|
|
2945
2981
|
docsPath: "/docs/contract/decodeAbiParameters"
|
|
2946
2982
|
});
|
|
2947
2983
|
}
|
|
2948
|
-
const
|
|
2949
|
-
function
|
|
2984
|
+
const Zt = 32, it = 32;
|
|
2985
|
+
function na(e) {
|
|
2950
2986
|
const t = e.readBytes(32);
|
|
2951
|
-
return [
|
|
2987
|
+
return [Tn(ue(Pn(t, -20))), 32];
|
|
2952
2988
|
}
|
|
2953
|
-
function
|
|
2989
|
+
function ra(e, t, { length: n, staticPosition: r }) {
|
|
2954
2990
|
if (!n) {
|
|
2955
|
-
const i = ce(e.readBytes(
|
|
2991
|
+
const i = ce(e.readBytes(it)), o = r + i, c = o + Zt;
|
|
2956
2992
|
e.setPosition(o);
|
|
2957
|
-
const d = ce(e.readBytes(
|
|
2958
|
-
let
|
|
2959
|
-
const
|
|
2960
|
-
for (let
|
|
2961
|
-
e.setPosition(c + (l ?
|
|
2962
|
-
const [
|
|
2993
|
+
const d = ce(e.readBytes(Zt)), l = Ne(t);
|
|
2994
|
+
let m = 0;
|
|
2995
|
+
const y = [];
|
|
2996
|
+
for (let p = 0; p < d; ++p) {
|
|
2997
|
+
e.setPosition(c + (l ? p * 32 : m));
|
|
2998
|
+
const [b, v] = Ee(e, t, {
|
|
2963
2999
|
staticPosition: c
|
|
2964
3000
|
});
|
|
2965
|
-
|
|
3001
|
+
m += v, y.push(b);
|
|
2966
3002
|
}
|
|
2967
|
-
return e.setPosition(r + 32), [
|
|
3003
|
+
return e.setPosition(r + 32), [y, 32];
|
|
2968
3004
|
}
|
|
2969
3005
|
if (Ne(t)) {
|
|
2970
|
-
const i = ce(e.readBytes(
|
|
3006
|
+
const i = ce(e.readBytes(it)), o = r + i, c = [];
|
|
2971
3007
|
for (let d = 0; d < n; ++d) {
|
|
2972
3008
|
e.setPosition(o + d * 32);
|
|
2973
3009
|
const [l] = Ee(e, t, {
|
|
@@ -2987,10 +3023,10 @@ function na(e, t, { length: n, staticPosition: r }) {
|
|
|
2987
3023
|
}
|
|
2988
3024
|
return [a, s];
|
|
2989
3025
|
}
|
|
2990
|
-
function
|
|
2991
|
-
return [
|
|
3026
|
+
function sa(e) {
|
|
3027
|
+
return [Hs(e.readBytes(32), { size: 32 }), 32];
|
|
2992
3028
|
}
|
|
2993
|
-
function
|
|
3029
|
+
function aa(e, t, { staticPosition: n }) {
|
|
2994
3030
|
const [r, s] = t.type.split("bytes");
|
|
2995
3031
|
if (!s) {
|
|
2996
3032
|
const i = ce(e.readBytes(32));
|
|
@@ -3003,25 +3039,25 @@ function sa(e, t, { staticPosition: n }) {
|
|
|
3003
3039
|
}
|
|
3004
3040
|
return [ue(e.readBytes(Number.parseInt(s, 10), 32)), 32];
|
|
3005
3041
|
}
|
|
3006
|
-
function
|
|
3042
|
+
function ia(e, t) {
|
|
3007
3043
|
const n = t.type.startsWith("int"), r = Number.parseInt(t.type.split("int")[1] || "256", 10), s = e.readBytes(32);
|
|
3008
3044
|
return [
|
|
3009
|
-
r > 48 ?
|
|
3045
|
+
r > 48 ? Gs(s, { signed: n }) : ce(s, { signed: n }),
|
|
3010
3046
|
32
|
|
3011
3047
|
];
|
|
3012
3048
|
}
|
|
3013
|
-
function
|
|
3049
|
+
function oa(e, t, { staticPosition: n }) {
|
|
3014
3050
|
const r = t.components.length === 0 || t.components.some(({ name: i }) => !i), s = r ? [] : {};
|
|
3015
3051
|
let a = 0;
|
|
3016
3052
|
if (Ne(t)) {
|
|
3017
|
-
const i = ce(e.readBytes(
|
|
3053
|
+
const i = ce(e.readBytes(it)), o = n + i;
|
|
3018
3054
|
for (let c = 0; c < t.components.length; ++c) {
|
|
3019
3055
|
const d = t.components[c];
|
|
3020
3056
|
e.setPosition(o + a);
|
|
3021
|
-
const [l,
|
|
3057
|
+
const [l, m] = Ee(e, d, {
|
|
3022
3058
|
staticPosition: o
|
|
3023
3059
|
});
|
|
3024
|
-
a +=
|
|
3060
|
+
a += m, s[r ? c : d?.name] = l;
|
|
3025
3061
|
}
|
|
3026
3062
|
return e.setPosition(n + 32), [s, 32];
|
|
3027
3063
|
}
|
|
@@ -3033,13 +3069,13 @@ function ia(e, t, { staticPosition: n }) {
|
|
|
3033
3069
|
}
|
|
3034
3070
|
return [s, a];
|
|
3035
3071
|
}
|
|
3036
|
-
function
|
|
3072
|
+
function ca(e, { staticPosition: t }) {
|
|
3037
3073
|
const n = ce(e.readBytes(32)), r = t + n;
|
|
3038
3074
|
e.setPosition(r);
|
|
3039
3075
|
const s = ce(e.readBytes(32));
|
|
3040
3076
|
if (s === 0)
|
|
3041
3077
|
return e.setPosition(t + 32), ["", 32];
|
|
3042
|
-
const a = e.readBytes(s, 32), i = Vs(
|
|
3078
|
+
const a = e.readBytes(s, 32), i = Vs(At(a));
|
|
3043
3079
|
return e.setPosition(t + 32), [i, 32];
|
|
3044
3080
|
}
|
|
3045
3081
|
function Ne(e) {
|
|
@@ -3048,23 +3084,23 @@ function Ne(e) {
|
|
|
3048
3084
|
return !0;
|
|
3049
3085
|
if (t === "tuple")
|
|
3050
3086
|
return e.components?.some(Ne);
|
|
3051
|
-
const n =
|
|
3087
|
+
const n = Rt(e.type);
|
|
3052
3088
|
return !!(n && Ne({ ...e, type: n[1] }));
|
|
3053
3089
|
}
|
|
3054
|
-
const
|
|
3055
|
-
function
|
|
3056
|
-
return
|
|
3090
|
+
const ua = (e) => wn(ln(e));
|
|
3091
|
+
function da(e) {
|
|
3092
|
+
return ua(e);
|
|
3057
3093
|
}
|
|
3058
|
-
const
|
|
3059
|
-
let
|
|
3094
|
+
const la = "1.2.3";
|
|
3095
|
+
let Q = class ot extends Error {
|
|
3060
3096
|
constructor(t, n = {}) {
|
|
3061
|
-
const r = n.cause instanceof
|
|
3097
|
+
const r = n.cause instanceof ot ? n.cause.details : n.cause?.message ? n.cause.message : n.details, s = n.cause instanceof ot && n.cause.docsPath || n.docsPath, a = [
|
|
3062
3098
|
t || "An error occurred.",
|
|
3063
3099
|
"",
|
|
3064
3100
|
...n.metaMessages ? [...n.metaMessages, ""] : [],
|
|
3065
3101
|
...s ? [`Docs: https://abitype.dev${s}`] : [],
|
|
3066
3102
|
...r ? [`Details: ${r}`] : [],
|
|
3067
|
-
`Version: abitype@${
|
|
3103
|
+
`Version: abitype@${la}`
|
|
3068
3104
|
].join(`
|
|
3069
3105
|
`);
|
|
3070
3106
|
super(a), Object.defineProperty(this, "details", {
|
|
@@ -3098,18 +3134,18 @@ let X = class it extends Error {
|
|
|
3098
3134
|
function de(e, t) {
|
|
3099
3135
|
return e.exec(t)?.groups;
|
|
3100
3136
|
}
|
|
3101
|
-
const
|
|
3102
|
-
function
|
|
3137
|
+
const $n = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, Cn = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/, kn = /^\(.+?\).*?$/, Xt = /^tuple(?<array>(\[(\d*)\])*)$/;
|
|
3138
|
+
function ct(e) {
|
|
3103
3139
|
let t = e.type;
|
|
3104
|
-
if (
|
|
3140
|
+
if (Xt.test(e.type) && "components" in e) {
|
|
3105
3141
|
t = "(";
|
|
3106
3142
|
const n = e.components.length;
|
|
3107
3143
|
for (let s = 0; s < n; s++) {
|
|
3108
3144
|
const a = e.components[s];
|
|
3109
|
-
t +=
|
|
3145
|
+
t += ct(a), s < n - 1 && (t += ", ");
|
|
3110
3146
|
}
|
|
3111
|
-
const r = de(
|
|
3112
|
-
return t += `)${r?.array || ""}`,
|
|
3147
|
+
const r = de(Xt, e.type);
|
|
3148
|
+
return t += `)${r?.array || ""}`, ct({
|
|
3113
3149
|
...e,
|
|
3114
3150
|
type: t
|
|
3115
3151
|
});
|
|
@@ -3121,65 +3157,65 @@ function Ie(e) {
|
|
|
3121
3157
|
const n = e.length;
|
|
3122
3158
|
for (let r = 0; r < n; r++) {
|
|
3123
3159
|
const s = e[r];
|
|
3124
|
-
t +=
|
|
3160
|
+
t += ct(s), r !== n - 1 && (t += ", ");
|
|
3125
3161
|
}
|
|
3126
3162
|
return t;
|
|
3127
3163
|
}
|
|
3128
|
-
function la(e) {
|
|
3129
|
-
return e.type === "function" ? `function ${e.name}(${Ie(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${e.outputs?.length ? ` returns (${Ie(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${Ie(e.inputs)})` : e.type === "error" ? `error ${e.name}(${Ie(e.inputs)})` : e.type === "constructor" ? `constructor(${Ie(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? `fallback() external${e.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
|
|
3130
|
-
}
|
|
3131
|
-
const kn = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3132
3164
|
function fa(e) {
|
|
3133
|
-
return
|
|
3165
|
+
return e.type === "function" ? `function ${e.name}(${Ie(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${e.outputs?.length ? ` returns (${Ie(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${Ie(e.inputs)})` : e.type === "error" ? `error ${e.name}(${Ie(e.inputs)})` : e.type === "constructor" ? `constructor(${Ie(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? `fallback() external${e.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
|
|
3134
3166
|
}
|
|
3167
|
+
const In = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3135
3168
|
function pa(e) {
|
|
3136
|
-
return de(kn, e);
|
|
3137
|
-
}
|
|
3138
|
-
const In = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3139
|
-
function ma(e) {
|
|
3140
3169
|
return In.test(e);
|
|
3141
3170
|
}
|
|
3142
|
-
function
|
|
3171
|
+
function ma(e) {
|
|
3143
3172
|
return de(In, e);
|
|
3144
3173
|
}
|
|
3145
|
-
const Nn = /^
|
|
3146
|
-
function
|
|
3174
|
+
const Nn = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3175
|
+
function ya(e) {
|
|
3147
3176
|
return Nn.test(e);
|
|
3148
3177
|
}
|
|
3149
|
-
function
|
|
3178
|
+
function ba(e) {
|
|
3150
3179
|
return de(Nn, e);
|
|
3151
3180
|
}
|
|
3152
|
-
const Rn = /^
|
|
3153
|
-
function
|
|
3181
|
+
const Rn = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
|
|
3182
|
+
function ha(e) {
|
|
3154
3183
|
return Rn.test(e);
|
|
3155
3184
|
}
|
|
3156
3185
|
function ga(e) {
|
|
3157
3186
|
return de(Rn, e);
|
|
3158
3187
|
}
|
|
3159
|
-
const
|
|
3188
|
+
const Mn = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
|
|
3189
|
+
function Dn(e) {
|
|
3190
|
+
return Mn.test(e);
|
|
3191
|
+
}
|
|
3160
3192
|
function wa(e) {
|
|
3161
|
-
return
|
|
3193
|
+
return de(Mn, e);
|
|
3162
3194
|
}
|
|
3195
|
+
const On = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
|
|
3163
3196
|
function xa(e) {
|
|
3164
|
-
return
|
|
3197
|
+
return On.test(e);
|
|
3165
3198
|
}
|
|
3166
|
-
const On = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
|
|
3167
3199
|
function Ta(e) {
|
|
3168
|
-
return On
|
|
3200
|
+
return de(On, e);
|
|
3169
3201
|
}
|
|
3202
|
+
const Bn = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
|
|
3170
3203
|
function va(e) {
|
|
3171
|
-
return
|
|
3204
|
+
return Bn.test(e);
|
|
3172
3205
|
}
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
return Ea.test(e);
|
|
3206
|
+
function Ea(e) {
|
|
3207
|
+
return de(Bn, e);
|
|
3176
3208
|
}
|
|
3177
|
-
const
|
|
3209
|
+
const Pa = /^receive\(\) external payable$/;
|
|
3210
|
+
function Sa(e) {
|
|
3211
|
+
return Pa.test(e);
|
|
3212
|
+
}
|
|
3213
|
+
const Aa = /* @__PURE__ */ new Set(["indexed"]), ut = /* @__PURE__ */ new Set([
|
|
3178
3214
|
"calldata",
|
|
3179
3215
|
"memory",
|
|
3180
3216
|
"storage"
|
|
3181
3217
|
]);
|
|
3182
|
-
class
|
|
3218
|
+
class $a extends Q {
|
|
3183
3219
|
constructor({ type: t }) {
|
|
3184
3220
|
super("Unknown type.", {
|
|
3185
3221
|
metaMessages: [
|
|
@@ -3193,7 +3229,7 @@ class Aa extends X {
|
|
|
3193
3229
|
});
|
|
3194
3230
|
}
|
|
3195
3231
|
}
|
|
3196
|
-
class
|
|
3232
|
+
class Ca extends Q {
|
|
3197
3233
|
constructor({ type: t }) {
|
|
3198
3234
|
super("Unknown type.", {
|
|
3199
3235
|
metaMessages: [`Type "${t}" is not a valid ABI type.`]
|
|
@@ -3205,7 +3241,7 @@ class $a extends X {
|
|
|
3205
3241
|
});
|
|
3206
3242
|
}
|
|
3207
3243
|
}
|
|
3208
|
-
class
|
|
3244
|
+
class ka extends Q {
|
|
3209
3245
|
constructor({ param: t }) {
|
|
3210
3246
|
super("Invalid ABI parameter.", {
|
|
3211
3247
|
details: t
|
|
@@ -3217,7 +3253,7 @@ class Ca extends X {
|
|
|
3217
3253
|
});
|
|
3218
3254
|
}
|
|
3219
3255
|
}
|
|
3220
|
-
class
|
|
3256
|
+
class Ia extends Q {
|
|
3221
3257
|
constructor({ param: t, name: n }) {
|
|
3222
3258
|
super("Invalid ABI parameter.", {
|
|
3223
3259
|
details: t,
|
|
@@ -3232,7 +3268,7 @@ class ka extends X {
|
|
|
3232
3268
|
});
|
|
3233
3269
|
}
|
|
3234
3270
|
}
|
|
3235
|
-
class
|
|
3271
|
+
class Na extends Q {
|
|
3236
3272
|
constructor({ param: t, type: n, modifier: r }) {
|
|
3237
3273
|
super("Invalid ABI parameter.", {
|
|
3238
3274
|
details: t,
|
|
@@ -3247,7 +3283,7 @@ class Ia extends X {
|
|
|
3247
3283
|
});
|
|
3248
3284
|
}
|
|
3249
3285
|
}
|
|
3250
|
-
class
|
|
3286
|
+
class Ra extends Q {
|
|
3251
3287
|
constructor({ param: t, type: n, modifier: r }) {
|
|
3252
3288
|
super("Invalid ABI parameter.", {
|
|
3253
3289
|
details: t,
|
|
@@ -3263,7 +3299,7 @@ class Na extends X {
|
|
|
3263
3299
|
});
|
|
3264
3300
|
}
|
|
3265
3301
|
}
|
|
3266
|
-
class
|
|
3302
|
+
class Ma extends Q {
|
|
3267
3303
|
constructor({ abiParameter: t }) {
|
|
3268
3304
|
super("Invalid ABI parameter.", {
|
|
3269
3305
|
details: JSON.stringify(t, null, 2),
|
|
@@ -3276,7 +3312,7 @@ class Ra extends X {
|
|
|
3276
3312
|
});
|
|
3277
3313
|
}
|
|
3278
3314
|
}
|
|
3279
|
-
class $e extends
|
|
3315
|
+
class $e extends Q {
|
|
3280
3316
|
constructor({ signature: t, type: n }) {
|
|
3281
3317
|
super(`Invalid ${n} signature.`, {
|
|
3282
3318
|
details: t
|
|
@@ -3288,7 +3324,7 @@ class $e extends X {
|
|
|
3288
3324
|
});
|
|
3289
3325
|
}
|
|
3290
3326
|
}
|
|
3291
|
-
class
|
|
3327
|
+
class Da extends Q {
|
|
3292
3328
|
constructor({ signature: t }) {
|
|
3293
3329
|
super("Unknown signature.", {
|
|
3294
3330
|
details: t
|
|
@@ -3300,7 +3336,7 @@ class Ma extends X {
|
|
|
3300
3336
|
});
|
|
3301
3337
|
}
|
|
3302
3338
|
}
|
|
3303
|
-
class
|
|
3339
|
+
class Oa extends Q {
|
|
3304
3340
|
constructor({ signature: t }) {
|
|
3305
3341
|
super("Invalid struct signature.", {
|
|
3306
3342
|
details: t,
|
|
@@ -3313,7 +3349,7 @@ class Da extends X {
|
|
|
3313
3349
|
});
|
|
3314
3350
|
}
|
|
3315
3351
|
}
|
|
3316
|
-
class
|
|
3352
|
+
class Ba extends Q {
|
|
3317
3353
|
constructor({ type: t }) {
|
|
3318
3354
|
super("Circular reference detected.", {
|
|
3319
3355
|
metaMessages: [`Struct "${t}" is a circular reference.`]
|
|
@@ -3325,7 +3361,7 @@ class Oa extends X {
|
|
|
3325
3361
|
});
|
|
3326
3362
|
}
|
|
3327
3363
|
}
|
|
3328
|
-
class
|
|
3364
|
+
class Ua extends Q {
|
|
3329
3365
|
constructor({ current: t, depth: n }) {
|
|
3330
3366
|
super("Unbalanced parentheses.", {
|
|
3331
3367
|
metaMessages: [
|
|
@@ -3340,7 +3376,7 @@ class Ba extends X {
|
|
|
3340
3376
|
});
|
|
3341
3377
|
}
|
|
3342
3378
|
}
|
|
3343
|
-
function
|
|
3379
|
+
function La(e, t, n) {
|
|
3344
3380
|
let r = "";
|
|
3345
3381
|
if (n)
|
|
3346
3382
|
for (const s of Object.entries(n)) {
|
|
@@ -3353,7 +3389,7 @@ function Ua(e, t, n) {
|
|
|
3353
3389
|
}
|
|
3354
3390
|
return t ? `${t}:${e}${r}` : `${e}${r}`;
|
|
3355
3391
|
}
|
|
3356
|
-
const
|
|
3392
|
+
const tt = /* @__PURE__ */ new Map([
|
|
3357
3393
|
// Unnamed
|
|
3358
3394
|
["address", { type: "address" }],
|
|
3359
3395
|
["bool", { type: "bool" }],
|
|
@@ -3407,41 +3443,41 @@ const et = /* @__PURE__ */ new Map([
|
|
|
3407
3443
|
{ type: "uint256", name: "tokenId", indexed: !0 }
|
|
3408
3444
|
]
|
|
3409
3445
|
]);
|
|
3410
|
-
function
|
|
3411
|
-
if (
|
|
3412
|
-
return Fa(e, t);
|
|
3413
|
-
if (ma(e))
|
|
3446
|
+
function Fa(e, t = {}) {
|
|
3447
|
+
if (ha(e))
|
|
3414
3448
|
return ja(e, t);
|
|
3415
|
-
if (
|
|
3449
|
+
if (ya(e))
|
|
3416
3450
|
return za(e, t);
|
|
3417
|
-
if (
|
|
3451
|
+
if (pa(e))
|
|
3418
3452
|
return _a(e, t);
|
|
3419
|
-
if (
|
|
3420
|
-
return Ga(e);
|
|
3421
|
-
if (
|
|
3453
|
+
if (xa(e))
|
|
3454
|
+
return Ga(e, t);
|
|
3455
|
+
if (va(e))
|
|
3456
|
+
return Ha(e);
|
|
3457
|
+
if (Sa(e))
|
|
3422
3458
|
return {
|
|
3423
3459
|
type: "receive",
|
|
3424
3460
|
stateMutability: "payable"
|
|
3425
3461
|
};
|
|
3426
|
-
throw new
|
|
3462
|
+
throw new Da({ signature: e });
|
|
3427
3463
|
}
|
|
3428
|
-
function
|
|
3429
|
-
const n =
|
|
3464
|
+
function ja(e, t = {}) {
|
|
3465
|
+
const n = ga(e);
|
|
3430
3466
|
if (!n)
|
|
3431
3467
|
throw new $e({ signature: e, type: "function" });
|
|
3432
|
-
const r =
|
|
3468
|
+
const r = ee(n.parameters), s = [], a = r.length;
|
|
3433
3469
|
for (let o = 0; o < a; o++)
|
|
3434
3470
|
s.push(we(r[o], {
|
|
3435
|
-
modifiers:
|
|
3471
|
+
modifiers: ut,
|
|
3436
3472
|
structs: t,
|
|
3437
3473
|
type: "function"
|
|
3438
3474
|
}));
|
|
3439
3475
|
const i = [];
|
|
3440
3476
|
if (n.returns) {
|
|
3441
|
-
const o =
|
|
3477
|
+
const o = ee(n.returns), c = o.length;
|
|
3442
3478
|
for (let d = 0; d < c; d++)
|
|
3443
3479
|
i.push(we(o[d], {
|
|
3444
|
-
modifiers:
|
|
3480
|
+
modifiers: ut,
|
|
3445
3481
|
structs: t,
|
|
3446
3482
|
type: "function"
|
|
3447
3483
|
}));
|
|
@@ -3454,33 +3490,33 @@ function Fa(e, t = {}) {
|
|
|
3454
3490
|
outputs: i
|
|
3455
3491
|
};
|
|
3456
3492
|
}
|
|
3457
|
-
function
|
|
3458
|
-
const n =
|
|
3493
|
+
function za(e, t = {}) {
|
|
3494
|
+
const n = ba(e);
|
|
3459
3495
|
if (!n)
|
|
3460
3496
|
throw new $e({ signature: e, type: "event" });
|
|
3461
|
-
const r =
|
|
3497
|
+
const r = ee(n.parameters), s = [], a = r.length;
|
|
3462
3498
|
for (let i = 0; i < a; i++)
|
|
3463
3499
|
s.push(we(r[i], {
|
|
3464
|
-
modifiers:
|
|
3500
|
+
modifiers: Aa,
|
|
3465
3501
|
structs: t,
|
|
3466
3502
|
type: "event"
|
|
3467
3503
|
}));
|
|
3468
3504
|
return { name: n.name, type: "event", inputs: s };
|
|
3469
3505
|
}
|
|
3470
|
-
function
|
|
3471
|
-
const n =
|
|
3506
|
+
function _a(e, t = {}) {
|
|
3507
|
+
const n = ma(e);
|
|
3472
3508
|
if (!n)
|
|
3473
3509
|
throw new $e({ signature: e, type: "error" });
|
|
3474
|
-
const r =
|
|
3510
|
+
const r = ee(n.parameters), s = [], a = r.length;
|
|
3475
3511
|
for (let i = 0; i < a; i++)
|
|
3476
3512
|
s.push(we(r[i], { structs: t, type: "error" }));
|
|
3477
3513
|
return { name: n.name, type: "error", inputs: s };
|
|
3478
3514
|
}
|
|
3479
|
-
function
|
|
3480
|
-
const n =
|
|
3515
|
+
function Ga(e, t = {}) {
|
|
3516
|
+
const n = Ta(e);
|
|
3481
3517
|
if (!n)
|
|
3482
3518
|
throw new $e({ signature: e, type: "constructor" });
|
|
3483
|
-
const r =
|
|
3519
|
+
const r = ee(n.parameters), s = [], a = r.length;
|
|
3484
3520
|
for (let i = 0; i < a; i++)
|
|
3485
3521
|
s.push(we(r[i], { structs: t, type: "constructor" }));
|
|
3486
3522
|
return {
|
|
@@ -3489,8 +3525,8 @@ function _a(e, t = {}) {
|
|
|
3489
3525
|
inputs: s
|
|
3490
3526
|
};
|
|
3491
3527
|
}
|
|
3492
|
-
function
|
|
3493
|
-
const t =
|
|
3528
|
+
function Ha(e) {
|
|
3529
|
+
const t = Ea(e);
|
|
3494
3530
|
if (!t)
|
|
3495
3531
|
throw new $e({ signature: e, type: "fallback" });
|
|
3496
3532
|
return {
|
|
@@ -3498,41 +3534,41 @@ function Ga(e) {
|
|
|
3498
3534
|
stateMutability: t.stateMutability ?? "nonpayable"
|
|
3499
3535
|
};
|
|
3500
3536
|
}
|
|
3501
|
-
const Va = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,
|
|
3537
|
+
const Va = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, Wa = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, Ka = /^u?int$/;
|
|
3502
3538
|
function we(e, t) {
|
|
3503
|
-
const n =
|
|
3504
|
-
if (
|
|
3505
|
-
return
|
|
3506
|
-
const r =
|
|
3539
|
+
const n = La(e, t?.type, t?.structs);
|
|
3540
|
+
if (tt.has(n))
|
|
3541
|
+
return tt.get(n);
|
|
3542
|
+
const r = kn.test(e), s = de(r ? Wa : Va, e);
|
|
3507
3543
|
if (!s)
|
|
3508
|
-
throw new
|
|
3509
|
-
if (s.name &&
|
|
3510
|
-
throw new
|
|
3544
|
+
throw new ka({ param: e });
|
|
3545
|
+
if (s.name && Za(s.name))
|
|
3546
|
+
throw new Ia({ param: e, name: s.name });
|
|
3511
3547
|
const a = s.name ? { name: s.name } : {}, i = s.modifier === "indexed" ? { indexed: !0 } : {}, o = t?.structs ?? {};
|
|
3512
3548
|
let c, d = {};
|
|
3513
3549
|
if (r) {
|
|
3514
3550
|
c = "tuple";
|
|
3515
|
-
const
|
|
3516
|
-
for (let
|
|
3517
|
-
|
|
3518
|
-
d = { components:
|
|
3551
|
+
const m = ee(s.type), y = [], p = m.length;
|
|
3552
|
+
for (let b = 0; b < p; b++)
|
|
3553
|
+
y.push(we(m[b], { structs: o }));
|
|
3554
|
+
d = { components: y };
|
|
3519
3555
|
} else if (s.type in o)
|
|
3520
3556
|
c = "tuple", d = { components: o[s.type] };
|
|
3521
|
-
else if (
|
|
3557
|
+
else if (Ka.test(s.type))
|
|
3522
3558
|
c = `${s.type}256`;
|
|
3523
3559
|
else if (s.type === "address payable")
|
|
3524
3560
|
c = "address";
|
|
3525
|
-
else if (c = s.type, t?.type !== "struct" && !
|
|
3526
|
-
throw new
|
|
3561
|
+
else if (c = s.type, t?.type !== "struct" && !Un(c))
|
|
3562
|
+
throw new Ca({ type: c });
|
|
3527
3563
|
if (s.modifier) {
|
|
3528
3564
|
if (!t?.modifiers?.has?.(s.modifier))
|
|
3529
|
-
throw new
|
|
3565
|
+
throw new Na({
|
|
3530
3566
|
param: e,
|
|
3531
3567
|
type: t?.type,
|
|
3532
3568
|
modifier: s.modifier
|
|
3533
3569
|
});
|
|
3534
|
-
if (
|
|
3535
|
-
throw new
|
|
3570
|
+
if (ut.has(s.modifier) && !Xa(c, !!s.array))
|
|
3571
|
+
throw new Ra({
|
|
3536
3572
|
param: e,
|
|
3537
3573
|
type: t?.type,
|
|
3538
3574
|
modifier: s.modifier
|
|
@@ -3544,106 +3580,106 @@ function we(e, t) {
|
|
|
3544
3580
|
...i,
|
|
3545
3581
|
...d
|
|
3546
3582
|
};
|
|
3547
|
-
return
|
|
3583
|
+
return tt.set(n, l), l;
|
|
3548
3584
|
}
|
|
3549
|
-
function
|
|
3585
|
+
function ee(e, t = [], n = "", r = 0) {
|
|
3550
3586
|
const s = e.trim().length;
|
|
3551
3587
|
for (let a = 0; a < s; a++) {
|
|
3552
3588
|
const i = e[a], o = e.slice(a + 1);
|
|
3553
3589
|
switch (i) {
|
|
3554
3590
|
case ",":
|
|
3555
|
-
return r === 0 ?
|
|
3591
|
+
return r === 0 ? ee(o, [...t, n.trim()]) : ee(o, t, `${n}${i}`, r);
|
|
3556
3592
|
case "(":
|
|
3557
|
-
return
|
|
3593
|
+
return ee(o, t, `${n}${i}`, r + 1);
|
|
3558
3594
|
case ")":
|
|
3559
|
-
return
|
|
3595
|
+
return ee(o, t, `${n}${i}`, r - 1);
|
|
3560
3596
|
default:
|
|
3561
|
-
return
|
|
3597
|
+
return ee(o, t, `${n}${i}`, r);
|
|
3562
3598
|
}
|
|
3563
3599
|
}
|
|
3564
3600
|
if (n === "")
|
|
3565
3601
|
return t;
|
|
3566
3602
|
if (r !== 0)
|
|
3567
|
-
throw new
|
|
3603
|
+
throw new Ua({ current: n, depth: r });
|
|
3568
3604
|
return t.push(n.trim()), t;
|
|
3569
3605
|
}
|
|
3570
|
-
function
|
|
3571
|
-
return e === "address" || e === "bool" || e === "function" || e === "string" ||
|
|
3606
|
+
function Un(e) {
|
|
3607
|
+
return e === "address" || e === "bool" || e === "function" || e === "string" || $n.test(e) || Cn.test(e);
|
|
3572
3608
|
}
|
|
3573
|
-
const
|
|
3574
|
-
function
|
|
3575
|
-
return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" ||
|
|
3609
|
+
const Ya = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
|
|
3610
|
+
function Za(e) {
|
|
3611
|
+
return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || $n.test(e) || Cn.test(e) || Ya.test(e);
|
|
3576
3612
|
}
|
|
3577
|
-
function
|
|
3613
|
+
function Xa(e, t) {
|
|
3578
3614
|
return t || e === "bytes" || e === "string" || e === "tuple";
|
|
3579
3615
|
}
|
|
3580
|
-
function
|
|
3616
|
+
function Ja(e) {
|
|
3581
3617
|
const t = {}, n = e.length;
|
|
3582
3618
|
for (let i = 0; i < n; i++) {
|
|
3583
3619
|
const o = e[i];
|
|
3584
|
-
if (!
|
|
3620
|
+
if (!Dn(o))
|
|
3585
3621
|
continue;
|
|
3586
|
-
const c =
|
|
3622
|
+
const c = wa(o);
|
|
3587
3623
|
if (!c)
|
|
3588
3624
|
throw new $e({ signature: o, type: "struct" });
|
|
3589
|
-
const d = c.properties.split(";"), l = [],
|
|
3590
|
-
for (let
|
|
3591
|
-
const
|
|
3592
|
-
if (!
|
|
3625
|
+
const d = c.properties.split(";"), l = [], m = d.length;
|
|
3626
|
+
for (let y = 0; y < m; y++) {
|
|
3627
|
+
const b = d[y].trim();
|
|
3628
|
+
if (!b)
|
|
3593
3629
|
continue;
|
|
3594
|
-
const v = we(
|
|
3630
|
+
const v = we(b, {
|
|
3595
3631
|
type: "struct"
|
|
3596
3632
|
});
|
|
3597
3633
|
l.push(v);
|
|
3598
3634
|
}
|
|
3599
3635
|
if (!l.length)
|
|
3600
|
-
throw new
|
|
3636
|
+
throw new Oa({ signature: o });
|
|
3601
3637
|
t[c.name] = l;
|
|
3602
3638
|
}
|
|
3603
3639
|
const r = {}, s = Object.entries(t), a = s.length;
|
|
3604
3640
|
for (let i = 0; i < a; i++) {
|
|
3605
3641
|
const [o, c] = s[i];
|
|
3606
|
-
r[o] =
|
|
3642
|
+
r[o] = Ln(c, t);
|
|
3607
3643
|
}
|
|
3608
3644
|
return r;
|
|
3609
3645
|
}
|
|
3610
|
-
const
|
|
3611
|
-
function
|
|
3646
|
+
const Qa = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
|
|
3647
|
+
function Ln(e = [], t = {}, n = /* @__PURE__ */ new Set()) {
|
|
3612
3648
|
const r = [], s = e.length;
|
|
3613
3649
|
for (let a = 0; a < s; a++) {
|
|
3614
3650
|
const i = e[a];
|
|
3615
|
-
if (
|
|
3651
|
+
if (kn.test(i.type))
|
|
3616
3652
|
r.push(i);
|
|
3617
3653
|
else {
|
|
3618
|
-
const c = de(
|
|
3654
|
+
const c = de(Qa, i.type);
|
|
3619
3655
|
if (!c?.type)
|
|
3620
|
-
throw new
|
|
3656
|
+
throw new Ma({ abiParameter: i });
|
|
3621
3657
|
const { array: d, type: l } = c;
|
|
3622
3658
|
if (l in t) {
|
|
3623
3659
|
if (n.has(l))
|
|
3624
|
-
throw new
|
|
3660
|
+
throw new Ba({ type: l });
|
|
3625
3661
|
r.push({
|
|
3626
3662
|
...i,
|
|
3627
3663
|
type: `tuple${d ?? ""}`,
|
|
3628
|
-
components:
|
|
3664
|
+
components: Ln(t[l], t, /* @__PURE__ */ new Set([...n, l]))
|
|
3629
3665
|
});
|
|
3630
|
-
} else if (
|
|
3666
|
+
} else if (Un(l))
|
|
3631
3667
|
r.push(i);
|
|
3632
3668
|
else
|
|
3633
|
-
throw new
|
|
3669
|
+
throw new $a({ type: l });
|
|
3634
3670
|
}
|
|
3635
3671
|
}
|
|
3636
3672
|
return r;
|
|
3637
3673
|
}
|
|
3638
|
-
function
|
|
3639
|
-
const t =
|
|
3674
|
+
function Fn(e) {
|
|
3675
|
+
const t = Ja(e), n = [], r = e.length;
|
|
3640
3676
|
for (let s = 0; s < r; s++) {
|
|
3641
3677
|
const a = e[s];
|
|
3642
|
-
|
|
3678
|
+
Dn(a) || n.push(Fa(a, t));
|
|
3643
3679
|
}
|
|
3644
3680
|
return n;
|
|
3645
3681
|
}
|
|
3646
|
-
function
|
|
3682
|
+
function qa(e) {
|
|
3647
3683
|
let t = !0, n = "", r = 0, s = "", a = !1;
|
|
3648
3684
|
for (let i = 0; i < e.length; i++) {
|
|
3649
3685
|
const o = e[i];
|
|
@@ -3668,16 +3704,16 @@ function Qa(e) {
|
|
|
3668
3704
|
throw new f("Unable to normalize signature.");
|
|
3669
3705
|
return s;
|
|
3670
3706
|
}
|
|
3671
|
-
const
|
|
3672
|
-
const t = typeof e == "string" ? e :
|
|
3673
|
-
return
|
|
3707
|
+
const ei = (e) => {
|
|
3708
|
+
const t = typeof e == "string" ? e : fa(e);
|
|
3709
|
+
return qa(t);
|
|
3674
3710
|
};
|
|
3675
|
-
function
|
|
3676
|
-
return
|
|
3711
|
+
function jn(e) {
|
|
3712
|
+
return da(ei(e));
|
|
3677
3713
|
}
|
|
3678
|
-
const
|
|
3679
|
-
function
|
|
3680
|
-
const { abi: t, args: n = [], name: r } = e, s = Re(r, { strict: !1 }), a = t.filter((o) => s ? o.type === "function" ?
|
|
3714
|
+
const ti = jn, Mt = (e) => ze(jn(e), 0, 4);
|
|
3715
|
+
function Dt(e) {
|
|
3716
|
+
const { abi: t, args: n = [], name: r } = e, s = Re(r, { strict: !1 }), a = t.filter((o) => s ? o.type === "function" ? Mt(o) === r : o.type === "event" ? ti(o) === r : !1 : "name" in o && o.name === r);
|
|
3681
3717
|
if (a.length === 0)
|
|
3682
3718
|
return;
|
|
3683
3719
|
if (a.length === 1)
|
|
@@ -3694,13 +3730,13 @@ function Mt(e) {
|
|
|
3694
3730
|
if (!o.inputs || o.inputs.length === 0 || o.inputs.length !== n.length)
|
|
3695
3731
|
continue;
|
|
3696
3732
|
if (n.every((d, l) => {
|
|
3697
|
-
const
|
|
3698
|
-
return
|
|
3733
|
+
const m = "inputs" in o && o.inputs[l];
|
|
3734
|
+
return m ? dt(d, m) : !1;
|
|
3699
3735
|
})) {
|
|
3700
3736
|
if (i && "inputs" in i && i.inputs) {
|
|
3701
|
-
const d =
|
|
3737
|
+
const d = zn(o.inputs, i.inputs, n);
|
|
3702
3738
|
if (d)
|
|
3703
|
-
throw new
|
|
3739
|
+
throw new Jr({
|
|
3704
3740
|
abiItem: o,
|
|
3705
3741
|
type: d[0]
|
|
3706
3742
|
}, {
|
|
@@ -3713,7 +3749,7 @@ function Mt(e) {
|
|
|
3713
3749
|
}
|
|
3714
3750
|
return i || a[0];
|
|
3715
3751
|
}
|
|
3716
|
-
function
|
|
3752
|
+
function dt(e, t) {
|
|
3717
3753
|
const n = typeof e, r = t.type;
|
|
3718
3754
|
switch (r) {
|
|
3719
3755
|
case "address":
|
|
@@ -3725,69 +3761,69 @@ function ut(e, t) {
|
|
|
3725
3761
|
case "string":
|
|
3726
3762
|
return n === "string";
|
|
3727
3763
|
default:
|
|
3728
|
-
return r === "tuple" && "components" in t ? Object.values(t.components).every((s, a) => n === "object" &&
|
|
3764
|
+
return r === "tuple" && "components" in t ? Object.values(t.components).every((s, a) => n === "object" && dt(Object.values(e)[a], s)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r) ? n === "number" || n === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r) ? n === "string" || e instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r) ? Array.isArray(e) && e.every((s) => dt(s, {
|
|
3729
3765
|
...t,
|
|
3730
3766
|
// Pop off `[]` or `[M]` from end of type
|
|
3731
3767
|
type: r.replace(/(\[[0-9]{0,}\])$/, "")
|
|
3732
3768
|
})) : !1;
|
|
3733
3769
|
}
|
|
3734
3770
|
}
|
|
3735
|
-
function
|
|
3771
|
+
function zn(e, t, n) {
|
|
3736
3772
|
for (const r in e) {
|
|
3737
3773
|
const s = e[r], a = t[r];
|
|
3738
3774
|
if (s.type === "tuple" && a.type === "tuple" && "components" in s && "components" in a)
|
|
3739
|
-
return
|
|
3775
|
+
return zn(s.components, a.components, n[r]);
|
|
3740
3776
|
const i = [s.type, a.type];
|
|
3741
3777
|
if (i.includes("address") && i.includes("bytes20") ? !0 : i.includes("address") && i.includes("string") ? ge(n[r], { strict: !1 }) : i.includes("address") && i.includes("bytes") ? ge(n[r], { strict: !1 }) : !1)
|
|
3742
3778
|
return i;
|
|
3743
3779
|
}
|
|
3744
3780
|
}
|
|
3745
|
-
const
|
|
3746
|
-
function
|
|
3781
|
+
const nt = "/docs/contract/decodeFunctionResult";
|
|
3782
|
+
function _n(e) {
|
|
3747
3783
|
const { abi: t, args: n, functionName: r, data: s } = e;
|
|
3748
3784
|
let a = t[0];
|
|
3749
3785
|
if (r) {
|
|
3750
|
-
const o =
|
|
3786
|
+
const o = Dt({ abi: t, args: n, name: r });
|
|
3751
3787
|
if (!o)
|
|
3752
|
-
throw new
|
|
3788
|
+
throw new Le(r, { docsPath: nt });
|
|
3753
3789
|
a = o;
|
|
3754
3790
|
}
|
|
3755
3791
|
if (a.type !== "function")
|
|
3756
|
-
throw new
|
|
3792
|
+
throw new Le(void 0, { docsPath: nt });
|
|
3757
3793
|
if (!a.outputs)
|
|
3758
|
-
throw new
|
|
3759
|
-
const i =
|
|
3794
|
+
throw new Xr(a.name, { docsPath: nt });
|
|
3795
|
+
const i = An(a.outputs, s);
|
|
3760
3796
|
if (i && i.length > 1)
|
|
3761
3797
|
return i;
|
|
3762
3798
|
if (i && i.length === 1)
|
|
3763
3799
|
return i[0];
|
|
3764
3800
|
}
|
|
3765
|
-
const
|
|
3766
|
-
function
|
|
3801
|
+
const Jt = "/docs/contract/encodeFunctionData";
|
|
3802
|
+
function ni(e) {
|
|
3767
3803
|
const { abi: t, args: n, functionName: r } = e;
|
|
3768
3804
|
let s = t[0];
|
|
3769
3805
|
if (r) {
|
|
3770
|
-
const a =
|
|
3806
|
+
const a = Dt({
|
|
3771
3807
|
abi: t,
|
|
3772
3808
|
args: n,
|
|
3773
3809
|
name: r
|
|
3774
3810
|
});
|
|
3775
3811
|
if (!a)
|
|
3776
|
-
throw new
|
|
3812
|
+
throw new Le(r, { docsPath: Jt });
|
|
3777
3813
|
s = a;
|
|
3778
3814
|
}
|
|
3779
3815
|
if (s.type !== "function")
|
|
3780
|
-
throw new
|
|
3816
|
+
throw new Le(void 0, { docsPath: Jt });
|
|
3781
3817
|
return {
|
|
3782
3818
|
abi: [s],
|
|
3783
|
-
functionName:
|
|
3819
|
+
functionName: Mt(Pe(s))
|
|
3784
3820
|
};
|
|
3785
3821
|
}
|
|
3786
|
-
function
|
|
3787
|
-
const { args: t } = e, { abi: n, functionName: r } = e.abi.length === 1 && e.functionName?.startsWith("0x") ? e :
|
|
3788
|
-
return
|
|
3822
|
+
function Gn(e) {
|
|
3823
|
+
const { args: t } = e, { abi: n, functionName: r } = e.abi.length === 1 && e.functionName?.startsWith("0x") ? e : ni(e), s = n[0], a = r, i = "inputs" in s && s.inputs ? Sn(s.inputs, t ?? []) : void 0;
|
|
3824
|
+
return kt([a, i ?? "0x"]);
|
|
3789
3825
|
}
|
|
3790
|
-
class
|
|
3826
|
+
class lt extends f {
|
|
3791
3827
|
constructor({ blockNumber: t, chain: n, contract: r }) {
|
|
3792
3828
|
super(`Chain "${n.name}" does not support contract "${r.name}".`, {
|
|
3793
3829
|
metaMessages: [
|
|
@@ -3802,22 +3838,22 @@ class dt extends f {
|
|
|
3802
3838
|
});
|
|
3803
3839
|
}
|
|
3804
3840
|
}
|
|
3805
|
-
class
|
|
3841
|
+
class Hn extends f {
|
|
3806
3842
|
constructor() {
|
|
3807
3843
|
super("No chain was provided to the Client.", {
|
|
3808
3844
|
name: "ClientChainNotConfiguredError"
|
|
3809
3845
|
});
|
|
3810
3846
|
}
|
|
3811
3847
|
}
|
|
3812
|
-
function
|
|
3848
|
+
function ri({ blockNumber: e, chain: t, contract: n }) {
|
|
3813
3849
|
const r = t?.contracts?.[n];
|
|
3814
3850
|
if (!r)
|
|
3815
|
-
throw new
|
|
3851
|
+
throw new lt({
|
|
3816
3852
|
chain: t,
|
|
3817
3853
|
contract: { name: n }
|
|
3818
3854
|
});
|
|
3819
3855
|
if (e && r.blockCreated && r.blockCreated > e)
|
|
3820
|
-
throw new
|
|
3856
|
+
throw new lt({
|
|
3821
3857
|
blockNumber: e,
|
|
3822
3858
|
chain: t,
|
|
3823
3859
|
contract: {
|
|
@@ -3827,10 +3863,10 @@ function ni({ blockNumber: e, chain: t, contract: n }) {
|
|
|
3827
3863
|
});
|
|
3828
3864
|
return r.address;
|
|
3829
3865
|
}
|
|
3830
|
-
function
|
|
3866
|
+
function Ot(e) {
|
|
3831
3867
|
return typeof e == "string" ? { address: e, type: "json-rpc" } : e;
|
|
3832
3868
|
}
|
|
3833
|
-
const
|
|
3869
|
+
const si = {
|
|
3834
3870
|
1: "An `assert` condition failed.",
|
|
3835
3871
|
17: "Arithmetic operation resulted in underflow or overflow.",
|
|
3836
3872
|
18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
|
|
@@ -3840,7 +3876,7 @@ const ri = {
|
|
|
3840
3876
|
50: "Array index is out of bounds.",
|
|
3841
3877
|
65: "Allocated too much memory or created an array which is too large.",
|
|
3842
3878
|
81: "Attempted to call a zero-initialized variable of internal function type."
|
|
3843
|
-
},
|
|
3879
|
+
}, ai = {
|
|
3844
3880
|
inputs: [
|
|
3845
3881
|
{
|
|
3846
3882
|
name: "message",
|
|
@@ -3849,7 +3885,7 @@ const ri = {
|
|
|
3849
3885
|
],
|
|
3850
3886
|
name: "Error",
|
|
3851
3887
|
type: "error"
|
|
3852
|
-
},
|
|
3888
|
+
}, ii = {
|
|
3853
3889
|
inputs: [
|
|
3854
3890
|
{
|
|
3855
3891
|
name: "reason",
|
|
@@ -3859,34 +3895,34 @@ const ri = {
|
|
|
3859
3895
|
name: "Panic",
|
|
3860
3896
|
type: "error"
|
|
3861
3897
|
};
|
|
3862
|
-
function
|
|
3863
|
-
const { abi: t, data: n } = e, r =
|
|
3898
|
+
function oi(e) {
|
|
3899
|
+
const { abi: t, data: n } = e, r = ze(n, 0, 4);
|
|
3864
3900
|
if (r === "0x")
|
|
3865
|
-
throw new
|
|
3866
|
-
const a = [...t || [],
|
|
3901
|
+
throw new St();
|
|
3902
|
+
const a = [...t || [], ai, ii].find((i) => i.type === "error" && r === Mt(Pe(i)));
|
|
3867
3903
|
if (!a)
|
|
3868
|
-
throw new
|
|
3904
|
+
throw new rn(r, {
|
|
3869
3905
|
docsPath: "/docs/contract/decodeErrorResult"
|
|
3870
3906
|
});
|
|
3871
3907
|
return {
|
|
3872
3908
|
abiItem: a,
|
|
3873
|
-
args: "inputs" in a && a.inputs && a.inputs.length > 0 ?
|
|
3909
|
+
args: "inputs" in a && a.inputs && a.inputs.length > 0 ? An(a.inputs, ze(n, 4)) : void 0,
|
|
3874
3910
|
errorName: a.name
|
|
3875
3911
|
};
|
|
3876
3912
|
}
|
|
3877
|
-
const
|
|
3913
|
+
const Bt = (e, t, n) => JSON.stringify(e, (r, s) => typeof s == "bigint" ? s.toString() : s, n);
|
|
3878
3914
|
function Vn({ abiItem: e, args: t, includeFunctionName: n = !0, includeName: r = !1 }) {
|
|
3879
3915
|
if ("name" in e && "inputs" in e && e.inputs)
|
|
3880
|
-
return `${n ? e.name : ""}(${e.inputs.map((s, a) => `${r && s.name ? `${s.name}: ` : ""}${typeof t[a] == "object" ?
|
|
3916
|
+
return `${n ? e.name : ""}(${e.inputs.map((s, a) => `${r && s.name ? `${s.name}: ` : ""}${typeof t[a] == "object" ? Bt(t[a]) : t[a]}`).join(", ")})`;
|
|
3881
3917
|
}
|
|
3882
|
-
const
|
|
3918
|
+
const ci = {
|
|
3883
3919
|
gwei: 9,
|
|
3884
3920
|
wei: 18
|
|
3885
|
-
},
|
|
3921
|
+
}, ui = {
|
|
3886
3922
|
ether: -9,
|
|
3887
3923
|
wei: 9
|
|
3888
3924
|
};
|
|
3889
|
-
function
|
|
3925
|
+
function Wn(e, t) {
|
|
3890
3926
|
let n = e.toString();
|
|
3891
3927
|
const r = n.startsWith("-");
|
|
3892
3928
|
r && (n = n.slice(1)), n = n.padStart(t, "0");
|
|
@@ -3896,31 +3932,31 @@ function Hn(e, t) {
|
|
|
3896
3932
|
];
|
|
3897
3933
|
return a = a.replace(/(0+)$/, ""), `${r ? "-" : ""}${s || "0"}${a ? `.${a}` : ""}`;
|
|
3898
3934
|
}
|
|
3899
|
-
function
|
|
3900
|
-
return
|
|
3935
|
+
function di(e, t = "wei") {
|
|
3936
|
+
return Wn(e, ci[t]);
|
|
3901
3937
|
}
|
|
3902
3938
|
function he(e, t = "wei") {
|
|
3903
|
-
return
|
|
3939
|
+
return Wn(e, ui[t]);
|
|
3904
3940
|
}
|
|
3905
|
-
class
|
|
3941
|
+
class li extends f {
|
|
3906
3942
|
constructor({ address: t }) {
|
|
3907
3943
|
super(`State for account "${t}" is set multiple times.`, {
|
|
3908
3944
|
name: "AccountStateConflictError"
|
|
3909
3945
|
});
|
|
3910
3946
|
}
|
|
3911
3947
|
}
|
|
3912
|
-
class
|
|
3948
|
+
class fi extends f {
|
|
3913
3949
|
constructor() {
|
|
3914
3950
|
super("state and stateDiff are set on the same account.", {
|
|
3915
3951
|
name: "StateAssignmentConflictError"
|
|
3916
3952
|
});
|
|
3917
3953
|
}
|
|
3918
3954
|
}
|
|
3919
|
-
function
|
|
3955
|
+
function Qt(e) {
|
|
3920
3956
|
return e.reduce((t, { slot: n, value: r }) => `${t} ${n}: ${r}
|
|
3921
3957
|
`, "");
|
|
3922
3958
|
}
|
|
3923
|
-
function
|
|
3959
|
+
function pi(e) {
|
|
3924
3960
|
return e.reduce((t, { address: n, ...r }) => {
|
|
3925
3961
|
let s = `${t} ${n}:
|
|
3926
3962
|
`;
|
|
@@ -3928,24 +3964,24 @@ function fi(e) {
|
|
|
3928
3964
|
`), r.balance && (s += ` balance: ${r.balance}
|
|
3929
3965
|
`), r.code && (s += ` code: ${r.code}
|
|
3930
3966
|
`), r.state && (s += ` state:
|
|
3931
|
-
`, s +=
|
|
3932
|
-
`, s +=
|
|
3967
|
+
`, s += Qt(r.state)), r.stateDiff && (s += ` stateDiff:
|
|
3968
|
+
`, s += Qt(r.stateDiff)), s;
|
|
3933
3969
|
}, ` State Override:
|
|
3934
3970
|
`).slice(0, -1);
|
|
3935
3971
|
}
|
|
3936
|
-
function
|
|
3972
|
+
function Kn(e) {
|
|
3937
3973
|
const t = Object.entries(e).map(([r, s]) => s === void 0 || s === !1 ? null : [r, s]).filter(Boolean), n = t.reduce((r, [s]) => Math.max(r, s.length), 0);
|
|
3938
3974
|
return t.map(([r, s]) => ` ${`${r}:`.padEnd(n + 1)} ${s}`).join(`
|
|
3939
3975
|
`);
|
|
3940
3976
|
}
|
|
3941
|
-
const
|
|
3942
|
-
class
|
|
3943
|
-
constructor(t, { account: n, docsPath: r, chain: s, data: a, gas: i, gasPrice: o, maxFeePerGas: c, maxPriorityFeePerGas: d, nonce: l, to:
|
|
3944
|
-
const
|
|
3945
|
-
let v =
|
|
3946
|
-
from:
|
|
3947
|
-
to:
|
|
3948
|
-
value: typeof
|
|
3977
|
+
const mi = (e) => e, Yn = (e) => e;
|
|
3978
|
+
class yi extends f {
|
|
3979
|
+
constructor(t, { account: n, docsPath: r, chain: s, data: a, gas: i, gasPrice: o, maxFeePerGas: c, maxPriorityFeePerGas: d, nonce: l, to: m, value: y, stateOverride: p }) {
|
|
3980
|
+
const b = n ? Ot(n) : void 0;
|
|
3981
|
+
let v = Kn({
|
|
3982
|
+
from: b?.address,
|
|
3983
|
+
to: m,
|
|
3984
|
+
value: typeof y < "u" && `${di(y)} ${s?.nativeCurrency?.symbol || "ETH"}`,
|
|
3949
3985
|
data: a,
|
|
3950
3986
|
gas: i,
|
|
3951
3987
|
gasPrice: typeof o < "u" && `${he(o)} gwei`,
|
|
@@ -3953,8 +3989,8 @@ class mi extends f {
|
|
|
3953
3989
|
maxPriorityFeePerGas: typeof d < "u" && `${he(d)} gwei`,
|
|
3954
3990
|
nonce: l
|
|
3955
3991
|
});
|
|
3956
|
-
|
|
3957
|
-
${
|
|
3992
|
+
p && (v += `
|
|
3993
|
+
${pi(p)}`), super(t.shortMessage, {
|
|
3958
3994
|
cause: t,
|
|
3959
3995
|
docsPath: r,
|
|
3960
3996
|
metaMessages: [
|
|
@@ -3971,15 +4007,15 @@ ${fi(m)}`), super(t.shortMessage, {
|
|
|
3971
4007
|
}), this.cause = t;
|
|
3972
4008
|
}
|
|
3973
4009
|
}
|
|
3974
|
-
class
|
|
4010
|
+
class bi extends f {
|
|
3975
4011
|
constructor(t, { abi: n, args: r, contractAddress: s, docsPath: a, functionName: i, sender: o }) {
|
|
3976
|
-
const c =
|
|
4012
|
+
const c = Dt({ abi: n, args: r, name: i }), d = c ? Vn({
|
|
3977
4013
|
abiItem: c,
|
|
3978
4014
|
args: r,
|
|
3979
4015
|
includeFunctionName: !1,
|
|
3980
4016
|
includeName: !1
|
|
3981
|
-
}) : void 0, l = c ? Pe(c, { includeName: !0 }) : void 0,
|
|
3982
|
-
address: s &&
|
|
4017
|
+
}) : void 0, l = c ? Pe(c, { includeName: !0 }) : void 0, m = Kn({
|
|
4018
|
+
address: s && mi(s),
|
|
3983
4019
|
function: l,
|
|
3984
4020
|
args: d && d !== "()" && `${[...Array(i?.length ?? 0).keys()].map(() => " ").join("")}${d}`,
|
|
3985
4021
|
sender: o
|
|
@@ -3989,8 +4025,8 @@ class yi extends f {
|
|
|
3989
4025
|
docsPath: a,
|
|
3990
4026
|
metaMessages: [
|
|
3991
4027
|
...t.metaMessages ? [...t.metaMessages, " "] : [],
|
|
3992
|
-
|
|
3993
|
-
|
|
4028
|
+
m && "Contract Call:",
|
|
4029
|
+
m
|
|
3994
4030
|
].filter(Boolean),
|
|
3995
4031
|
name: "ContractFunctionExecutionError"
|
|
3996
4032
|
}), Object.defineProperty(this, "abi", {
|
|
@@ -4031,28 +4067,28 @@ class yi extends f {
|
|
|
4031
4067
|
}), this.abi = n, this.args = r, this.cause = t, this.contractAddress = s, this.functionName = i, this.sender = o;
|
|
4032
4068
|
}
|
|
4033
4069
|
}
|
|
4034
|
-
class
|
|
4070
|
+
class hi extends f {
|
|
4035
4071
|
constructor({ abi: t, data: n, functionName: r, message: s }) {
|
|
4036
4072
|
let a, i, o, c;
|
|
4037
4073
|
if (n && n !== "0x")
|
|
4038
4074
|
try {
|
|
4039
|
-
i =
|
|
4040
|
-
const { abiItem: l, errorName:
|
|
4041
|
-
if (
|
|
4042
|
-
c =
|
|
4043
|
-
else if (
|
|
4044
|
-
const [
|
|
4045
|
-
c =
|
|
4075
|
+
i = oi({ abi: t, data: n });
|
|
4076
|
+
const { abiItem: l, errorName: m, args: y } = i;
|
|
4077
|
+
if (m === "Error")
|
|
4078
|
+
c = y[0];
|
|
4079
|
+
else if (m === "Panic") {
|
|
4080
|
+
const [p] = y;
|
|
4081
|
+
c = si[p];
|
|
4046
4082
|
} else {
|
|
4047
|
-
const
|
|
4083
|
+
const p = l ? Pe(l, { includeName: !0 }) : void 0, b = l && y ? Vn({
|
|
4048
4084
|
abiItem: l,
|
|
4049
|
-
args:
|
|
4085
|
+
args: y,
|
|
4050
4086
|
includeFunctionName: !1,
|
|
4051
4087
|
includeName: !1
|
|
4052
4088
|
}) : void 0;
|
|
4053
4089
|
o = [
|
|
4054
|
-
|
|
4055
|
-
|
|
4090
|
+
p ? `Error: ${p}` : "",
|
|
4091
|
+
b && b !== "()" ? ` ${[...Array(m?.length ?? 0).keys()].map(() => " ").join("")}${b}` : ""
|
|
4056
4092
|
];
|
|
4057
4093
|
}
|
|
4058
4094
|
} catch (l) {
|
|
@@ -4060,7 +4096,7 @@ class bi extends f {
|
|
|
4060
4096
|
}
|
|
4061
4097
|
else s && (c = s);
|
|
4062
4098
|
let d;
|
|
4063
|
-
a instanceof
|
|
4099
|
+
a instanceof rn && (d = a.signature, o = [
|
|
4064
4100
|
`Unable to decode signature "${d}" as it was not found on the provided ABI.`,
|
|
4065
4101
|
"Make sure you are using the correct ABI and that the error exists on it.",
|
|
4066
4102
|
`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${d}.`
|
|
@@ -4095,7 +4131,7 @@ class bi extends f {
|
|
|
4095
4131
|
}), this.data = i, this.raw = n, this.reason = c, this.signature = d;
|
|
4096
4132
|
}
|
|
4097
4133
|
}
|
|
4098
|
-
class
|
|
4134
|
+
class gi extends f {
|
|
4099
4135
|
constructor({ functionName: t }) {
|
|
4100
4136
|
super(`The contract function "${t}" returned no data ("0x").`, {
|
|
4101
4137
|
metaMessages: [
|
|
@@ -4108,7 +4144,7 @@ class hi extends f {
|
|
|
4108
4144
|
});
|
|
4109
4145
|
}
|
|
4110
4146
|
}
|
|
4111
|
-
class
|
|
4147
|
+
class wi extends f {
|
|
4112
4148
|
constructor({ factory: t }) {
|
|
4113
4149
|
super(`Deployment for counterfactual contract call failed${t ? ` for factory "${t}".` : ""}`, {
|
|
4114
4150
|
metaMessages: [
|
|
@@ -4120,7 +4156,7 @@ class gi extends f {
|
|
|
4120
4156
|
});
|
|
4121
4157
|
}
|
|
4122
4158
|
}
|
|
4123
|
-
class
|
|
4159
|
+
class Zn extends f {
|
|
4124
4160
|
constructor({ data: t, message: n }) {
|
|
4125
4161
|
super(n || "", { name: "RawContractError" }), Object.defineProperty(this, "code", {
|
|
4126
4162
|
enumerable: !0,
|
|
@@ -4135,22 +4171,22 @@ class Yn extends f {
|
|
|
4135
4171
|
}), this.data = t;
|
|
4136
4172
|
}
|
|
4137
4173
|
}
|
|
4138
|
-
function
|
|
4174
|
+
function xi(e, t, n) {
|
|
4139
4175
|
const r = e[t.name];
|
|
4140
4176
|
if (typeof r == "function")
|
|
4141
4177
|
return r;
|
|
4142
4178
|
const s = e[n];
|
|
4143
4179
|
return typeof s == "function" ? s : (a) => t(e, a);
|
|
4144
4180
|
}
|
|
4145
|
-
class
|
|
4181
|
+
class ko extends f {
|
|
4146
4182
|
constructor({ body: t, cause: n, details: r, headers: s, status: a, url: i }) {
|
|
4147
4183
|
super("HTTP request failed.", {
|
|
4148
4184
|
cause: n,
|
|
4149
4185
|
details: r,
|
|
4150
4186
|
metaMessages: [
|
|
4151
4187
|
a && `Status: ${a}`,
|
|
4152
|
-
`URL: ${
|
|
4153
|
-
t && `Request body: ${
|
|
4188
|
+
`URL: ${Yn(i)}`,
|
|
4189
|
+
t && `Request body: ${Bt(t)}`
|
|
4154
4190
|
].filter(Boolean),
|
|
4155
4191
|
name: "HttpRequestError"
|
|
4156
4192
|
}), Object.defineProperty(this, "body", {
|
|
@@ -4176,12 +4212,12 @@ class Co extends f {
|
|
|
4176
4212
|
}), this.body = t, this.headers = s, this.status = a, this.url = i;
|
|
4177
4213
|
}
|
|
4178
4214
|
}
|
|
4179
|
-
class
|
|
4215
|
+
class Xn extends f {
|
|
4180
4216
|
constructor({ body: t, error: n, url: r }) {
|
|
4181
4217
|
super("RPC Request failed.", {
|
|
4182
4218
|
cause: n,
|
|
4183
4219
|
details: n.message,
|
|
4184
|
-
metaMessages: [`URL: ${
|
|
4220
|
+
metaMessages: [`URL: ${Yn(r)}`, `Request body: ${Bt(t)}`],
|
|
4185
4221
|
name: "RpcRequestError"
|
|
4186
4222
|
}), Object.defineProperty(this, "code", {
|
|
4187
4223
|
enumerable: !0,
|
|
@@ -4201,8 +4237,8 @@ class Zn extends f {
|
|
|
4201
4237
|
}), this.code = n.code, this.data = n.data, this.url = r;
|
|
4202
4238
|
}
|
|
4203
4239
|
}
|
|
4204
|
-
const
|
|
4205
|
-
class
|
|
4240
|
+
const Ti = -1;
|
|
4241
|
+
class Jn extends f {
|
|
4206
4242
|
constructor(t, { code: n, docsPath: r, metaMessages: s, name: a, shortMessage: i }) {
|
|
4207
4243
|
super(i, {
|
|
4208
4244
|
cause: t,
|
|
@@ -4214,10 +4250,10 @@ class Xn extends f {
|
|
|
4214
4250
|
configurable: !0,
|
|
4215
4251
|
writable: !0,
|
|
4216
4252
|
value: void 0
|
|
4217
|
-
}), this.name = a || t.name, this.code = t instanceof
|
|
4253
|
+
}), this.name = a || t.name, this.code = t instanceof Xn ? t.code : n ?? Ti;
|
|
4218
4254
|
}
|
|
4219
4255
|
}
|
|
4220
|
-
class Ve extends
|
|
4256
|
+
class Ve extends Jn {
|
|
4221
4257
|
constructor(t) {
|
|
4222
4258
|
super(t, {
|
|
4223
4259
|
code: Ve.code,
|
|
@@ -4232,10 +4268,10 @@ Object.defineProperty(Ve, "code", {
|
|
|
4232
4268
|
writable: !0,
|
|
4233
4269
|
value: -32603
|
|
4234
4270
|
});
|
|
4235
|
-
class
|
|
4271
|
+
class We extends Jn {
|
|
4236
4272
|
constructor(t) {
|
|
4237
4273
|
super(t, {
|
|
4238
|
-
code:
|
|
4274
|
+
code: We.code,
|
|
4239
4275
|
name: "InvalidInputRpcError",
|
|
4240
4276
|
shortMessage: [
|
|
4241
4277
|
"Missing or invalid parameters.",
|
|
@@ -4245,21 +4281,21 @@ class He extends Xn {
|
|
|
4245
4281
|
});
|
|
4246
4282
|
}
|
|
4247
4283
|
}
|
|
4248
|
-
Object.defineProperty(
|
|
4284
|
+
Object.defineProperty(We, "code", {
|
|
4249
4285
|
enumerable: !0,
|
|
4250
4286
|
configurable: !0,
|
|
4251
4287
|
writable: !0,
|
|
4252
4288
|
value: -32e3
|
|
4253
4289
|
});
|
|
4254
|
-
const
|
|
4255
|
-
function
|
|
4256
|
-
const o = e instanceof
|
|
4290
|
+
const vi = 3;
|
|
4291
|
+
function Ei(e, { abi: t, address: n, args: r, docsPath: s, functionName: a, sender: i }) {
|
|
4292
|
+
const o = e instanceof Zn ? e : e instanceof f ? e.walk((b) => "data" in b) || e.walk() : {}, { code: c, data: d, details: l, message: m, shortMessage: y } = o, p = e instanceof St ? new gi({ functionName: a }) : [vi, Ve.code].includes(c) && (d || l || m || y) || c === We.code && l === "execution reverted" && d ? new hi({
|
|
4257
4293
|
abi: t,
|
|
4258
4294
|
data: typeof d == "object" ? d.data : d,
|
|
4259
4295
|
functionName: a,
|
|
4260
|
-
message: o instanceof
|
|
4296
|
+
message: o instanceof Xn ? l : y ?? m
|
|
4261
4297
|
}) : e;
|
|
4262
|
-
return new
|
|
4298
|
+
return new bi(p, {
|
|
4263
4299
|
abi: t,
|
|
4264
4300
|
args: r,
|
|
4265
4301
|
contractAddress: n,
|
|
@@ -4268,24 +4304,24 @@ function vi(e, { abi: t, address: n, args: r, docsPath: s, functionName: a, send
|
|
|
4268
4304
|
sender: i
|
|
4269
4305
|
});
|
|
4270
4306
|
}
|
|
4271
|
-
const
|
|
4272
|
-
function
|
|
4273
|
-
return
|
|
4307
|
+
const Pi = "0.1.1";
|
|
4308
|
+
function Si() {
|
|
4309
|
+
return Pi;
|
|
4274
4310
|
}
|
|
4275
|
-
class
|
|
4311
|
+
class H extends Error {
|
|
4276
4312
|
static setStaticOptions(t) {
|
|
4277
|
-
|
|
4313
|
+
H.prototype.docsOrigin = t.docsOrigin, H.prototype.showVersion = t.showVersion, H.prototype.version = t.version;
|
|
4278
4314
|
}
|
|
4279
4315
|
constructor(t, n = {}) {
|
|
4280
4316
|
const r = (() => {
|
|
4281
|
-
if (n.cause instanceof
|
|
4317
|
+
if (n.cause instanceof H) {
|
|
4282
4318
|
if (n.cause.details)
|
|
4283
4319
|
return n.cause.details;
|
|
4284
4320
|
if (n.cause.shortMessage)
|
|
4285
4321
|
return n.cause.shortMessage;
|
|
4286
4322
|
}
|
|
4287
4323
|
return n.cause && "details" in n.cause && typeof n.cause.details == "string" ? n.cause.details : n.cause?.message ? n.cause.message : n.details;
|
|
4288
|
-
})(), s = n.cause instanceof
|
|
4324
|
+
})(), s = n.cause instanceof H && n.cause.docsPath || n.docsPath, a = n.docsOrigin ?? H.prototype.docsOrigin, i = `${a}${s ?? ""}`, o = !!(n.version ?? H.prototype.showVersion), c = n.version ?? H.prototype.version, d = [
|
|
4289
4325
|
t || "An error occurred.",
|
|
4290
4326
|
...n.metaMessages ? ["", ...n.metaMessages] : [],
|
|
4291
4327
|
...r || s || o ? [
|
|
@@ -4344,30 +4380,30 @@ class _ extends Error {
|
|
|
4344
4380
|
}), this.cause = n.cause, this.details = r, this.docs = i, this.docsOrigin = a, this.docsPath = s, this.shortMessage = t, this.showVersion = o, this.version = c;
|
|
4345
4381
|
}
|
|
4346
4382
|
walk(t) {
|
|
4347
|
-
return
|
|
4383
|
+
return Qn(this, t);
|
|
4348
4384
|
}
|
|
4349
4385
|
}
|
|
4350
|
-
Object.defineProperty(
|
|
4386
|
+
Object.defineProperty(H, "defaultStaticOptions", {
|
|
4351
4387
|
enumerable: !0,
|
|
4352
4388
|
configurable: !0,
|
|
4353
4389
|
writable: !0,
|
|
4354
4390
|
value: {
|
|
4355
4391
|
docsOrigin: "https://oxlib.sh",
|
|
4356
4392
|
showVersion: !1,
|
|
4357
|
-
version: `ox@${
|
|
4393
|
+
version: `ox@${Si()}`
|
|
4358
4394
|
}
|
|
4359
4395
|
});
|
|
4360
|
-
|
|
4361
|
-
function
|
|
4362
|
-
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause ?
|
|
4396
|
+
H.setStaticOptions(H.defaultStaticOptions);
|
|
4397
|
+
function Qn(e, t) {
|
|
4398
|
+
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause ? Qn(e.cause, t) : t ? null : e;
|
|
4363
4399
|
}
|
|
4364
|
-
function
|
|
4400
|
+
function Ai(e, t = {}) {
|
|
4365
4401
|
const { dir: n, size: r = 32 } = t;
|
|
4366
4402
|
if (r === 0)
|
|
4367
4403
|
return e;
|
|
4368
4404
|
const s = e.replace("0x", "");
|
|
4369
4405
|
if (s.length > r * 2)
|
|
4370
|
-
throw new
|
|
4406
|
+
throw new ki({
|
|
4371
4407
|
size: Math.ceil(s.length / 2),
|
|
4372
4408
|
targetSize: r,
|
|
4373
4409
|
type: "Hex"
|
|
@@ -4381,7 +4417,7 @@ function oe(e, t = {}) {
|
|
|
4381
4417
|
const i = typeof a == "bigint" && n ? -a - 1n : 0;
|
|
4382
4418
|
if (a && s > a || s < i) {
|
|
4383
4419
|
const d = typeof e == "bigint" ? "n" : "";
|
|
4384
|
-
throw new
|
|
4420
|
+
throw new Ci({
|
|
4385
4421
|
max: a ? `${a}${d}` : void 0,
|
|
4386
4422
|
min: `${i}${d}`,
|
|
4387
4423
|
signed: n,
|
|
@@ -4390,12 +4426,12 @@ function oe(e, t = {}) {
|
|
|
4390
4426
|
});
|
|
4391
4427
|
}
|
|
4392
4428
|
const c = `0x${(n && s < 0 ? BigInt.asUintN(r * 8, BigInt(s)) : s).toString(16)}`;
|
|
4393
|
-
return r ?
|
|
4429
|
+
return r ? $i(c, r) : c;
|
|
4394
4430
|
}
|
|
4395
|
-
function
|
|
4396
|
-
return
|
|
4431
|
+
function $i(e, t) {
|
|
4432
|
+
return Ai(e, { dir: "left", size: t });
|
|
4397
4433
|
}
|
|
4398
|
-
class
|
|
4434
|
+
class Ci extends H {
|
|
4399
4435
|
constructor({ max: t, min: n, signed: r, size: s, value: a }) {
|
|
4400
4436
|
super(`Number \`${a}\` is not in safe${s ? ` ${s * 8}-bit` : ""}${r ? " signed" : " unsigned"} integer range ${t ? `(\`${n}\` to \`${t}\`)` : `(above \`${n}\`)`}`), Object.defineProperty(this, "name", {
|
|
4401
4437
|
enumerable: !0,
|
|
@@ -4405,7 +4441,7 @@ class $i extends _ {
|
|
|
4405
4441
|
});
|
|
4406
4442
|
}
|
|
4407
4443
|
}
|
|
4408
|
-
class
|
|
4444
|
+
class ki extends H {
|
|
4409
4445
|
constructor({ size: t, targetSize: n, type: r }) {
|
|
4410
4446
|
super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`), Object.defineProperty(this, "name", {
|
|
4411
4447
|
enumerable: !0,
|
|
@@ -4415,7 +4451,7 @@ class Ci extends _ {
|
|
|
4415
4451
|
});
|
|
4416
4452
|
}
|
|
4417
4453
|
}
|
|
4418
|
-
function
|
|
4454
|
+
function Ii(e) {
|
|
4419
4455
|
return {
|
|
4420
4456
|
address: e.address,
|
|
4421
4457
|
amount: oe(e.amount),
|
|
@@ -4423,7 +4459,7 @@ function ki(e) {
|
|
|
4423
4459
|
validatorIndex: oe(e.validatorIndex)
|
|
4424
4460
|
};
|
|
4425
4461
|
}
|
|
4426
|
-
function
|
|
4462
|
+
function Ni(e) {
|
|
4427
4463
|
return {
|
|
4428
4464
|
...typeof e.baseFeePerGas == "bigint" && {
|
|
4429
4465
|
baseFeePerGas: oe(e.baseFeePerGas)
|
|
@@ -4447,24 +4483,24 @@ function Ii(e) {
|
|
|
4447
4483
|
time: oe(e.time)
|
|
4448
4484
|
},
|
|
4449
4485
|
...e.withdrawals && {
|
|
4450
|
-
withdrawals: e.withdrawals.map(
|
|
4486
|
+
withdrawals: e.withdrawals.map(Ii)
|
|
4451
4487
|
}
|
|
4452
4488
|
};
|
|
4453
4489
|
}
|
|
4454
|
-
const Ni = "0x82ad56cb", Ri = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe", Mi = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe", Di = "0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033", nt = "/docs/contract/encodeDeployData";
|
|
4455
|
-
function
|
|
4490
|
+
const Ri = "0x82ad56cb", Mi = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe", Di = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe", Oi = "0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033", rt = "/docs/contract/encodeDeployData";
|
|
4491
|
+
function qn(e) {
|
|
4456
4492
|
const { abi: t, args: n, bytecode: r } = e;
|
|
4457
4493
|
if (!n || n.length === 0)
|
|
4458
4494
|
return r;
|
|
4459
4495
|
const s = t.find((i) => "type" in i && i.type === "constructor");
|
|
4460
4496
|
if (!s)
|
|
4461
|
-
throw new Vr({ docsPath:
|
|
4497
|
+
throw new Vr({ docsPath: rt });
|
|
4462
4498
|
if (!("inputs" in s))
|
|
4463
|
-
throw new
|
|
4499
|
+
throw new Ft({ docsPath: rt });
|
|
4464
4500
|
if (!s.inputs || s.inputs.length === 0)
|
|
4465
|
-
throw new
|
|
4466
|
-
const a =
|
|
4467
|
-
return
|
|
4501
|
+
throw new Ft({ docsPath: rt });
|
|
4502
|
+
const a = Sn(s.inputs, n);
|
|
4503
|
+
return kt([r, a]);
|
|
4468
4504
|
}
|
|
4469
4505
|
class Te extends f {
|
|
4470
4506
|
constructor({ cause: t, message: n } = {}) {
|
|
@@ -4487,7 +4523,7 @@ Object.defineProperty(Te, "nodeMessage", {
|
|
|
4487
4523
|
writable: !0,
|
|
4488
4524
|
value: /execution reverted|gas required exceeds allowance/
|
|
4489
4525
|
});
|
|
4490
|
-
class
|
|
4526
|
+
class _e extends f {
|
|
4491
4527
|
constructor({ cause: t, maxFeePerGas: n } = {}) {
|
|
4492
4528
|
super(`The fee cap (\`maxFeePerGas\`${n ? ` = ${he(n)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
|
4493
4529
|
cause: t,
|
|
@@ -4495,13 +4531,13 @@ class ze extends f {
|
|
|
4495
4531
|
});
|
|
4496
4532
|
}
|
|
4497
4533
|
}
|
|
4498
|
-
Object.defineProperty(
|
|
4534
|
+
Object.defineProperty(_e, "nodeMessage", {
|
|
4499
4535
|
enumerable: !0,
|
|
4500
4536
|
configurable: !0,
|
|
4501
4537
|
writable: !0,
|
|
4502
4538
|
value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
|
|
4503
4539
|
});
|
|
4504
|
-
class
|
|
4540
|
+
class ft extends f {
|
|
4505
4541
|
constructor({ cause: t, maxFeePerGas: n } = {}) {
|
|
4506
4542
|
super(`The fee cap (\`maxFeePerGas\`${n ? ` = ${he(n)}` : ""} gwei) cannot be lower than the block base fee.`, {
|
|
4507
4543
|
cause: t,
|
|
@@ -4509,24 +4545,24 @@ class lt extends f {
|
|
|
4509
4545
|
});
|
|
4510
4546
|
}
|
|
4511
4547
|
}
|
|
4512
|
-
Object.defineProperty(
|
|
4548
|
+
Object.defineProperty(ft, "nodeMessage", {
|
|
4513
4549
|
enumerable: !0,
|
|
4514
4550
|
configurable: !0,
|
|
4515
4551
|
writable: !0,
|
|
4516
4552
|
value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/
|
|
4517
4553
|
});
|
|
4518
|
-
class
|
|
4554
|
+
class pt extends f {
|
|
4519
4555
|
constructor({ cause: t, nonce: n } = {}) {
|
|
4520
4556
|
super(`Nonce provided for the transaction ${n ? `(${n}) ` : ""}is higher than the next one expected.`, { cause: t, name: "NonceTooHighError" });
|
|
4521
4557
|
}
|
|
4522
4558
|
}
|
|
4523
|
-
Object.defineProperty(
|
|
4559
|
+
Object.defineProperty(pt, "nodeMessage", {
|
|
4524
4560
|
enumerable: !0,
|
|
4525
4561
|
configurable: !0,
|
|
4526
4562
|
writable: !0,
|
|
4527
4563
|
value: /nonce too high/
|
|
4528
4564
|
});
|
|
4529
|
-
class
|
|
4565
|
+
class mt extends f {
|
|
4530
4566
|
constructor({ cause: t, nonce: n } = {}) {
|
|
4531
4567
|
super([
|
|
4532
4568
|
`Nonce provided for the transaction ${n ? `(${n}) ` : ""}is lower than the current nonce of the account.`,
|
|
@@ -4535,24 +4571,24 @@ class pt extends f {
|
|
|
4535
4571
|
`), { cause: t, name: "NonceTooLowError" });
|
|
4536
4572
|
}
|
|
4537
4573
|
}
|
|
4538
|
-
Object.defineProperty(
|
|
4574
|
+
Object.defineProperty(mt, "nodeMessage", {
|
|
4539
4575
|
enumerable: !0,
|
|
4540
4576
|
configurable: !0,
|
|
4541
4577
|
writable: !0,
|
|
4542
4578
|
value: /nonce too low|transaction already imported|already known/
|
|
4543
4579
|
});
|
|
4544
|
-
class
|
|
4580
|
+
class yt extends f {
|
|
4545
4581
|
constructor({ cause: t, nonce: n } = {}) {
|
|
4546
4582
|
super(`Nonce provided for the transaction ${n ? `(${n}) ` : ""}exceeds the maximum allowed nonce.`, { cause: t, name: "NonceMaxValueError" });
|
|
4547
4583
|
}
|
|
4548
4584
|
}
|
|
4549
|
-
Object.defineProperty(
|
|
4585
|
+
Object.defineProperty(yt, "nodeMessage", {
|
|
4550
4586
|
enumerable: !0,
|
|
4551
4587
|
configurable: !0,
|
|
4552
4588
|
writable: !0,
|
|
4553
4589
|
value: /nonce has max value/
|
|
4554
4590
|
});
|
|
4555
|
-
class
|
|
4591
|
+
class bt extends f {
|
|
4556
4592
|
constructor({ cause: t } = {}) {
|
|
4557
4593
|
super([
|
|
4558
4594
|
"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
|
|
@@ -4573,13 +4609,13 @@ class yt extends f {
|
|
|
4573
4609
|
});
|
|
4574
4610
|
}
|
|
4575
4611
|
}
|
|
4576
|
-
Object.defineProperty(
|
|
4612
|
+
Object.defineProperty(bt, "nodeMessage", {
|
|
4577
4613
|
enumerable: !0,
|
|
4578
4614
|
configurable: !0,
|
|
4579
4615
|
writable: !0,
|
|
4580
4616
|
value: /insufficient funds|exceeds transaction sender account balance/
|
|
4581
4617
|
});
|
|
4582
|
-
class
|
|
4618
|
+
class ht extends f {
|
|
4583
4619
|
constructor({ cause: t, gas: n } = {}) {
|
|
4584
4620
|
super(`The amount of gas ${n ? `(${n}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`, {
|
|
4585
4621
|
cause: t,
|
|
@@ -4587,13 +4623,13 @@ class bt extends f {
|
|
|
4587
4623
|
});
|
|
4588
4624
|
}
|
|
4589
4625
|
}
|
|
4590
|
-
Object.defineProperty(
|
|
4626
|
+
Object.defineProperty(ht, "nodeMessage", {
|
|
4591
4627
|
enumerable: !0,
|
|
4592
4628
|
configurable: !0,
|
|
4593
4629
|
writable: !0,
|
|
4594
4630
|
value: /intrinsic gas too high|gas limit reached/
|
|
4595
4631
|
});
|
|
4596
|
-
class
|
|
4632
|
+
class gt extends f {
|
|
4597
4633
|
constructor({ cause: t, gas: n } = {}) {
|
|
4598
4634
|
super(`The amount of gas ${n ? `(${n}) ` : ""}provided for the transaction is too low.`, {
|
|
4599
4635
|
cause: t,
|
|
@@ -4601,13 +4637,13 @@ class ht extends f {
|
|
|
4601
4637
|
});
|
|
4602
4638
|
}
|
|
4603
4639
|
}
|
|
4604
|
-
Object.defineProperty(
|
|
4640
|
+
Object.defineProperty(gt, "nodeMessage", {
|
|
4605
4641
|
enumerable: !0,
|
|
4606
4642
|
configurable: !0,
|
|
4607
4643
|
writable: !0,
|
|
4608
4644
|
value: /intrinsic gas too low/
|
|
4609
4645
|
});
|
|
4610
|
-
class
|
|
4646
|
+
class wt extends f {
|
|
4611
4647
|
constructor({ cause: t }) {
|
|
4612
4648
|
super("The transaction type is not supported for this chain.", {
|
|
4613
4649
|
cause: t,
|
|
@@ -4615,13 +4651,13 @@ class gt extends f {
|
|
|
4615
4651
|
});
|
|
4616
4652
|
}
|
|
4617
4653
|
}
|
|
4618
|
-
Object.defineProperty(
|
|
4654
|
+
Object.defineProperty(wt, "nodeMessage", {
|
|
4619
4655
|
enumerable: !0,
|
|
4620
4656
|
configurable: !0,
|
|
4621
4657
|
writable: !0,
|
|
4622
4658
|
value: /transaction type not valid/
|
|
4623
4659
|
});
|
|
4624
|
-
class
|
|
4660
|
+
class Ge extends f {
|
|
4625
4661
|
constructor({ cause: t, maxPriorityFeePerGas: n, maxFeePerGas: r } = {}) {
|
|
4626
4662
|
super([
|
|
4627
4663
|
`The provided tip (\`maxPriorityFeePerGas\`${n ? ` = ${he(n)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r ? ` = ${he(r)} gwei` : ""}).`
|
|
@@ -4632,13 +4668,13 @@ class _e extends f {
|
|
|
4632
4668
|
});
|
|
4633
4669
|
}
|
|
4634
4670
|
}
|
|
4635
|
-
Object.defineProperty(
|
|
4671
|
+
Object.defineProperty(Ge, "nodeMessage", {
|
|
4636
4672
|
enumerable: !0,
|
|
4637
4673
|
configurable: !0,
|
|
4638
4674
|
writable: !0,
|
|
4639
4675
|
value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
|
|
4640
4676
|
});
|
|
4641
|
-
class
|
|
4677
|
+
class er extends f {
|
|
4642
4678
|
constructor({ cause: t }) {
|
|
4643
4679
|
super(`An error occurred while executing: ${t?.shortMessage}`, {
|
|
4644
4680
|
cause: t,
|
|
@@ -4646,7 +4682,7 @@ class qn extends f {
|
|
|
4646
4682
|
});
|
|
4647
4683
|
}
|
|
4648
4684
|
}
|
|
4649
|
-
function
|
|
4685
|
+
function Bi(e, t) {
|
|
4650
4686
|
const n = (e.details || "").toLowerCase(), r = e instanceof f ? e.walk((s) => s?.code === Te.code) : e;
|
|
4651
4687
|
return r instanceof f ? new Te({
|
|
4652
4688
|
cause: e,
|
|
@@ -4654,31 +4690,31 @@ function Oi(e, t) {
|
|
|
4654
4690
|
}) : Te.nodeMessage.test(n) ? new Te({
|
|
4655
4691
|
cause: e,
|
|
4656
4692
|
message: e.details
|
|
4657
|
-
}) :
|
|
4693
|
+
}) : _e.nodeMessage.test(n) ? new _e({
|
|
4658
4694
|
cause: e,
|
|
4659
4695
|
maxFeePerGas: t?.maxFeePerGas
|
|
4660
|
-
}) :
|
|
4696
|
+
}) : ft.nodeMessage.test(n) ? new ft({
|
|
4661
4697
|
cause: e,
|
|
4662
4698
|
maxFeePerGas: t?.maxFeePerGas
|
|
4663
|
-
}) :
|
|
4699
|
+
}) : pt.nodeMessage.test(n) ? new pt({ cause: e, nonce: t?.nonce }) : mt.nodeMessage.test(n) ? new mt({ cause: e, nonce: t?.nonce }) : yt.nodeMessage.test(n) ? new yt({ cause: e, nonce: t?.nonce }) : bt.nodeMessage.test(n) ? new bt({ cause: e }) : ht.nodeMessage.test(n) ? new ht({ cause: e, gas: t?.gas }) : gt.nodeMessage.test(n) ? new gt({ cause: e, gas: t?.gas }) : wt.nodeMessage.test(n) ? new wt({ cause: e }) : Ge.nodeMessage.test(n) ? new Ge({
|
|
4664
4700
|
cause: e,
|
|
4665
4701
|
maxFeePerGas: t?.maxFeePerGas,
|
|
4666
4702
|
maxPriorityFeePerGas: t?.maxPriorityFeePerGas
|
|
4667
|
-
}) : new
|
|
4703
|
+
}) : new er({
|
|
4668
4704
|
cause: e
|
|
4669
4705
|
});
|
|
4670
4706
|
}
|
|
4671
|
-
function
|
|
4707
|
+
function Ui(e, { docsPath: t, ...n }) {
|
|
4672
4708
|
const r = (() => {
|
|
4673
|
-
const s =
|
|
4674
|
-
return s instanceof
|
|
4709
|
+
const s = Bi(e, n);
|
|
4710
|
+
return s instanceof er ? e : s;
|
|
4675
4711
|
})();
|
|
4676
|
-
return new
|
|
4712
|
+
return new yi(r, {
|
|
4677
4713
|
docsPath: t,
|
|
4678
4714
|
...n
|
|
4679
4715
|
});
|
|
4680
4716
|
}
|
|
4681
|
-
function
|
|
4717
|
+
function Li(e, { format: t }) {
|
|
4682
4718
|
if (!t)
|
|
4683
4719
|
return {};
|
|
4684
4720
|
const n = {};
|
|
@@ -4690,18 +4726,18 @@ function Ui(e, { format: t }) {
|
|
|
4690
4726
|
const s = t(e || {});
|
|
4691
4727
|
return r(s), n;
|
|
4692
4728
|
}
|
|
4693
|
-
const
|
|
4729
|
+
const Fi = {
|
|
4694
4730
|
legacy: "0x0",
|
|
4695
4731
|
eip2930: "0x1",
|
|
4696
4732
|
eip1559: "0x2",
|
|
4697
4733
|
eip4844: "0x3",
|
|
4698
4734
|
eip7702: "0x4"
|
|
4699
4735
|
};
|
|
4700
|
-
function
|
|
4736
|
+
function ji(e, t) {
|
|
4701
4737
|
const n = {};
|
|
4702
|
-
return typeof e.authorizationList < "u" && (n.authorizationList =
|
|
4738
|
+
return typeof e.authorizationList < "u" && (n.authorizationList = zi(e.authorizationList)), typeof e.accessList < "u" && (n.accessList = e.accessList), typeof e.blobVersionedHashes < "u" && (n.blobVersionedHashes = e.blobVersionedHashes), typeof e.blobs < "u" && (typeof e.blobs[0] != "string" ? n.blobs = e.blobs.map((r) => ue(r)) : n.blobs = e.blobs), typeof e.data < "u" && (n.data = e.data), e.account && (n.from = e.account.address), typeof e.from < "u" && (n.from = e.from), typeof e.gas < "u" && (n.gas = k(e.gas)), typeof e.gasPrice < "u" && (n.gasPrice = k(e.gasPrice)), typeof e.maxFeePerBlobGas < "u" && (n.maxFeePerBlobGas = k(e.maxFeePerBlobGas)), typeof e.maxFeePerGas < "u" && (n.maxFeePerGas = k(e.maxFeePerGas)), typeof e.maxPriorityFeePerGas < "u" && (n.maxPriorityFeePerGas = k(e.maxPriorityFeePerGas)), typeof e.nonce < "u" && (n.nonce = k(e.nonce)), typeof e.to < "u" && (n.to = e.to), typeof e.type < "u" && (n.type = Fi[e.type]), typeof e.value < "u" && (n.value = k(e.value)), n;
|
|
4703
4739
|
}
|
|
4704
|
-
function
|
|
4740
|
+
function zi(e) {
|
|
4705
4741
|
return e.map((t) => ({
|
|
4706
4742
|
address: t.address,
|
|
4707
4743
|
r: t.r ? k(BigInt(t.r)) : t.r,
|
|
@@ -4712,7 +4748,7 @@ function ji(e) {
|
|
|
4712
4748
|
...typeof t.v < "u" && typeof t.yParity > "u" ? { v: k(t.v) } : {}
|
|
4713
4749
|
}));
|
|
4714
4750
|
}
|
|
4715
|
-
function
|
|
4751
|
+
function _i() {
|
|
4716
4752
|
let e = () => {
|
|
4717
4753
|
}, t = () => {
|
|
4718
4754
|
};
|
|
@@ -4720,44 +4756,44 @@ function zi() {
|
|
|
4720
4756
|
e = r, t = s;
|
|
4721
4757
|
}), resolve: e, reject: t };
|
|
4722
4758
|
}
|
|
4723
|
-
const
|
|
4724
|
-
function
|
|
4759
|
+
const st = /* @__PURE__ */ new Map();
|
|
4760
|
+
function Gi({ fn: e, id: t, shouldSplitBatch: n, wait: r = 0, sort: s }) {
|
|
4725
4761
|
const a = async () => {
|
|
4726
4762
|
const l = c();
|
|
4727
4763
|
i();
|
|
4728
|
-
const
|
|
4729
|
-
|
|
4730
|
-
s && Array.isArray(
|
|
4731
|
-
for (let
|
|
4732
|
-
const { resolve:
|
|
4733
|
-
|
|
4764
|
+
const m = l.map(({ args: y }) => y);
|
|
4765
|
+
m.length !== 0 && e(m).then((y) => {
|
|
4766
|
+
s && Array.isArray(y) && y.sort(s);
|
|
4767
|
+
for (let p = 0; p < l.length; p++) {
|
|
4768
|
+
const { resolve: b } = l[p];
|
|
4769
|
+
b?.([y[p], y]);
|
|
4734
4770
|
}
|
|
4735
|
-
}).catch((
|
|
4736
|
-
for (let
|
|
4737
|
-
const { reject:
|
|
4738
|
-
|
|
4771
|
+
}).catch((y) => {
|
|
4772
|
+
for (let p = 0; p < l.length; p++) {
|
|
4773
|
+
const { reject: b } = l[p];
|
|
4774
|
+
b?.(y);
|
|
4739
4775
|
}
|
|
4740
4776
|
});
|
|
4741
|
-
}, i = () =>
|
|
4777
|
+
}, i = () => st.delete(t), o = () => c().map(({ args: l }) => l), c = () => st.get(t) || [], d = (l) => st.set(t, [...c(), l]);
|
|
4742
4778
|
return {
|
|
4743
4779
|
flush: i,
|
|
4744
4780
|
async schedule(l) {
|
|
4745
|
-
const { promise:
|
|
4746
|
-
return n?.([...o(), l]) && a(), c().length > 0 ? (d({ args: l, resolve:
|
|
4781
|
+
const { promise: m, resolve: y, reject: p } = _i();
|
|
4782
|
+
return n?.([...o(), l]) && a(), c().length > 0 ? (d({ args: l, resolve: y, reject: p }), m) : (d({ args: l, resolve: y, reject: p }), setTimeout(a, r), m);
|
|
4747
4783
|
}
|
|
4748
4784
|
};
|
|
4749
4785
|
}
|
|
4750
|
-
function
|
|
4786
|
+
function qt(e) {
|
|
4751
4787
|
if (!(!e || e.length === 0))
|
|
4752
4788
|
return e.reduce((t, { slot: n, value: r }) => {
|
|
4753
4789
|
if (n.length !== 66)
|
|
4754
|
-
throw new
|
|
4790
|
+
throw new jt({
|
|
4755
4791
|
size: n.length,
|
|
4756
4792
|
targetSize: 66,
|
|
4757
4793
|
type: "hex"
|
|
4758
4794
|
});
|
|
4759
4795
|
if (r.length !== 66)
|
|
4760
|
-
throw new
|
|
4796
|
+
throw new jt({
|
|
4761
4797
|
size: r.length,
|
|
4762
4798
|
targetSize: 66,
|
|
4763
4799
|
type: "hex"
|
|
@@ -4765,12 +4801,12 @@ function Qt(e) {
|
|
|
4765
4801
|
return t[n] = r, t;
|
|
4766
4802
|
}, {});
|
|
4767
4803
|
}
|
|
4768
|
-
function
|
|
4804
|
+
function Hi(e) {
|
|
4769
4805
|
const { balance: t, nonce: n, state: r, stateDiff: s, code: a } = e, i = {};
|
|
4770
|
-
if (a !== void 0 && (i.code = a), t !== void 0 && (i.balance = k(t)), n !== void 0 && (i.nonce = k(n)), r !== void 0 && (i.state =
|
|
4806
|
+
if (a !== void 0 && (i.code = a), t !== void 0 && (i.balance = k(t)), n !== void 0 && (i.nonce = k(n)), r !== void 0 && (i.state = qt(r)), s !== void 0) {
|
|
4771
4807
|
if (i.state)
|
|
4772
|
-
throw new
|
|
4773
|
-
i.stateDiff =
|
|
4808
|
+
throw new fi();
|
|
4809
|
+
i.stateDiff = qt(s);
|
|
4774
4810
|
}
|
|
4775
4811
|
return i;
|
|
4776
4812
|
}
|
|
@@ -4780,192 +4816,192 @@ function Vi(e) {
|
|
|
4780
4816
|
const t = {};
|
|
4781
4817
|
for (const { address: n, ...r } of e) {
|
|
4782
4818
|
if (!ge(n, { strict: !1 }))
|
|
4783
|
-
throw new
|
|
4819
|
+
throw new Fe({ address: n });
|
|
4784
4820
|
if (t[n])
|
|
4785
|
-
throw new
|
|
4786
|
-
t[n] =
|
|
4821
|
+
throw new li({ address: n });
|
|
4822
|
+
t[n] = Hi(r);
|
|
4787
4823
|
}
|
|
4788
4824
|
return t;
|
|
4789
4825
|
}
|
|
4790
|
-
const
|
|
4791
|
-
function
|
|
4792
|
-
const { account: t, maxFeePerGas: n, maxPriorityFeePerGas: r, to: s } = e, a = t ?
|
|
4826
|
+
const Wi = 2n ** 256n - 1n;
|
|
4827
|
+
function Ki(e) {
|
|
4828
|
+
const { account: t, maxFeePerGas: n, maxPriorityFeePerGas: r, to: s } = e, a = t ? Ot(t) : void 0;
|
|
4793
4829
|
if (a && !ge(a.address))
|
|
4794
|
-
throw new
|
|
4830
|
+
throw new Fe({ address: a.address });
|
|
4795
4831
|
if (s && !ge(s))
|
|
4796
|
-
throw new
|
|
4797
|
-
if (n && n >
|
|
4798
|
-
throw new
|
|
4832
|
+
throw new Fe({ address: s });
|
|
4833
|
+
if (n && n > Wi)
|
|
4834
|
+
throw new _e({ maxFeePerGas: n });
|
|
4799
4835
|
if (r && n && r > n)
|
|
4800
|
-
throw new
|
|
4836
|
+
throw new Ge({ maxFeePerGas: n, maxPriorityFeePerGas: r });
|
|
4801
4837
|
}
|
|
4802
|
-
async function
|
|
4803
|
-
const { account: n = e.account, authorizationList: r, batch: s = !!e.batch?.multicall, blockNumber: a, blockTag: i = e.experimental_blockTag ?? "latest", accessList: o, blobs: c, blockOverrides: d, code: l, data:
|
|
4804
|
-
if (l && (
|
|
4838
|
+
async function Yi(e, t) {
|
|
4839
|
+
const { account: n = e.account, authorizationList: r, batch: s = !!e.batch?.multicall, blockNumber: a, blockTag: i = e.experimental_blockTag ?? "latest", accessList: o, blobs: c, blockOverrides: d, code: l, data: m, factory: y, factoryData: p, gas: b, gasPrice: v, maxFeePerBlobGas: P, maxFeePerGas: T, maxPriorityFeePerGas: h, nonce: g, to: S, value: I, stateOverride: Z, ...B } = t, le = n ? Ot(n) : void 0;
|
|
4840
|
+
if (l && (y || p))
|
|
4805
4841
|
throw new f("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
|
|
4806
4842
|
if (l && S)
|
|
4807
4843
|
throw new f("Cannot provide both `code` & `to` as parameters.");
|
|
4808
|
-
const
|
|
4844
|
+
const V = l && m, _ = y && p && S && m, te = V || _, W = V ? tr({
|
|
4809
4845
|
code: l,
|
|
4810
|
-
data:
|
|
4811
|
-
}) :
|
|
4812
|
-
data:
|
|
4813
|
-
factory:
|
|
4814
|
-
factoryData:
|
|
4846
|
+
data: m
|
|
4847
|
+
}) : _ ? Ji({
|
|
4848
|
+
data: m,
|
|
4849
|
+
factory: y,
|
|
4850
|
+
factoryData: p,
|
|
4815
4851
|
to: S
|
|
4816
|
-
}) :
|
|
4852
|
+
}) : m;
|
|
4817
4853
|
try {
|
|
4818
|
-
|
|
4819
|
-
const
|
|
4854
|
+
Ki(t);
|
|
4855
|
+
const U = (typeof a == "bigint" ? k(a) : void 0) || i, N = d ? Ni(d) : void 0, K = Vi(Z), re = e.chain?.formatters?.transactionRequest?.format, me = (re || ji)({
|
|
4820
4856
|
// Pick out extra data that might exist on the chain's transaction request type.
|
|
4821
|
-
...
|
|
4857
|
+
...Li(B, { format: re }),
|
|
4822
4858
|
accessList: o,
|
|
4823
|
-
account:
|
|
4859
|
+
account: le,
|
|
4824
4860
|
authorizationList: r,
|
|
4825
4861
|
blobs: c,
|
|
4826
|
-
data:
|
|
4827
|
-
gas:
|
|
4862
|
+
data: W,
|
|
4863
|
+
gas: b,
|
|
4828
4864
|
gasPrice: v,
|
|
4829
4865
|
maxFeePerBlobGas: P,
|
|
4830
4866
|
maxFeePerGas: T,
|
|
4831
|
-
maxPriorityFeePerGas:
|
|
4832
|
-
nonce:
|
|
4833
|
-
to:
|
|
4834
|
-
value:
|
|
4867
|
+
maxPriorityFeePerGas: h,
|
|
4868
|
+
nonce: g,
|
|
4869
|
+
to: te ? void 0 : S,
|
|
4870
|
+
value: I
|
|
4835
4871
|
}, "call");
|
|
4836
|
-
if (s &&
|
|
4872
|
+
if (s && Zi({ request: me }) && !K && !N)
|
|
4837
4873
|
try {
|
|
4838
|
-
return await
|
|
4839
|
-
...
|
|
4874
|
+
return await Xi(e, {
|
|
4875
|
+
...me,
|
|
4840
4876
|
blockNumber: a,
|
|
4841
4877
|
blockTag: i
|
|
4842
4878
|
});
|
|
4843
|
-
} catch (
|
|
4844
|
-
if (!(
|
|
4845
|
-
throw
|
|
4879
|
+
} catch (j) {
|
|
4880
|
+
if (!(j instanceof Hn) && !(j instanceof lt))
|
|
4881
|
+
throw j;
|
|
4846
4882
|
}
|
|
4847
|
-
const
|
|
4848
|
-
const
|
|
4849
|
-
|
|
4850
|
-
|
|
4883
|
+
const se = (() => {
|
|
4884
|
+
const j = [
|
|
4885
|
+
me,
|
|
4886
|
+
U
|
|
4851
4887
|
];
|
|
4852
|
-
return
|
|
4853
|
-
})(),
|
|
4888
|
+
return K && N ? [...j, K, N] : K ? [...j, K] : N ? [...j, {}, N] : j;
|
|
4889
|
+
})(), M = await e.request({
|
|
4854
4890
|
method: "eth_call",
|
|
4855
|
-
params:
|
|
4891
|
+
params: se
|
|
4856
4892
|
});
|
|
4857
|
-
return
|
|
4893
|
+
return M === "0x" ? { data: void 0 } : { data: M };
|
|
4858
4894
|
} catch ($) {
|
|
4859
|
-
const
|
|
4860
|
-
if (e.ccipRead !== !1 &&
|
|
4861
|
-
return { data: await
|
|
4862
|
-
throw
|
|
4895
|
+
const U = Qi($), { offchainLookup: N, offchainLookupSignature: K } = await import("./ccip-RHKXqG9a.js");
|
|
4896
|
+
if (e.ccipRead !== !1 && U?.slice(0, 10) === K && S)
|
|
4897
|
+
return { data: await N(e, { data: U, to: S }) };
|
|
4898
|
+
throw te && U?.slice(0, 10) === "0x101bb98d" ? new wi({ factory: y }) : Ui($, {
|
|
4863
4899
|
...t,
|
|
4864
|
-
account:
|
|
4900
|
+
account: le,
|
|
4865
4901
|
chain: e.chain
|
|
4866
4902
|
});
|
|
4867
4903
|
}
|
|
4868
4904
|
}
|
|
4869
|
-
function
|
|
4905
|
+
function Zi({ request: e }) {
|
|
4870
4906
|
const { data: t, to: n, ...r } = e;
|
|
4871
|
-
return !(!t || t.startsWith(
|
|
4907
|
+
return !(!t || t.startsWith(Ri) || !n || Object.values(r).filter((s) => typeof s < "u").length > 0);
|
|
4872
4908
|
}
|
|
4873
|
-
async function
|
|
4909
|
+
async function Xi(e, t) {
|
|
4874
4910
|
const { batchSize: n = 1024, deployless: r = !1, wait: s = 0 } = typeof e.batch?.multicall == "object" ? e.batch.multicall : {}, { blockNumber: a, blockTag: i = e.experimental_blockTag ?? "latest", data: o, to: c } = t, d = (() => {
|
|
4875
4911
|
if (r)
|
|
4876
4912
|
return null;
|
|
4877
4913
|
if (t.multicallAddress)
|
|
4878
4914
|
return t.multicallAddress;
|
|
4879
4915
|
if (e.chain)
|
|
4880
|
-
return
|
|
4916
|
+
return ri({
|
|
4881
4917
|
blockNumber: a,
|
|
4882
4918
|
chain: e.chain,
|
|
4883
4919
|
contract: "multicall3"
|
|
4884
4920
|
});
|
|
4885
|
-
throw new
|
|
4886
|
-
})(),
|
|
4887
|
-
id: `${e.uid}.${
|
|
4921
|
+
throw new Hn();
|
|
4922
|
+
})(), m = (typeof a == "bigint" ? k(a) : void 0) || i, { schedule: y } = Gi({
|
|
4923
|
+
id: `${e.uid}.${m}`,
|
|
4888
4924
|
wait: s,
|
|
4889
4925
|
shouldSplitBatch(v) {
|
|
4890
|
-
return v.reduce((T, { data:
|
|
4926
|
+
return v.reduce((T, { data: h }) => T + (h.length - 2), 0) > n * 2;
|
|
4891
4927
|
},
|
|
4892
4928
|
fn: async (v) => {
|
|
4893
|
-
const P = v.map((
|
|
4929
|
+
const P = v.map((g) => ({
|
|
4894
4930
|
allowFailure: !0,
|
|
4895
|
-
callData:
|
|
4896
|
-
target:
|
|
4897
|
-
})), T =
|
|
4898
|
-
abi:
|
|
4931
|
+
callData: g.data,
|
|
4932
|
+
target: g.to
|
|
4933
|
+
})), T = Gn({
|
|
4934
|
+
abi: Lt,
|
|
4899
4935
|
args: [P],
|
|
4900
4936
|
functionName: "aggregate3"
|
|
4901
|
-
}),
|
|
4937
|
+
}), h = await e.request({
|
|
4902
4938
|
method: "eth_call",
|
|
4903
4939
|
params: [
|
|
4904
4940
|
{
|
|
4905
4941
|
...d === null ? {
|
|
4906
|
-
data:
|
|
4907
|
-
code:
|
|
4942
|
+
data: tr({
|
|
4943
|
+
code: Oi,
|
|
4908
4944
|
data: T
|
|
4909
4945
|
})
|
|
4910
4946
|
} : { to: d, data: T }
|
|
4911
4947
|
},
|
|
4912
|
-
|
|
4948
|
+
m
|
|
4913
4949
|
]
|
|
4914
4950
|
});
|
|
4915
|
-
return
|
|
4916
|
-
abi:
|
|
4951
|
+
return _n({
|
|
4952
|
+
abi: Lt,
|
|
4917
4953
|
args: [P],
|
|
4918
4954
|
functionName: "aggregate3",
|
|
4919
|
-
data:
|
|
4955
|
+
data: h || "0x"
|
|
4920
4956
|
});
|
|
4921
4957
|
}
|
|
4922
|
-
}), [{ returnData:
|
|
4923
|
-
if (!
|
|
4924
|
-
throw new
|
|
4925
|
-
return
|
|
4958
|
+
}), [{ returnData: p, success: b }] = await y({ data: o, to: c });
|
|
4959
|
+
if (!b)
|
|
4960
|
+
throw new Zn({ data: p });
|
|
4961
|
+
return p === "0x" ? { data: void 0 } : { data: p };
|
|
4926
4962
|
}
|
|
4927
|
-
function
|
|
4963
|
+
function tr(e) {
|
|
4928
4964
|
const { code: t, data: n } = e;
|
|
4929
|
-
return
|
|
4930
|
-
abi:
|
|
4931
|
-
bytecode:
|
|
4965
|
+
return qn({
|
|
4966
|
+
abi: Fn(["constructor(bytes, bytes)"]),
|
|
4967
|
+
bytecode: Mi,
|
|
4932
4968
|
args: [t, n]
|
|
4933
4969
|
});
|
|
4934
4970
|
}
|
|
4935
|
-
function
|
|
4971
|
+
function Ji(e) {
|
|
4936
4972
|
const { data: t, factory: n, factoryData: r, to: s } = e;
|
|
4937
|
-
return
|
|
4938
|
-
abi:
|
|
4939
|
-
bytecode:
|
|
4973
|
+
return qn({
|
|
4974
|
+
abi: Fn(["constructor(address, bytes, address, bytes)"]),
|
|
4975
|
+
bytecode: Di,
|
|
4940
4976
|
args: [s, t, n, r]
|
|
4941
4977
|
});
|
|
4942
4978
|
}
|
|
4943
|
-
function
|
|
4979
|
+
function Qi(e) {
|
|
4944
4980
|
if (!(e instanceof f))
|
|
4945
4981
|
return;
|
|
4946
4982
|
const t = e.walk();
|
|
4947
4983
|
return typeof t?.data == "object" ? t.data?.data : t.data;
|
|
4948
4984
|
}
|
|
4949
|
-
async function
|
|
4950
|
-
const { abi: n, address: r, args: s, functionName: a, ...i } = t, o =
|
|
4985
|
+
async function qi(e, t) {
|
|
4986
|
+
const { abi: n, address: r, args: s, functionName: a, ...i } = t, o = Gn({
|
|
4951
4987
|
abi: n,
|
|
4952
4988
|
args: s,
|
|
4953
4989
|
functionName: a
|
|
4954
4990
|
});
|
|
4955
4991
|
try {
|
|
4956
|
-
const { data: c } = await
|
|
4992
|
+
const { data: c } = await xi(e, Yi, "call")({
|
|
4957
4993
|
...i,
|
|
4958
4994
|
data: o,
|
|
4959
4995
|
to: r
|
|
4960
4996
|
});
|
|
4961
|
-
return
|
|
4997
|
+
return _n({
|
|
4962
4998
|
abi: n,
|
|
4963
4999
|
args: s,
|
|
4964
5000
|
functionName: a,
|
|
4965
5001
|
data: c || "0x"
|
|
4966
5002
|
});
|
|
4967
5003
|
} catch (c) {
|
|
4968
|
-
throw
|
|
5004
|
+
throw Ei(c, {
|
|
4969
5005
|
abi: n,
|
|
4970
5006
|
address: r,
|
|
4971
5007
|
args: s,
|
|
@@ -4974,117 +5010,117 @@ async function Qi(e, t) {
|
|
|
4974
5010
|
});
|
|
4975
5011
|
}
|
|
4976
5012
|
}
|
|
4977
|
-
function
|
|
5013
|
+
function eo(e, t, n) {
|
|
4978
5014
|
const r = e[t.name];
|
|
4979
5015
|
if (typeof r == "function")
|
|
4980
5016
|
return r;
|
|
4981
5017
|
const s = e[n];
|
|
4982
5018
|
return typeof s == "function" ? s : (a) => t(e, a);
|
|
4983
5019
|
}
|
|
4984
|
-
function
|
|
5020
|
+
function to(e, t) {
|
|
4985
5021
|
const { chainId: n, ...r } = t, s = e.getClient({ chainId: n });
|
|
4986
|
-
return
|
|
5022
|
+
return eo(s, qi, "readContract")(r);
|
|
4987
5023
|
}
|
|
4988
|
-
function
|
|
4989
|
-
const { address: e } =
|
|
5024
|
+
function no() {
|
|
5025
|
+
const { address: e } = He(), t = gr(), {
|
|
4990
5026
|
writeContractAsync: n,
|
|
4991
5027
|
data: r,
|
|
4992
5028
|
isPending: s,
|
|
4993
5029
|
error: a
|
|
4994
|
-
} =
|
|
5030
|
+
} = xt(), { isLoading: i, isSuccess: o } = Tt({
|
|
4995
5031
|
hash: r
|
|
4996
|
-
}), c = () =>
|
|
5032
|
+
}), c = () => z({
|
|
4997
5033
|
address: O.PAYMENT_ROUTER,
|
|
4998
|
-
abi:
|
|
5034
|
+
abi: Oe,
|
|
4999
5035
|
functionName: "tokenRegistry"
|
|
5000
|
-
}), d = () =>
|
|
5036
|
+
}), d = () => z({
|
|
5001
5037
|
address: O.PAYMENT_ROUTER,
|
|
5002
|
-
abi:
|
|
5038
|
+
abi: Oe,
|
|
5003
5039
|
functionName: "feePercentage"
|
|
5004
|
-
}), l = () =>
|
|
5040
|
+
}), l = () => z({
|
|
5005
5041
|
address: O.PAYMENT_ROUTER,
|
|
5006
|
-
abi:
|
|
5042
|
+
abi: Oe,
|
|
5007
5043
|
functionName: "paused"
|
|
5008
|
-
}),
|
|
5044
|
+
}), m = async (b, v) => {
|
|
5009
5045
|
try {
|
|
5010
|
-
return await
|
|
5011
|
-
address:
|
|
5012
|
-
abi:
|
|
5046
|
+
return await to(t, {
|
|
5047
|
+
address: b,
|
|
5048
|
+
abi: q,
|
|
5013
5049
|
functionName: "allowance",
|
|
5014
5050
|
args: [v, O.PAYMENT_ROUTER]
|
|
5015
5051
|
});
|
|
5016
5052
|
} catch (P) {
|
|
5017
5053
|
return console.error("Error checking allowance:", P), BigInt(0);
|
|
5018
5054
|
}
|
|
5019
|
-
},
|
|
5055
|
+
}, y = async (b, v) => {
|
|
5020
5056
|
if (!e)
|
|
5021
5057
|
throw new Error("Wallet not connected");
|
|
5022
|
-
if (
|
|
5058
|
+
if (b === "0x0000000000000000000000000000000000000000")
|
|
5023
5059
|
return null;
|
|
5024
5060
|
try {
|
|
5025
|
-
return await
|
|
5026
|
-
`Sufficient allowance for ${
|
|
5027
|
-
), null) : (console.log(`Requesting infinite approval for ${
|
|
5028
|
-
address:
|
|
5029
|
-
abi:
|
|
5061
|
+
return await m(b, e) >= v ? (console.log(
|
|
5062
|
+
`Sufficient allowance for ${b}, skipping approval`
|
|
5063
|
+
), null) : (console.log(`Requesting infinite approval for ${b}`), await n({
|
|
5064
|
+
address: b,
|
|
5065
|
+
abi: q,
|
|
5030
5066
|
functionName: "approve",
|
|
5031
|
-
args: [O.PAYMENT_ROUTER,
|
|
5067
|
+
args: [O.PAYMENT_ROUTER, Pr]
|
|
5032
5068
|
}));
|
|
5033
5069
|
} catch (P) {
|
|
5034
|
-
throw console.error(`Error in approveToken for ${
|
|
5070
|
+
throw console.error(`Error in approveToken for ${b}:`, P), P;
|
|
5035
5071
|
}
|
|
5036
5072
|
};
|
|
5037
5073
|
return {
|
|
5038
5074
|
// Write functions
|
|
5039
5075
|
executePayment: async ({
|
|
5040
|
-
merchantAddress:
|
|
5076
|
+
merchantAddress: b,
|
|
5041
5077
|
tokens: v,
|
|
5042
5078
|
totalAmountUSD: P,
|
|
5043
5079
|
settleInIDR: T,
|
|
5044
|
-
target:
|
|
5045
|
-
callData:
|
|
5080
|
+
target: h,
|
|
5081
|
+
callData: g
|
|
5046
5082
|
}) => {
|
|
5047
5083
|
if (!e)
|
|
5048
5084
|
throw new Error("Wallet not connected");
|
|
5049
|
-
const S = v.filter(($) => $.percentage > 0),
|
|
5050
|
-
let
|
|
5051
|
-
const
|
|
5085
|
+
const S = v.filter(($) => $.percentage > 0), I = [], Z = [];
|
|
5086
|
+
let B = BigInt(0);
|
|
5087
|
+
const le = P * 3e-3, V = P + le;
|
|
5052
5088
|
for (const $ of S) {
|
|
5053
5089
|
if (!$.priceUSD || $.priceUSD <= 0)
|
|
5054
5090
|
throw new Error(
|
|
5055
5091
|
`Invalid price for ${$.symbol}. Price data may not be available yet. Please wait a moment and try again.`
|
|
5056
5092
|
);
|
|
5057
|
-
const
|
|
5058
|
-
if (!isFinite(
|
|
5093
|
+
const N = V * $.percentage / 100 / $.priceUSD;
|
|
5094
|
+
if (!isFinite(N) || N <= 0)
|
|
5059
5095
|
throw new Error(`Invalid amount calculated for ${$.symbol}`);
|
|
5060
|
-
const
|
|
5061
|
-
let
|
|
5062
|
-
|
|
5096
|
+
const K = Math.min($.decimals + 2, 18), re = N.toFixed(K);
|
|
5097
|
+
let L = Er(re, $.decimals);
|
|
5098
|
+
L = L + BigInt(1), $.address === "0x0000000000000000000000000000000000000000" ? (B = L, I.push($.address), Z.push(L)) : (I.push($.address), Z.push(L));
|
|
5063
5099
|
}
|
|
5064
5100
|
for (let $ = 0; $ < S.length; $++) {
|
|
5065
|
-
const
|
|
5066
|
-
if (
|
|
5101
|
+
const U = S[$];
|
|
5102
|
+
if (U.address !== "0x0000000000000000000000000000000000000000")
|
|
5067
5103
|
try {
|
|
5068
|
-
await
|
|
5069
|
-
} catch (
|
|
5070
|
-
throw new Error(`Failed to approve ${
|
|
5104
|
+
await y(U.address, Z[$]) && console.log(`Approved infinite allowance for ${U.symbol}`);
|
|
5105
|
+
} catch (N) {
|
|
5106
|
+
throw new Error(`Failed to approve ${U.symbol}: ${N}`);
|
|
5071
5107
|
}
|
|
5072
5108
|
}
|
|
5073
|
-
const
|
|
5109
|
+
const _ = BigInt(Math.floor(P * Dr)), te = h || "0x0000000000000000000000000000000000000000", W = g || "0x";
|
|
5074
5110
|
return await n({
|
|
5075
5111
|
address: O.PAYMENT_ROUTER,
|
|
5076
|
-
abi:
|
|
5112
|
+
abi: Oe,
|
|
5077
5113
|
functionName: "pay",
|
|
5078
5114
|
args: [
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5115
|
+
b,
|
|
5116
|
+
I,
|
|
5117
|
+
Z,
|
|
5118
|
+
_,
|
|
5083
5119
|
T,
|
|
5084
|
-
|
|
5085
|
-
|
|
5120
|
+
te,
|
|
5121
|
+
W
|
|
5086
5122
|
],
|
|
5087
|
-
value:
|
|
5123
|
+
value: B
|
|
5088
5124
|
});
|
|
5089
5125
|
},
|
|
5090
5126
|
// Read hooks
|
|
@@ -5099,73 +5135,73 @@ function to() {
|
|
|
5099
5135
|
error: a
|
|
5100
5136
|
};
|
|
5101
5137
|
}
|
|
5102
|
-
function
|
|
5103
|
-
const { address: t } =
|
|
5138
|
+
function Ue(e) {
|
|
5139
|
+
const { address: t } = He(), { writeContract: n, data: r, isPending: s, error: a } = xt(), { isLoading: i, isSuccess: o } = Tt({
|
|
5104
5140
|
hash: r
|
|
5105
5141
|
});
|
|
5106
5142
|
return {
|
|
5107
5143
|
// Write functions
|
|
5108
|
-
transfer: (T,
|
|
5144
|
+
transfer: (T, h) => {
|
|
5109
5145
|
n({
|
|
5110
5146
|
address: e,
|
|
5111
|
-
abi:
|
|
5147
|
+
abi: q,
|
|
5112
5148
|
functionName: "transfer",
|
|
5113
|
-
args: [T,
|
|
5149
|
+
args: [T, h]
|
|
5114
5150
|
});
|
|
5115
5151
|
},
|
|
5116
|
-
approve: (T,
|
|
5152
|
+
approve: (T, h) => {
|
|
5117
5153
|
n({
|
|
5118
5154
|
address: e,
|
|
5119
|
-
abi:
|
|
5155
|
+
abi: q,
|
|
5120
5156
|
functionName: "approve",
|
|
5121
|
-
args: [T,
|
|
5157
|
+
args: [T, h]
|
|
5122
5158
|
});
|
|
5123
5159
|
},
|
|
5124
|
-
transferFrom: (T,
|
|
5160
|
+
transferFrom: (T, h, g) => {
|
|
5125
5161
|
n({
|
|
5126
5162
|
address: e,
|
|
5127
|
-
abi:
|
|
5163
|
+
abi: q,
|
|
5128
5164
|
functionName: "transferFrom",
|
|
5129
|
-
args: [T,
|
|
5165
|
+
args: [T, h, g]
|
|
5130
5166
|
});
|
|
5131
5167
|
},
|
|
5132
5168
|
// Read hooks
|
|
5133
|
-
useName: () =>
|
|
5169
|
+
useName: () => z({
|
|
5134
5170
|
address: e,
|
|
5135
|
-
abi:
|
|
5171
|
+
abi: q,
|
|
5136
5172
|
functionName: "name"
|
|
5137
5173
|
}),
|
|
5138
|
-
useSymbol: () =>
|
|
5174
|
+
useSymbol: () => z({
|
|
5139
5175
|
address: e,
|
|
5140
|
-
abi:
|
|
5176
|
+
abi: q,
|
|
5141
5177
|
functionName: "symbol"
|
|
5142
5178
|
}),
|
|
5143
|
-
useDecimals: () =>
|
|
5179
|
+
useDecimals: () => z({
|
|
5144
5180
|
address: e,
|
|
5145
|
-
abi:
|
|
5181
|
+
abi: q,
|
|
5146
5182
|
functionName: "decimals"
|
|
5147
5183
|
}),
|
|
5148
|
-
useTotalSupply: () =>
|
|
5184
|
+
useTotalSupply: () => z({
|
|
5149
5185
|
address: e,
|
|
5150
|
-
abi:
|
|
5186
|
+
abi: q,
|
|
5151
5187
|
functionName: "totalSupply"
|
|
5152
5188
|
}),
|
|
5153
5189
|
useBalanceOf: (T) => {
|
|
5154
|
-
const
|
|
5155
|
-
return
|
|
5190
|
+
const h = T || t;
|
|
5191
|
+
return z({
|
|
5156
5192
|
address: e,
|
|
5157
|
-
abi:
|
|
5193
|
+
abi: q,
|
|
5158
5194
|
functionName: "balanceOf",
|
|
5159
|
-
args:
|
|
5160
|
-
query: { enabled: !!
|
|
5195
|
+
args: h ? [h] : void 0,
|
|
5196
|
+
query: { enabled: !!h }
|
|
5161
5197
|
});
|
|
5162
5198
|
},
|
|
5163
|
-
useAllowance: (T,
|
|
5199
|
+
useAllowance: (T, h) => z({
|
|
5164
5200
|
address: e,
|
|
5165
|
-
abi:
|
|
5201
|
+
abi: q,
|
|
5166
5202
|
functionName: "allowance",
|
|
5167
|
-
args: T &&
|
|
5168
|
-
query: { enabled: !!(T &&
|
|
5203
|
+
args: T && h ? [T, h] : void 0,
|
|
5204
|
+
query: { enabled: !!(T && h) }
|
|
5169
5205
|
}),
|
|
5170
5206
|
// Transaction state
|
|
5171
5207
|
hash: r,
|
|
@@ -5175,23 +5211,23 @@ function Be(e) {
|
|
|
5175
5211
|
error: a
|
|
5176
5212
|
};
|
|
5177
5213
|
}
|
|
5178
|
-
function
|
|
5179
|
-
const { address: e } =
|
|
5214
|
+
function ro() {
|
|
5215
|
+
const { address: e } = He(), { data: t, isLoading: n } = wr({
|
|
5180
5216
|
address: e
|
|
5181
|
-
}), r =
|
|
5217
|
+
}), r = Ue(E.USDC), s = Ue(E.USDT), a = Ue(E.DAI), i = Ue(E.WBTC), { data: o, isLoading: c } = r.useBalanceOf(e), { data: d, isLoading: l } = s.useBalanceOf(e), { data: m, isLoading: y } = a.useBalanceOf(e), { data: p, isLoading: b } = i.useBalanceOf(e);
|
|
5182
5218
|
return {
|
|
5183
5219
|
balances: {
|
|
5184
5220
|
ETH: t ? parseFloat(Ce(t.value, 18)) : 0,
|
|
5185
5221
|
USDC: o ? parseFloat(Ce(o, 6)) : 0,
|
|
5186
5222
|
USDT: d ? parseFloat(Ce(d, 6)) : 0,
|
|
5187
|
-
DAI:
|
|
5188
|
-
WBTC:
|
|
5223
|
+
DAI: m ? parseFloat(Ce(m, 18)) : 0,
|
|
5224
|
+
WBTC: p ? parseFloat(Ce(p, 8)) : 0
|
|
5189
5225
|
},
|
|
5190
|
-
isLoading: !e || n || c || l ||
|
|
5226
|
+
isLoading: !e || n || c || l || y || b
|
|
5191
5227
|
};
|
|
5192
5228
|
}
|
|
5193
|
-
function
|
|
5194
|
-
const e =
|
|
5229
|
+
function so() {
|
|
5230
|
+
const e = vt(), {
|
|
5195
5231
|
data: t,
|
|
5196
5232
|
isLoading: n,
|
|
5197
5233
|
error: r
|
|
@@ -5205,17 +5241,17 @@ function ro() {
|
|
|
5205
5241
|
error: d
|
|
5206
5242
|
} = e.useGetTokenPrice(E.USDT), {
|
|
5207
5243
|
data: l,
|
|
5208
|
-
isLoading:
|
|
5209
|
-
error:
|
|
5244
|
+
isLoading: m,
|
|
5245
|
+
error: y
|
|
5210
5246
|
} = e.useGetTokenPrice(E.DAI), {
|
|
5211
|
-
data:
|
|
5212
|
-
isLoading:
|
|
5247
|
+
data: p,
|
|
5248
|
+
isLoading: b,
|
|
5213
5249
|
error: v
|
|
5214
|
-
} = e.useGetTokenPrice(E.WBTC), P = 1e8, T = (
|
|
5215
|
-
if (!
|
|
5250
|
+
} = e.useGetTokenPrice(E.WBTC), P = 1e8, T = (g) => {
|
|
5251
|
+
if (!g) return 0;
|
|
5216
5252
|
try {
|
|
5217
|
-
if (Array.isArray(
|
|
5218
|
-
const S =
|
|
5253
|
+
if (Array.isArray(g) && g.length >= 1) {
|
|
5254
|
+
const S = g[0];
|
|
5219
5255
|
if (typeof S == "bigint")
|
|
5220
5256
|
return Number(S) / P;
|
|
5221
5257
|
if (typeof S == "number")
|
|
@@ -5223,27 +5259,27 @@ function ro() {
|
|
|
5223
5259
|
if (typeof S == "string")
|
|
5224
5260
|
return Number(S) / P;
|
|
5225
5261
|
}
|
|
5226
|
-
return typeof
|
|
5262
|
+
return typeof g == "bigint" ? Number(g) / P : typeof g == "number" ? g / P : 0;
|
|
5227
5263
|
} catch (S) {
|
|
5228
5264
|
return console.error("Error converting price:", S), 0;
|
|
5229
5265
|
}
|
|
5230
5266
|
};
|
|
5231
|
-
r && console.error("ETH price error:", r), i && console.error("USDC price error:", i), d && console.error("USDT price error:", d),
|
|
5232
|
-
const
|
|
5267
|
+
r && console.error("ETH price error:", r), i && console.error("USDC price error:", i), d && console.error("USDT price error:", d), y && console.error("DAI price error:", y), v && console.error("WBTC price error:", v);
|
|
5268
|
+
const h = {
|
|
5233
5269
|
ETH: T(t),
|
|
5234
5270
|
USDC: T(s) || 1,
|
|
5235
5271
|
USDT: T(o) || 1,
|
|
5236
5272
|
DAI: T(l) || 1,
|
|
5237
|
-
WBTC: T(
|
|
5273
|
+
WBTC: T(p)
|
|
5238
5274
|
};
|
|
5239
|
-
return console.log("Converted prices:",
|
|
5240
|
-
prices:
|
|
5241
|
-
isLoading: n || a || c ||
|
|
5275
|
+
return console.log("Converted prices:", h), {
|
|
5276
|
+
prices: h,
|
|
5277
|
+
isLoading: n || a || c || m || b,
|
|
5242
5278
|
errors: {
|
|
5243
5279
|
ETH: r,
|
|
5244
5280
|
USDC: i,
|
|
5245
5281
|
USDT: d,
|
|
5246
|
-
DAI:
|
|
5282
|
+
DAI: y,
|
|
5247
5283
|
WBTC: v
|
|
5248
5284
|
}
|
|
5249
5285
|
};
|
|
@@ -5255,7 +5291,7 @@ class ie extends Error {
|
|
|
5255
5291
|
super(t), this.name = "PaymentError", this.code = n, this.details = r;
|
|
5256
5292
|
}
|
|
5257
5293
|
}
|
|
5258
|
-
function
|
|
5294
|
+
function en(e) {
|
|
5259
5295
|
if (e instanceof Error) {
|
|
5260
5296
|
if (e.message.includes("User rejected") || e.message.includes("User denied"))
|
|
5261
5297
|
return new ie("Transaction cancelled by user", "USER_REJECTED", e);
|
|
@@ -5280,8 +5316,8 @@ function qt(e) {
|
|
|
5280
5316
|
}
|
|
5281
5317
|
return new ie("An unknown error occurred. Please try again", "UNKNOWN", e);
|
|
5282
5318
|
}
|
|
5283
|
-
const
|
|
5284
|
-
function
|
|
5319
|
+
const ao = 1e8, io = (e) => e.reduce((t, n) => t + n.price, 0);
|
|
5320
|
+
function Io({
|
|
5285
5321
|
merchantAddress: e,
|
|
5286
5322
|
items: t,
|
|
5287
5323
|
config: n,
|
|
@@ -5290,148 +5326,156 @@ function ko({
|
|
|
5290
5326
|
className: a = "",
|
|
5291
5327
|
children: i
|
|
5292
5328
|
}) {
|
|
5293
|
-
const { isConnected: o } =
|
|
5294
|
-
if (!
|
|
5295
|
-
if (Array.isArray(
|
|
5296
|
-
const
|
|
5297
|
-
if (typeof
|
|
5298
|
-
return Number(
|
|
5329
|
+
const { isConnected: o } = He(), { connect: c, connectors: d } = xr(), l = n?.currency ?? "USD", m = n?.target, y = n?.callData, p = io(t), [b, v] = G(!1), [P, T] = G([]), h = vt(), { balances: g, isLoading: S } = ro(), { prices: I, isLoading: Z } = so(), { data: B } = h.useGetTokenPrice(E.IDRX), { executePayment: le, isConfirmed: V, hash: _, error: te, isPending: W, isConfirming: $ } = no(), [U, N] = G(!1), re = (() => {
|
|
5330
|
+
if (!B) return 1 / 15600;
|
|
5331
|
+
if (Array.isArray(B) && B.length >= 1) {
|
|
5332
|
+
const M = B[0];
|
|
5333
|
+
if (typeof M == "bigint")
|
|
5334
|
+
return Number(M) / ao;
|
|
5299
5335
|
}
|
|
5300
5336
|
return 1 / 15600;
|
|
5301
|
-
})(),
|
|
5302
|
-
o ? v(!0) : c({ connector: d[0] });
|
|
5303
|
-
},
|
|
5337
|
+
})(), L = l === "IDR" ? p * re : p, me = () => {
|
|
5338
|
+
o ? (N(!1), v(!0)) : c({ connector: d[0] });
|
|
5339
|
+
}, se = async (M) => {
|
|
5304
5340
|
try {
|
|
5305
|
-
await
|
|
5341
|
+
N(!1), await le({
|
|
5306
5342
|
merchantAddress: e,
|
|
5307
|
-
tokens:
|
|
5308
|
-
totalAmountUSD:
|
|
5343
|
+
tokens: M,
|
|
5344
|
+
totalAmountUSD: L,
|
|
5309
5345
|
settleInIDR: l === "IDR",
|
|
5310
|
-
target:
|
|
5311
|
-
callData:
|
|
5346
|
+
target: m,
|
|
5347
|
+
callData: y
|
|
5312
5348
|
});
|
|
5313
|
-
} catch (
|
|
5314
|
-
|
|
5315
|
-
|
|
5349
|
+
} catch (j) {
|
|
5350
|
+
N(!0);
|
|
5351
|
+
const Me = en(j);
|
|
5352
|
+
s?.(Me);
|
|
5316
5353
|
}
|
|
5317
5354
|
};
|
|
5318
5355
|
return ve(() => {
|
|
5319
|
-
if (!S && !
|
|
5320
|
-
const
|
|
5356
|
+
if (!S && !Z) {
|
|
5357
|
+
const M = [
|
|
5321
5358
|
{
|
|
5322
5359
|
id: "eth",
|
|
5323
|
-
name:
|
|
5324
|
-
symbol:
|
|
5325
|
-
amount:
|
|
5360
|
+
name: D.ETH.name,
|
|
5361
|
+
symbol: D.ETH.symbol,
|
|
5362
|
+
amount: g.ETH,
|
|
5326
5363
|
chain: "Lisk Sepolia",
|
|
5327
5364
|
percentage: 0,
|
|
5328
5365
|
address: E.NATIVE,
|
|
5329
|
-
decimals:
|
|
5330
|
-
priceUSD:
|
|
5366
|
+
decimals: D.ETH.decimals,
|
|
5367
|
+
priceUSD: I.ETH,
|
|
5368
|
+
tokenIcon: D.ETH.logo
|
|
5331
5369
|
},
|
|
5332
5370
|
{
|
|
5333
5371
|
id: "usdc",
|
|
5334
|
-
name:
|
|
5335
|
-
symbol:
|
|
5336
|
-
amount:
|
|
5372
|
+
name: D.USDC.name,
|
|
5373
|
+
symbol: D.USDC.symbol,
|
|
5374
|
+
amount: g.USDC,
|
|
5337
5375
|
chain: "Lisk Sepolia",
|
|
5338
5376
|
percentage: 0,
|
|
5339
5377
|
address: E.USDC,
|
|
5340
|
-
decimals:
|
|
5341
|
-
priceUSD:
|
|
5378
|
+
decimals: D.USDC.decimals,
|
|
5379
|
+
priceUSD: I.USDC,
|
|
5380
|
+
tokenIcon: D.USDC.logo
|
|
5342
5381
|
},
|
|
5343
5382
|
{
|
|
5344
5383
|
id: "usdt",
|
|
5345
|
-
name:
|
|
5346
|
-
symbol:
|
|
5347
|
-
amount:
|
|
5384
|
+
name: D.USDT.name,
|
|
5385
|
+
symbol: D.USDT.symbol,
|
|
5386
|
+
amount: g.USDT,
|
|
5348
5387
|
chain: "Lisk Sepolia",
|
|
5349
5388
|
percentage: 0,
|
|
5350
5389
|
address: E.USDT,
|
|
5351
|
-
decimals:
|
|
5352
|
-
priceUSD:
|
|
5390
|
+
decimals: D.USDT.decimals,
|
|
5391
|
+
priceUSD: I.USDT,
|
|
5392
|
+
tokenIcon: D.USDT.logo
|
|
5353
5393
|
},
|
|
5354
5394
|
{
|
|
5355
5395
|
id: "dai",
|
|
5356
|
-
name:
|
|
5357
|
-
symbol:
|
|
5358
|
-
amount:
|
|
5396
|
+
name: D.DAI.name,
|
|
5397
|
+
symbol: D.DAI.symbol,
|
|
5398
|
+
amount: g.DAI,
|
|
5359
5399
|
chain: "Lisk Sepolia",
|
|
5360
5400
|
percentage: 0,
|
|
5361
5401
|
address: E.DAI,
|
|
5362
|
-
decimals:
|
|
5363
|
-
priceUSD:
|
|
5402
|
+
decimals: D.DAI.decimals,
|
|
5403
|
+
priceUSD: I.DAI,
|
|
5404
|
+
tokenIcon: D.DAI.logo
|
|
5364
5405
|
},
|
|
5365
5406
|
{
|
|
5366
5407
|
id: "wbtc",
|
|
5367
|
-
name:
|
|
5368
|
-
symbol:
|
|
5369
|
-
amount:
|
|
5408
|
+
name: D.WBTC.name,
|
|
5409
|
+
symbol: D.WBTC.symbol,
|
|
5410
|
+
amount: g.WBTC,
|
|
5370
5411
|
chain: "Lisk Sepolia",
|
|
5371
5412
|
percentage: 0,
|
|
5372
5413
|
address: E.WBTC,
|
|
5373
|
-
decimals:
|
|
5374
|
-
priceUSD:
|
|
5414
|
+
decimals: D.WBTC.decimals,
|
|
5415
|
+
priceUSD: I.WBTC,
|
|
5416
|
+
tokenIcon: D.WBTC.logo
|
|
5375
5417
|
}
|
|
5376
5418
|
];
|
|
5377
|
-
T(
|
|
5419
|
+
T(M);
|
|
5378
5420
|
}
|
|
5379
5421
|
}, [
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5422
|
+
g.ETH,
|
|
5423
|
+
g.USDC,
|
|
5424
|
+
g.USDT,
|
|
5425
|
+
g.DAI,
|
|
5426
|
+
g.WBTC,
|
|
5427
|
+
I.ETH,
|
|
5428
|
+
I.USDC,
|
|
5429
|
+
I.USDT,
|
|
5430
|
+
I.DAI,
|
|
5431
|
+
I.WBTC,
|
|
5390
5432
|
S,
|
|
5391
|
-
|
|
5433
|
+
Z
|
|
5392
5434
|
]), ve(() => {
|
|
5393
|
-
if (
|
|
5394
|
-
const
|
|
5435
|
+
if (V && _) {
|
|
5436
|
+
const M = {
|
|
5395
5437
|
success: !0,
|
|
5396
|
-
transactionId:
|
|
5397
|
-
tokens: P.filter((
|
|
5438
|
+
transactionId: _,
|
|
5439
|
+
tokens: P.filter((j) => j.percentage > 0)
|
|
5398
5440
|
};
|
|
5399
|
-
r?.(
|
|
5441
|
+
r?.(M);
|
|
5400
5442
|
}
|
|
5401
|
-
}, [
|
|
5402
|
-
if (
|
|
5403
|
-
|
|
5404
|
-
|
|
5443
|
+
}, [V, _]), ve(() => {
|
|
5444
|
+
if (te) {
|
|
5445
|
+
N(!0);
|
|
5446
|
+
const M = en(te);
|
|
5447
|
+
s?.(M);
|
|
5405
5448
|
}
|
|
5406
|
-
}, [
|
|
5449
|
+
}, [te]), /* @__PURE__ */ x(mr, { children: [
|
|
5407
5450
|
/* @__PURE__ */ u(
|
|
5408
5451
|
"button",
|
|
5409
5452
|
{
|
|
5410
|
-
onClick:
|
|
5411
|
-
disabled: S ||
|
|
5453
|
+
onClick: me,
|
|
5454
|
+
disabled: S || Z,
|
|
5412
5455
|
className: `mc:bg-secondary hover:mc:bg-secondary/90 mc:text-white mc:font-semibold mc:py-3 mc:px-6 mc:rounded-lg mc:transition-all disabled:mc:opacity-50 disabled:mc:cursor-not-allowed ${a}`,
|
|
5413
5456
|
children: i || (o ? "Pay with MultiCoyn" : "Connect Wallet to Pay")
|
|
5414
5457
|
}
|
|
5415
5458
|
),
|
|
5416
5459
|
o && /* @__PURE__ */ u(
|
|
5417
|
-
|
|
5460
|
+
Gr,
|
|
5418
5461
|
{
|
|
5419
|
-
isOpen:
|
|
5462
|
+
isOpen: b,
|
|
5420
5463
|
onClose: () => v(!1),
|
|
5421
|
-
totalAmount:
|
|
5464
|
+
totalAmount: L,
|
|
5422
5465
|
currency: l,
|
|
5423
5466
|
items: t,
|
|
5424
5467
|
tokens: P,
|
|
5425
|
-
onPaymentSubmit:
|
|
5426
|
-
transactionHash:
|
|
5427
|
-
isProcessing:
|
|
5428
|
-
isSuccess:
|
|
5429
|
-
|
|
5468
|
+
onPaymentSubmit: se,
|
|
5469
|
+
transactionHash: _,
|
|
5470
|
+
isProcessing: W || $,
|
|
5471
|
+
isSuccess: V,
|
|
5472
|
+
isError: U,
|
|
5473
|
+
conversionRate: re
|
|
5430
5474
|
}
|
|
5431
5475
|
)
|
|
5432
5476
|
] });
|
|
5433
5477
|
}
|
|
5434
|
-
const
|
|
5478
|
+
const oo = Sr({
|
|
5435
5479
|
id: 4202,
|
|
5436
5480
|
name: "Lisk Sepolia",
|
|
5437
5481
|
nativeCurrency: {
|
|
@@ -5451,79 +5495,79 @@ const io = Pr({
|
|
|
5451
5495
|
}
|
|
5452
5496
|
},
|
|
5453
5497
|
testnet: !0
|
|
5454
|
-
}),
|
|
5498
|
+
}), co = Cr({
|
|
5455
5499
|
appName: "MultiCoyn Payment SDK",
|
|
5456
5500
|
projectId: "YOUR_PROJECT_ID",
|
|
5457
|
-
chains: [
|
|
5501
|
+
chains: [oo],
|
|
5458
5502
|
ssr: !1
|
|
5459
|
-
}),
|
|
5460
|
-
function
|
|
5461
|
-
return /* @__PURE__ */ u(
|
|
5503
|
+
}), uo = new $r();
|
|
5504
|
+
function No({ children: e }) {
|
|
5505
|
+
return /* @__PURE__ */ u(Tr, { config: co, children: /* @__PURE__ */ u(Ar, { client: uo, children: /* @__PURE__ */ u(kr, { children: e }) }) });
|
|
5462
5506
|
}
|
|
5463
|
-
const
|
|
5507
|
+
const nr = br(
|
|
5464
5508
|
void 0
|
|
5465
5509
|
);
|
|
5466
|
-
function
|
|
5510
|
+
function Ro({
|
|
5467
5511
|
children: e,
|
|
5468
5512
|
initialConfig: t = {}
|
|
5469
5513
|
}) {
|
|
5470
|
-
const [n, r] =
|
|
5514
|
+
const [n, r] = G(t), s = (a) => {
|
|
5471
5515
|
r((i) => ({ ...i, ...a }));
|
|
5472
5516
|
};
|
|
5473
|
-
return /* @__PURE__ */ u(
|
|
5517
|
+
return /* @__PURE__ */ u(nr.Provider, { value: { config: n, updateConfig: s }, children: e });
|
|
5474
5518
|
}
|
|
5475
|
-
function
|
|
5476
|
-
const e =
|
|
5519
|
+
function Mo() {
|
|
5520
|
+
const e = hr(nr);
|
|
5477
5521
|
if (!e)
|
|
5478
5522
|
throw new Error("usePaymentConfig must be used within PaymentProvider");
|
|
5479
5523
|
return e;
|
|
5480
5524
|
}
|
|
5481
5525
|
export {
|
|
5482
|
-
|
|
5526
|
+
Ao as A,
|
|
5483
5527
|
f as B,
|
|
5484
5528
|
O as C,
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5529
|
+
no as D,
|
|
5530
|
+
vt as E,
|
|
5531
|
+
Ue as F,
|
|
5532
|
+
ro as G,
|
|
5533
|
+
ko as H,
|
|
5534
|
+
es as I,
|
|
5535
|
+
so as J,
|
|
5536
|
+
go as K,
|
|
5537
|
+
wo as L,
|
|
5538
|
+
Io as M,
|
|
5539
|
+
xo as N,
|
|
5540
|
+
Dr as O,
|
|
5541
|
+
jr as P,
|
|
5542
|
+
To as Q,
|
|
5543
|
+
D as R,
|
|
5500
5544
|
E as T,
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5545
|
+
Mr as U,
|
|
5546
|
+
No as W,
|
|
5547
|
+
So as a,
|
|
5548
|
+
Po as b,
|
|
5549
|
+
kt as c,
|
|
5550
|
+
An as d,
|
|
5551
|
+
Sn as e,
|
|
5508
5552
|
Pe as f,
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5553
|
+
Dt as g,
|
|
5554
|
+
Le as h,
|
|
5555
|
+
Xr as i,
|
|
5556
|
+
Eo as j,
|
|
5557
|
+
ai as k,
|
|
5514
5558
|
ge as l,
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5559
|
+
Fe as m,
|
|
5560
|
+
Yn as n,
|
|
5561
|
+
Bt as o,
|
|
5562
|
+
oi as p,
|
|
5563
|
+
Yi as q,
|
|
5520
5564
|
Se as r,
|
|
5521
|
-
|
|
5522
|
-
|
|
5565
|
+
ze as s,
|
|
5566
|
+
Mt as t,
|
|
5523
5567
|
Re as u,
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5568
|
+
Ro as v,
|
|
5569
|
+
Mo as w,
|
|
5570
|
+
co as x,
|
|
5571
|
+
oo as y,
|
|
5572
|
+
vo as z
|
|
5529
5573
|
};
|