@funkit/core 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fetch-polyfill.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/src/abis/CheckoutPaymaster.json +1 -0
- package/dist/src/actions/AccessControl.d.ts +6 -6
- package/dist/src/actions/AccessControl.js +19 -15
- package/dist/src/actions/AccessControl.js.map +1 -1
- package/dist/src/actions/BatchActions.d.ts +2 -2
- package/dist/src/actions/BatchActions.js +2 -2
- package/dist/src/actions/BatchActions.js.map +1 -1
- package/dist/src/actions/Bridge.d.ts +4 -4
- package/dist/src/actions/Bridge.js +10 -6
- package/dist/src/actions/Bridge.js.map +1 -1
- package/dist/src/actions/FirstClassActions.d.ts +6 -6
- package/dist/src/actions/FirstClassActions.js +25 -23
- package/dist/src/actions/FirstClassActions.js.map +1 -1
- package/dist/src/actions/Group.d.ts +3 -3
- package/dist/src/actions/Group.js +6 -14
- package/dist/src/actions/Group.js.map +1 -1
- package/dist/src/actions/LimitOrder.d.ts +3 -3
- package/dist/src/actions/LimitOrder.js +16 -13
- package/dist/src/actions/LimitOrder.js.map +1 -1
- package/dist/src/actions/Stake.d.ts +3 -3
- package/dist/src/actions/Stake.js +31 -44
- package/dist/src/actions/Stake.js.map +1 -1
- package/dist/src/actions/Swap.d.ts +4 -4
- package/dist/src/actions/Swap.js +37 -35
- package/dist/src/actions/Swap.js.map +1 -1
- package/dist/src/actions/Token.d.ts +3 -3
- package/dist/src/actions/Token.js +33 -23
- package/dist/src/actions/Token.js.map +1 -1
- package/dist/src/actions/index.d.ts +7 -7
- package/dist/src/actions/types.d.ts +4 -4
- package/dist/src/actions/types.js +2 -2
- package/dist/src/actions/types.js.map +1 -1
- package/dist/src/apis/AccessControlApis.d.ts +1 -1
- package/dist/src/apis/AccessControlApis.js +7 -3
- package/dist/src/apis/AccessControlApis.js.map +1 -1
- package/dist/src/apis/AssetApis.d.ts +10 -0
- package/dist/src/apis/AssetApis.js +11 -1
- package/dist/src/apis/AssetApis.js.map +1 -1
- package/dist/src/apis/BridgeApis.d.ts +1 -1
- package/dist/src/apis/BridgeApis.js +13 -13
- package/dist/src/apis/BridgeApis.js.map +1 -1
- package/dist/src/apis/CheckoutApis.d.ts +43 -0
- package/dist/src/apis/CheckoutApis.js +116 -0
- package/dist/src/apis/CheckoutApis.js.map +1 -0
- package/dist/src/apis/ContractApis.js +1 -1
- package/dist/src/apis/ContractApis.js.map +1 -1
- package/dist/src/apis/FaucetApis.js.map +1 -1
- package/dist/src/apis/GroupApis.d.ts +2 -2
- package/dist/src/apis/GroupApis.js +3 -3
- package/dist/src/apis/GroupApis.js.map +1 -1
- package/dist/src/apis/InfoApis.d.ts +1 -1
- package/dist/src/apis/InfoApis.js +9 -7
- package/dist/src/apis/InfoApis.js.map +1 -1
- package/dist/src/apis/ListenerApis.d.ts +1 -1
- package/dist/src/apis/ListenerApis.js +6 -6
- package/dist/src/apis/ListenerApis.js.map +1 -1
- package/dist/src/apis/MeshApis.d.ts +87 -0
- package/dist/src/apis/MeshApis.js +213 -0
- package/dist/src/apis/MeshApis.js.map +1 -0
- package/dist/src/apis/NFTApis.js.map +1 -1
- package/dist/src/apis/OnOffRampApis.d.ts +2 -0
- package/dist/src/apis/OnOffRampApis.js +24 -5
- package/dist/src/apis/OnOffRampApis.js.map +1 -1
- package/dist/src/apis/OnOffRampUtils.js +2 -2
- package/dist/src/apis/OnOffRampUtils.js.map +1 -1
- package/dist/src/apis/OperationApis.d.ts +4 -4
- package/dist/src/apis/OperationApis.js +21 -12
- package/dist/src/apis/OperationApis.js.map +1 -1
- package/dist/src/apis/PaymasterApis.d.ts +1 -1
- package/dist/src/apis/PaymasterApis.js +2 -2
- package/dist/src/apis/PaymasterApis.js.map +1 -1
- package/dist/src/apis/SwapApis.d.ts +2 -2
- package/dist/src/apis/SwapApis.js +6 -6
- package/dist/src/apis/SwapApis.js.map +1 -1
- package/dist/src/apis/TurnkeyApis.d.ts +1 -1
- package/dist/src/apis/TurnkeyApis.js +3 -3
- package/dist/src/apis/TurnkeyApis.js.map +1 -1
- package/dist/src/apis/UserApis.d.ts +2 -2
- package/dist/src/apis/UserApis.js +10 -7
- package/dist/src/apis/UserApis.js.map +1 -1
- package/dist/src/apis/index.d.ts +13 -11
- package/dist/src/apis/index.js +3 -1
- package/dist/src/apis/index.js.map +1 -1
- package/dist/src/apis/types.d.ts +75 -3
- package/dist/src/apis/types.js +16 -0
- package/dist/src/apis/types.js.map +1 -1
- package/dist/src/auth/Auth.d.ts +6 -6
- package/dist/src/auth/Auth.js +43 -46
- package/dist/src/auth/Auth.js.map +1 -1
- package/dist/src/auth/SessionKeyAuth.d.ts +5 -5
- package/dist/src/auth/SessionKeyAuth.js +29 -24
- package/dist/src/auth/SessionKeyAuth.js.map +1 -1
- package/dist/src/auth/index.d.ts +2 -2
- package/dist/src/auth/types.d.ts +1 -1
- package/dist/src/common/constants.d.ts +110 -17
- package/dist/src/common/constants.js +158 -85
- package/dist/src/common/constants.js.map +1 -1
- package/dist/src/common/index.d.ts +2 -2
- package/dist/src/common/types.d.ts +2 -2
- package/dist/src/config/Config.d.ts +1 -1
- package/dist/src/config/Config.js +10 -4
- package/dist/src/config/Config.js.map +1 -1
- package/dist/src/config/index.d.ts +2 -2
- package/dist/src/config/types.d.ts +4 -2
- package/dist/src/data/Chain.d.ts +4 -4
- package/dist/src/data/Chain.js +38 -27
- package/dist/src/data/Chain.js.map +1 -1
- package/dist/src/data/NFT.d.ts +3 -3
- package/dist/src/data/NFT.js +11 -11
- package/dist/src/data/NFT.js.map +1 -1
- package/dist/src/data/Operation.d.ts +5 -5
- package/dist/src/data/Operation.js +12 -10
- package/dist/src/data/Operation.js.map +1 -1
- package/dist/src/data/SolidityData.d.ts +3 -3
- package/dist/src/data/SolidityData.js +37 -17
- package/dist/src/data/SolidityData.js.map +1 -1
- package/dist/src/data/Token.d.ts +4 -4
- package/dist/src/data/Token.js +9 -9
- package/dist/src/data/Token.js.map +1 -1
- package/dist/src/data/index.d.ts +6 -6
- package/dist/src/data/index.js +2 -2
- package/dist/src/data/index.js.map +1 -1
- package/dist/src/data/types.d.ts +2 -2
- package/dist/src/data/types.js +3 -3
- package/dist/src/data/types.js.map +1 -1
- package/dist/src/errors/BaseError.js +4 -3
- package/dist/src/errors/BaseError.js.map +1 -1
- package/dist/src/errors/ClientError.d.ts +1 -1
- package/dist/src/errors/ClientError.js +3 -3
- package/dist/src/errors/ClientError.js.map +1 -1
- package/dist/src/errors/ServerError.d.ts +1 -1
- package/dist/src/errors/ServerError.js.map +1 -1
- package/dist/src/errors/index.d.ts +4 -4
- package/dist/src/errors/types.d.ts +2 -1
- package/dist/src/errors/types.js +4 -3
- package/dist/src/errors/types.js.map +1 -1
- package/dist/src/sponsors/CheckoutSponsor.d.ts +23 -0
- package/dist/src/sponsors/CheckoutSponsor.js +65 -0
- package/dist/src/sponsors/CheckoutSponsor.js.map +1 -0
- package/dist/src/sponsors/GaslessSponsor.d.ts +4 -4
- package/dist/src/sponsors/GaslessSponsor.js +18 -15
- package/dist/src/sponsors/GaslessSponsor.js.map +1 -1
- package/dist/src/sponsors/Sponsor.d.ts +5 -5
- package/dist/src/sponsors/Sponsor.js +12 -11
- package/dist/src/sponsors/Sponsor.js.map +1 -1
- package/dist/src/sponsors/TokenSponsor.d.ts +7 -7
- package/dist/src/sponsors/TokenSponsor.js +75 -68
- package/dist/src/sponsors/TokenSponsor.js.map +1 -1
- package/dist/src/sponsors/index.d.ts +4 -3
- package/dist/src/sponsors/index.js +2 -1
- package/dist/src/sponsors/index.js.map +1 -1
- package/dist/src/sponsors/types.d.ts +2 -1
- package/dist/src/sponsors/types.js +2 -1
- package/dist/src/sponsors/types.js.map +1 -1
- package/dist/src/utils/ApiUtils.js +21 -19
- package/dist/src/utils/ApiUtils.js.map +1 -1
- package/dist/src/utils/AuthUtils.d.ts +1 -1
- package/dist/src/utils/AuthUtils.js +4 -4
- package/dist/src/utils/AuthUtils.js.map +1 -1
- package/dist/src/utils/ChainUtils.d.ts +5 -5
- package/dist/src/utils/ChainUtils.js +35 -20
- package/dist/src/utils/ChainUtils.js.map +1 -1
- package/dist/src/utils/CheckoutUtils.d.ts +6 -0
- package/dist/src/utils/CheckoutUtils.js +24 -0
- package/dist/src/utils/CheckoutUtils.js.map +1 -0
- package/dist/src/utils/GroupUtils.d.ts +3 -3
- package/dist/src/utils/GroupUtils.js +8 -8
- package/dist/src/utils/GroupUtils.js.map +1 -1
- package/dist/src/utils/MerkleUtils.d.ts +1 -1
- package/dist/src/utils/MerkleUtils.js +5 -5
- package/dist/src/utils/MerkleUtils.js.map +1 -1
- package/dist/src/utils/PaymasterUtils.d.ts +3 -3
- package/dist/src/utils/PaymasterUtils.js +6 -2
- package/dist/src/utils/PaymasterUtils.js.map +1 -1
- package/dist/src/utils/SwapUtils.d.ts +2 -2
- package/dist/src/utils/SwapUtils.js +42 -33
- package/dist/src/utils/SwapUtils.js.map +1 -1
- package/dist/src/utils/TypeUtils.js.map +1 -1
- package/dist/src/utils/UserOpUtils.d.ts +2 -2
- package/dist/src/utils/UserOpUtils.js +77 -65
- package/dist/src/utils/UserOpUtils.js.map +1 -1
- package/dist/src/utils/ViemUtils.d.ts +2 -2
- package/dist/src/utils/ViemUtils.js +10 -6
- package/dist/src/utils/ViemUtils.js.map +1 -1
- package/dist/src/utils/WalletUtils.d.ts +2 -2
- package/dist/src/utils/WalletUtils.js +6 -5
- package/dist/src/utils/WalletUtils.js.map +1 -1
- package/dist/src/utils/index.d.ts +8 -7
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/viem/ContractInterface.d.ts +4 -4
- package/dist/src/viem/ContractInterface.js +8 -8
- package/dist/src/viem/ContractInterface.js.map +1 -1
- package/dist/src/viem/Converter.d.ts +823 -1107
- package/dist/src/viem/Converter.js +11 -11
- package/dist/src/viem/Converter.js.map +1 -1
- package/dist/src/viem/index.d.ts +2 -2
- package/dist/src/wallet/FunWallet.d.ts +8 -8
- package/dist/src/wallet/FunWallet.js +133 -89
- package/dist/src/wallet/FunWallet.js.map +1 -1
- package/dist/src/wallet/index.d.ts +2 -2
- package/dist/src/wallet/types.d.ts +1 -1
- package/package.json +13 -5
|
@@ -3,11 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.BASE_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION = exports.BYTES32_LENGTH = exports.VALID_PRIVATE_KEY_LENGTH = exports.ETH_TRANSFER_SELECTOR = exports.FUN_FAUCET_URL = exports.gasSpecificChain = exports.CONTRACT_ADDRESSES = exports.UNISWAP_V3_LIMIT_ORDER_CONTRACT_INTERFACE = exports.USER_AUTHENTICATION_CONTRACT_INTERFACE = exports.RBAC_CONTRACT_INTERFACE = exports.UNISWAPV2ROUTER02_INTERFACE = exports.UNISWAPV2FACTORY_INTERFACE = exports.APPROVE_AND_EXEC_CONTRACT_INTERFACE = exports.POOL_CONTRACT_INTERFACE = exports.WALLET_CONTRACT_INTERFACE = exports.CHECKOUT_PAYMASTER_CONTRACT_INTERFACE = exports.TOKEN_PAYMASTER_CONTRACT_INTERFACE = exports.GASLESS_PAYMASTER_CONTRACT_INTERFACE = exports.FACTORY_CONTRACT_INTERFACE = exports.ERC20_CONTRACT_INTERFACE = exports.ERC721_CONTRACT_INTERFACE = exports.ENTRYPOINT_CONTRACT_INTERFACE = exports.ESTIMATION_PAYMASTER_ABI = exports.USER_AUTHENTICATION_ABI = exports.ROLE_BASED_ACCESS_CONTROL_ABI = exports.UNISWAPV2ROUTER02_ABI = exports.UNISWAPV2FACTORY_ABI = exports.UNISWAP_V3_LIMIT_ORDER_ABI = exports.ERC_721_ABI = exports.WITHDRAW_QUEUE_ABI = exports.CHECKOUT_PAYMASTER_ABI = exports.TOKEN_PAYMASTER_ABI = exports.GASLESS_PAYMASTER_ABI = exports.FACTORY_ABI = exports.WALLET_ABI = exports.ERC20_ABI = exports.ENTRYPOINT_ABI = exports.APPROVE_AND_SWAP_ABI = exports.APPROVE_AND_EXEC_ABI = exports.HashZero = exports.AddressZero = exports.CHECKOUT_SPONSOR_SUPPORT_CHAINS = exports.GASLESS_SPONSOR_SUPPORT_CHAINS = exports.TOKEN_SPONSOR_SUPPORT_CHAINS = exports.FUN_TOKEN_SPONSOR_ADDRESS = exports.FUN_GASLESS_SPONSOR_ADDRESS = exports.BASE_WRAP_TOKEN_ADDR = exports.DASHBOARD_API_URL = exports.API_URL = exports.LOCAL_API_URL = void 0;
|
|
7
|
+
exports.FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS = exports.FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO = exports.ETHEREUM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION = exports.OPTIMISM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION = void 0;
|
|
7
8
|
const IUniswapV3Pool_json_1 = __importDefault(require("@uniswap/v3-core/artifacts/contracts/interfaces/IUniswapV3Pool.sol/IUniswapV3Pool.json"));
|
|
8
9
|
const viem_1 = require("viem");
|
|
10
|
+
const chains_1 = require("viem/chains");
|
|
9
11
|
const ApproveAndExec_json_1 = __importDefault(require("../abis/ApproveAndExec.json"));
|
|
10
12
|
const ApproveAndSwap_json_1 = __importDefault(require("../abis/ApproveAndSwap.json"));
|
|
13
|
+
const CheckoutPaymaster_json_1 = __importDefault(require("../abis/CheckoutPaymaster.json"));
|
|
11
14
|
const EntryPoint_json_1 = __importDefault(require("../abis/EntryPoint.json"));
|
|
12
15
|
const ERC20_json_1 = __importDefault(require("../abis/ERC20.json"));
|
|
13
16
|
const ERC721_json_1 = __importDefault(require("../abis/ERC721.json"));
|
|
@@ -30,72 +33,86 @@ const univ3router_json_1 = __importDefault(require("../abis/univ3router.json"));
|
|
|
30
33
|
const UserAuthentication_json_1 = __importDefault(require("../abis/UserAuthentication.json"));
|
|
31
34
|
const ContractInterface_1 = require("../viem/ContractInterface");
|
|
32
35
|
// local environment
|
|
33
|
-
exports.LOCAL_API_URL =
|
|
36
|
+
exports.LOCAL_API_URL = 'http://127.0.0.1:3000';
|
|
34
37
|
// prod
|
|
35
|
-
let API_URL =
|
|
38
|
+
let API_URL = 'https://api.fun.xyz/v1';
|
|
36
39
|
exports.API_URL = API_URL;
|
|
37
40
|
switch (process.env.NODE_ENV) {
|
|
38
|
-
case
|
|
39
|
-
exports.API_URL = API_URL =
|
|
41
|
+
case 'staging':
|
|
42
|
+
exports.API_URL = API_URL = 'https://api.fun.xyz/staging/v1';
|
|
40
43
|
break;
|
|
41
|
-
case
|
|
42
|
-
exports.API_URL = API_URL =
|
|
44
|
+
case 'testing':
|
|
45
|
+
exports.API_URL = API_URL = 'https://api.fun.xyz/testing/v1';
|
|
43
46
|
break;
|
|
44
|
-
case
|
|
47
|
+
case 'local':
|
|
45
48
|
exports.API_URL = API_URL = exports.LOCAL_API_URL;
|
|
46
49
|
break;
|
|
47
50
|
}
|
|
48
|
-
exports.DASHBOARD_API_URL =
|
|
51
|
+
exports.DASHBOARD_API_URL = 'https://api.fun.xyz/dashboard';
|
|
49
52
|
exports.BASE_WRAP_TOKEN_ADDR = {
|
|
50
|
-
|
|
51
|
-
weth:
|
|
53
|
+
'1': {
|
|
54
|
+
weth: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
52
55
|
},
|
|
53
|
-
|
|
54
|
-
weth:
|
|
56
|
+
'5': {
|
|
57
|
+
weth: '0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6',
|
|
55
58
|
},
|
|
56
|
-
|
|
57
|
-
weth:
|
|
59
|
+
'10': {
|
|
60
|
+
weth: '0x4200000000000000000000000000000000000006',
|
|
58
61
|
},
|
|
59
|
-
|
|
60
|
-
wmatic:
|
|
62
|
+
'137': {
|
|
63
|
+
wmatic: '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270',
|
|
61
64
|
},
|
|
62
|
-
|
|
63
|
-
weth:
|
|
65
|
+
'8453': {
|
|
66
|
+
weth: '0x4200000000000000000000000000000000000006',
|
|
64
67
|
},
|
|
65
|
-
|
|
66
|
-
weth:
|
|
68
|
+
'36865': {
|
|
69
|
+
weth: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
67
70
|
},
|
|
68
|
-
|
|
69
|
-
weth:
|
|
71
|
+
'42161': {
|
|
72
|
+
weth: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
|
|
73
|
+
},
|
|
74
|
+
'43113': {
|
|
75
|
+
weth: '0x1D308089a2D1Ced3f1Ce36B1FcaF815b07217be3',
|
|
70
76
|
},
|
|
71
|
-
"43113": {
|
|
72
|
-
weth: "0x1D308089a2D1Ced3f1Ce36B1FcaF815b07217be3"
|
|
73
|
-
}
|
|
74
77
|
};
|
|
75
78
|
// When update this, also remember to update the address in api service
|
|
76
|
-
exports.FUN_GASLESS_SPONSOR_ADDRESS =
|
|
77
|
-
exports.FUN_TOKEN_SPONSOR_ADDRESS =
|
|
78
|
-
exports.TOKEN_SPONSOR_SUPPORT_CHAINS = [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
exports.FUN_GASLESS_SPONSOR_ADDRESS = '0xCB5D0b4569A39C217c243a436AC3feEe5dFeb9Ad';
|
|
80
|
+
exports.FUN_TOKEN_SPONSOR_ADDRESS = '0x40C0cCa76088D45106c2D74D0B4B6405865f22De';
|
|
81
|
+
exports.TOKEN_SPONSOR_SUPPORT_CHAINS = [
|
|
82
|
+
'1',
|
|
83
|
+
'5',
|
|
84
|
+
'10',
|
|
85
|
+
'137',
|
|
86
|
+
'8453',
|
|
87
|
+
'42161',
|
|
88
|
+
];
|
|
89
|
+
exports.GASLESS_SPONSOR_SUPPORT_CHAINS = ['5'];
|
|
90
|
+
const CHECKOUT_PAYMASTER_ADDRESS_BY_CHAIN = {
|
|
91
|
+
'137': '0x4e019e54e0A044DDC2c3c52ef3172DD3C667f78b',
|
|
92
|
+
'8453': '0x37Da22a93b51252f1965A72d106A7DF9dA4c95e5',
|
|
93
|
+
'42161': '0x4262a21d38a4397b149152d74A57b86bb86922cc',
|
|
94
|
+
};
|
|
95
|
+
exports.CHECKOUT_SPONSOR_SUPPORT_CHAINS = Object.keys(CHECKOUT_PAYMASTER_ADDRESS_BY_CHAIN);
|
|
96
|
+
exports.AddressZero = (0, viem_1.padHex)('0x', { size: 20 });
|
|
97
|
+
exports.HashZero = (0, viem_1.padHex)('0x', { size: 32 });
|
|
82
98
|
// abis
|
|
83
|
-
exports.APPROVE_AND_EXEC_ABI = ApproveAndExec_json_1.default[
|
|
84
|
-
exports.APPROVE_AND_SWAP_ABI = ApproveAndSwap_json_1.default[
|
|
85
|
-
exports.ENTRYPOINT_ABI = EntryPoint_json_1.default[
|
|
86
|
-
exports.ERC20_ABI = ERC20_json_1.default[
|
|
87
|
-
exports.WALLET_ABI = FunWallet_json_1.default[
|
|
88
|
-
exports.FACTORY_ABI = FunWalletFactory_json_1.default[
|
|
89
|
-
exports.GASLESS_PAYMASTER_ABI = GaslessPaymaster_json_1.default[
|
|
90
|
-
exports.TOKEN_PAYMASTER_ABI = TokenPaymaster_json_1.default[
|
|
91
|
-
exports.
|
|
92
|
-
exports.
|
|
93
|
-
exports.
|
|
94
|
-
exports.
|
|
95
|
-
exports.
|
|
96
|
-
exports.
|
|
97
|
-
exports.
|
|
98
|
-
exports.
|
|
99
|
+
exports.APPROVE_AND_EXEC_ABI = ApproveAndExec_json_1.default['abi'];
|
|
100
|
+
exports.APPROVE_AND_SWAP_ABI = ApproveAndSwap_json_1.default['abi'];
|
|
101
|
+
exports.ENTRYPOINT_ABI = EntryPoint_json_1.default['abi'];
|
|
102
|
+
exports.ERC20_ABI = ERC20_json_1.default['abi'];
|
|
103
|
+
exports.WALLET_ABI = FunWallet_json_1.default['abi'];
|
|
104
|
+
exports.FACTORY_ABI = FunWalletFactory_json_1.default['abi'];
|
|
105
|
+
exports.GASLESS_PAYMASTER_ABI = GaslessPaymaster_json_1.default['abi'];
|
|
106
|
+
exports.TOKEN_PAYMASTER_ABI = TokenPaymaster_json_1.default['abi'];
|
|
107
|
+
exports.CHECKOUT_PAYMASTER_ABI = CheckoutPaymaster_json_1.default['abi'];
|
|
108
|
+
exports.WITHDRAW_QUEUE_ABI = LidoWithdrawQueue_json_1.default['abi'];
|
|
109
|
+
exports.ERC_721_ABI = ERC721_json_1.default['abi'];
|
|
110
|
+
exports.UNISWAP_V3_LIMIT_ORDER_ABI = UniswapV3LimitOrder_json_1.default['abi'];
|
|
111
|
+
exports.UNISWAPV2FACTORY_ABI = UniswapV2Factory_json_1.default['abi'];
|
|
112
|
+
exports.UNISWAPV2ROUTER02_ABI = UniswapV2Router02_json_1.default['abi'];
|
|
113
|
+
exports.ROLE_BASED_ACCESS_CONTROL_ABI = RoleBasedAccessControl_json_1.default['abi'];
|
|
114
|
+
exports.USER_AUTHENTICATION_ABI = UserAuthentication_json_1.default['abi'];
|
|
115
|
+
exports.ESTIMATION_PAYMASTER_ABI = EstimationPaymaster_json_1.default['abi'];
|
|
99
116
|
// contract interface
|
|
100
117
|
exports.ENTRYPOINT_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.ENTRYPOINT_ABI);
|
|
101
118
|
exports.ERC721_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.ERC_721_ABI);
|
|
@@ -103,8 +120,9 @@ exports.ERC20_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exp
|
|
|
103
120
|
exports.FACTORY_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.FACTORY_ABI);
|
|
104
121
|
exports.GASLESS_PAYMASTER_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.GASLESS_PAYMASTER_ABI);
|
|
105
122
|
exports.TOKEN_PAYMASTER_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.TOKEN_PAYMASTER_ABI);
|
|
123
|
+
exports.CHECKOUT_PAYMASTER_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.CHECKOUT_PAYMASTER_ABI);
|
|
106
124
|
exports.WALLET_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.WALLET_ABI);
|
|
107
|
-
exports.POOL_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(IUniswapV3Pool_json_1.default[
|
|
125
|
+
exports.POOL_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(IUniswapV3Pool_json_1.default['abi']);
|
|
108
126
|
exports.APPROVE_AND_EXEC_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.APPROVE_AND_EXEC_ABI);
|
|
109
127
|
exports.UNISWAPV2FACTORY_INTERFACE = new ContractInterface_1.ContractInterface(exports.UNISWAPV2FACTORY_ABI);
|
|
110
128
|
exports.UNISWAPV2ROUTER02_INTERFACE = new ContractInterface_1.ContractInterface(exports.UNISWAPV2ROUTER02_ABI);
|
|
@@ -112,47 +130,102 @@ exports.RBAC_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(expo
|
|
|
112
130
|
exports.USER_AUTHENTICATION_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.USER_AUTHENTICATION_ABI);
|
|
113
131
|
exports.UNISWAP_V3_LIMIT_ORDER_CONTRACT_INTERFACE = new ContractInterface_1.ContractInterface(exports.UNISWAP_V3_LIMIT_ORDER_ABI);
|
|
114
132
|
exports.CONTRACT_ADDRESSES = {
|
|
115
|
-
approveAndExecAddress: ApproveAndExec_json_1.default[
|
|
116
|
-
tokenSwapAddress: ApproveAndSwap_json_1.default[
|
|
117
|
-
entryPointAddress: EntryPoint_json_1.default[
|
|
118
|
-
factoryAddress: FunWalletFactory_json_1.default[
|
|
119
|
-
gaslessPaymasterAddress: GaslessPaymaster_json_1.default[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
approveAndExecAddress: ApproveAndExec_json_1.default['addresses'],
|
|
134
|
+
tokenSwapAddress: ApproveAndSwap_json_1.default['addresses'],
|
|
135
|
+
entryPointAddress: EntryPoint_json_1.default['addresses'],
|
|
136
|
+
factoryAddress: FunWalletFactory_json_1.default['addresses'],
|
|
137
|
+
gaslessPaymasterAddress: GaslessPaymaster_json_1.default['addresses'],
|
|
138
|
+
checkoutPaymasterAddress: CHECKOUT_PAYMASTER_ADDRESS_BY_CHAIN,
|
|
139
|
+
estimationPaymasterAddress: EstimationPaymaster_json_1.default['addresses'],
|
|
140
|
+
tokenPaymasterAddress: TokenPaymaster_json_1.default['addresses'],
|
|
141
|
+
oracle: TokenPriceOracle_json_1.default['addresses'],
|
|
142
|
+
userAuthAddress: UserAuthentication_json_1.default['addresses'],
|
|
143
|
+
rbacAddress: RoleBasedAccessControl_json_1.default['addresses'],
|
|
144
|
+
feeOracle: FeePercentOracle_json_1.default['addresses'],
|
|
145
|
+
uniswapv3LimitOrder: UniswapV3LimitOrder_json_1.default['addresses'],
|
|
146
|
+
univ3factory: univ3factory_json_1.default['addresses'],
|
|
147
|
+
univ3quoter: univ3quoter_json_1.default['addresses'],
|
|
148
|
+
univ3router: univ3router_json_1.default['addresses'],
|
|
149
|
+
UniswapV2Factory: UniswapV2Factory_json_1.default['addresses'],
|
|
150
|
+
UniswapV2Router02: UniswapV2Router02_json_1.default['addresses'],
|
|
151
|
+
TestNFT: TestNFT_json_1.default['addresses'],
|
|
152
|
+
funGaslessSponsorAddress: { '5': exports.FUN_GASLESS_SPONSOR_ADDRESS },
|
|
134
153
|
funTokenSponsorAddress: {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
154
|
+
'1': exports.FUN_TOKEN_SPONSOR_ADDRESS,
|
|
155
|
+
'5': exports.FUN_TOKEN_SPONSOR_ADDRESS,
|
|
156
|
+
'10': exports.FUN_TOKEN_SPONSOR_ADDRESS,
|
|
157
|
+
'137': exports.FUN_TOKEN_SPONSOR_ADDRESS,
|
|
158
|
+
'8453': exports.FUN_TOKEN_SPONSOR_ADDRESS,
|
|
159
|
+
'42161': exports.FUN_TOKEN_SPONSOR_ADDRESS,
|
|
160
|
+
},
|
|
142
161
|
};
|
|
143
162
|
exports.gasSpecificChain = {
|
|
144
|
-
|
|
145
|
-
gasStationUrl:
|
|
146
|
-
backupPriorityFee:
|
|
147
|
-
backupFee:
|
|
148
|
-
}
|
|
163
|
+
'137': {
|
|
164
|
+
gasStationUrl: 'https://gasstation.polygon.technology/v2',
|
|
165
|
+
backupPriorityFee: '1000', // 1000 gwei
|
|
166
|
+
backupFee: '200', // 200 gwei
|
|
167
|
+
},
|
|
149
168
|
};
|
|
150
|
-
exports.FUN_FAUCET_URL =
|
|
151
|
-
exports.ETH_TRANSFER_SELECTOR =
|
|
169
|
+
exports.FUN_FAUCET_URL = 'https://api.fun.xyz/demo-faucet';
|
|
170
|
+
exports.ETH_TRANSFER_SELECTOR = '0x00000000';
|
|
152
171
|
exports.VALID_PRIVATE_KEY_LENGTH = 64;
|
|
153
172
|
exports.BYTES32_LENGTH = 66;
|
|
154
173
|
// Use the paymasterAndData from pimlico for gas estimation
|
|
155
|
-
exports.BASE_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION =
|
|
156
|
-
exports.OPTIMISM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION =
|
|
157
|
-
exports.ETHEREUM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION =
|
|
174
|
+
exports.BASE_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION = '0xa880eae8900eb59bf7dad9bdb741a086238adca900000000000000000000000000000000000000000000000000000101010101010000000000000000000000000000000000000000000000000000000000000000cd91f19f0f19ce862d7bec7b7d9b95457145afc6f639c28fd0360f488937bfa41e6eedcd3a46054fd95fcd0e3ef6b0bc0a615c4d975eef55c8a3517257904d5b1c';
|
|
175
|
+
exports.OPTIMISM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION = '0x4Df91e173A6CdC74EfeF6fC72bb5Df1E8A8d758200000000000000000000000000000000000000000000000000000101010101010000000000000000000000000000000000000000000000000000000000000000cd91f19f0f19ce862d7bec7b7d9b95457145afc6f639c28fd0360f488937bfa41e6eedcd3a46054fd95fcd0e3ef6b0bc0a615c4d975eef55c8a3517257904d5b1c';
|
|
176
|
+
exports.ETHEREUM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION = '0x67F21bE69A16c314a0b7Da537309b2f3ADdDE03100000000000000000000000000000000000000000000000000000101010101010000000000000000000000000000000000000000000000000000000000000000cd91f19f0f19ce862d7bec7b7d9b95457145afc6f639c28fd0360f488937bfa41e6eedcd3a46054fd95fcd0e3ef6b0bc0a615c4d975eef55c8a3517257904d5b1c';
|
|
177
|
+
/**
|
|
178
|
+
* Info on the supported chains of FunkitConnect
|
|
179
|
+
* Added into coresdk because it is used in here too.
|
|
180
|
+
*/
|
|
181
|
+
exports.FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO = {
|
|
182
|
+
/** MAINNETS **/
|
|
183
|
+
[chains_1.mainnet.id.toString()]: {
|
|
184
|
+
nativeCurrency: {
|
|
185
|
+
symbol: chains_1.mainnet.nativeCurrency.symbol,
|
|
186
|
+
decimals: chains_1.mainnet.nativeCurrency.decimals,
|
|
187
|
+
name: chains_1.mainnet.nativeCurrency.name,
|
|
188
|
+
},
|
|
189
|
+
// Add other static here if necessary
|
|
190
|
+
},
|
|
191
|
+
[chains_1.base.id.toString()]: {
|
|
192
|
+
nativeCurrency: {
|
|
193
|
+
symbol: chains_1.base.nativeCurrency.symbol,
|
|
194
|
+
decimals: chains_1.base.nativeCurrency.decimals,
|
|
195
|
+
name: chains_1.base.nativeCurrency.name,
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
[chains_1.polygon.id.toString()]: {
|
|
199
|
+
nativeCurrency: {
|
|
200
|
+
symbol: chains_1.polygon.nativeCurrency.symbol,
|
|
201
|
+
decimals: chains_1.polygon.nativeCurrency.decimals,
|
|
202
|
+
name: chains_1.polygon.nativeCurrency.name,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
[chains_1.arbitrum.id.toString()]: {
|
|
206
|
+
nativeCurrency: {
|
|
207
|
+
symbol: chains_1.arbitrum.nativeCurrency.symbol,
|
|
208
|
+
decimals: chains_1.arbitrum.nativeCurrency.decimals,
|
|
209
|
+
name: chains_1.arbitrum.nativeCurrency.name,
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
/** TESTNETS **/
|
|
213
|
+
[chains_1.goerli.id.toString()]: {
|
|
214
|
+
nativeCurrency: {
|
|
215
|
+
symbol: chains_1.goerli.nativeCurrency.symbol,
|
|
216
|
+
decimals: chains_1.goerli.nativeCurrency.decimals,
|
|
217
|
+
name: chains_1.goerli.nativeCurrency.name,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
[chains_1.baseGoerli.id.toString()]: {
|
|
221
|
+
nativeCurrency: {
|
|
222
|
+
symbol: chains_1.baseGoerli.nativeCurrency.symbol,
|
|
223
|
+
decimals: chains_1.baseGoerli.nativeCurrency.decimals,
|
|
224
|
+
name: chains_1.baseGoerli.nativeCurrency.name,
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
// The native currency fake address used for checkout operation in funkitconnect (socket-specific requirement)
|
|
229
|
+
// Reference: https://fun-xyz.slack.com/archives/C04Q5T1MQP3/p1701901749677069?thread_ts=1701829172.857709&cid=C04Q5T1MQP3
|
|
230
|
+
exports.FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee';
|
|
158
231
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/common/constants.ts"],"names":[],"mappings":";;;;;;;AAAA,iJAAsH;AACtH,+BAA6B;AAC7B,wCAOoB;AAEpB,sFAAmE;AACnE,sFAAmE;AACnE,4FAAwE;AACxE,8EAAyD;AACzD,oEAA+C;AAC/C,sEAAkD;AAClD,gGAA4E;AAC5E,0FAAuE;AACvE,4EAAwD;AACxD,0FAA4D;AAC5D,0FAAsE;AACtE,4FAAoE;AACpE,sGAAoF;AACpF,wEAAoD;AACpD,sFAAkE;AAClE,0FAAuE;AACvE,0FAAqE;AACrE,4FAAuE;AACvE,gGAA8E;AAC9E,kFAAqD;AACrD,gFAAmD;AACnD,gFAAmD;AACnD,8FAA0E;AAC1E,iEAA6D;AAE7D,oBAAoB;AACP,QAAA,aAAa,GAAG,uBAAuB,CAAA;AAEpD,OAAO;AACP,IAAI,OAAO,GAAG,wBAAwB,CAAA;AAc7B,0BAAO;AAZhB,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC7B,KAAK,SAAS;QACZ,kBAAA,OAAO,GAAG,gCAAgC,CAAA;QAC1C,MAAK;IACP,KAAK,SAAS;QACZ,kBAAA,OAAO,GAAG,gCAAgC,CAAA;QAC1C,MAAK;IACP,KAAK,OAAO;QACV,kBAAA,OAAO,GAAG,qBAAa,CAAA;QACvB,MAAK;AACT,CAAC;AAIY,QAAA,iBAAiB,GAAG,+BAA+B,CAAA;AACnD,QAAA,oBAAoB,GAAG;IAClC,GAAG,EAAE;QACH,IAAI,EAAE,4CAA4C;KACnD;IACD,GAAG,EAAE;QACH,IAAI,EAAE,4CAA4C;KACnD;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,4CAA4C;KACnD;IACD,KAAK,EAAE;QACL,MA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export * from
|
|
1
|
+
export * from './constants';
|
|
2
|
+
export * from './types';
|
|
@@ -14,15 +14,19 @@ async function configureEnvironment(option) {
|
|
|
14
14
|
global.globalEnvOption = {};
|
|
15
15
|
}
|
|
16
16
|
const globalEnvOption = global.globalEnvOption;
|
|
17
|
-
globalEnvOption.apiKey = option.apiKey
|
|
17
|
+
globalEnvOption.apiKey = option.apiKey
|
|
18
|
+
? option.apiKey
|
|
19
|
+
: globalEnvOption.apiKey;
|
|
18
20
|
if (!globalEnvOption.apiKey) {
|
|
19
|
-
throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter,
|
|
21
|
+
throw new errors_1.InvalidParameterError(errors_1.ErrorCode.MissingParameter, 'apiKey is required', { option }, 'Provide apiKey when configureEnvironment.', 'https://docs.fun.xyz');
|
|
20
22
|
}
|
|
21
23
|
if ((!option || !option.chain) && !globalEnvOption.chain) {
|
|
22
24
|
globalEnvOption.chain = await data_1.Chain.getChain({ chainIdentifier: 5 });
|
|
23
25
|
}
|
|
24
26
|
else {
|
|
25
|
-
globalEnvOption.chain = option.chain
|
|
27
|
+
globalEnvOption.chain = option.chain
|
|
28
|
+
? await data_1.Chain.getChain({ chainIdentifier: option.chain })
|
|
29
|
+
: globalEnvOption.chain;
|
|
26
30
|
}
|
|
27
31
|
if (option.gasSponsor !== null && option.gasSponsor !== undefined) {
|
|
28
32
|
if (Object.keys(option.gasSponsor).length !== 0) {
|
|
@@ -40,7 +44,9 @@ async function configureEnvironment(option) {
|
|
|
40
44
|
}
|
|
41
45
|
globalEnvOption.fee = option.fee ? option.fee : globalEnvOption.fee;
|
|
42
46
|
globalEnvOption.skipDBAction =
|
|
43
|
-
option.skipDBAction === null || option.skipDBAction === undefined
|
|
47
|
+
option.skipDBAction === null || option.skipDBAction === undefined
|
|
48
|
+
? globalEnvOption.skipDBAction
|
|
49
|
+
: option.skipDBAction;
|
|
44
50
|
}
|
|
45
51
|
exports.configureEnvironment = configureEnvironment;
|
|
46
52
|
//# sourceMappingURL=Config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../../src/config/Config.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../../src/config/Config.ts"],"names":[],"mappings":";;;AAAA,kCAA+B;AAC/B,sCAA4D;AAG5D,SAAgB,YAAY,CAAC,MAAiB;IAC5C,MAAM,aAAa,GAAI,UAAkB,CAAC,eAAe,CAAA;IACzD,OAAO,EAAE,GAAG,aAAa,EAAE,GAAG,MAAM,EAAE,CAAA;AACxC,CAAC;AAHD,oCAGC;AAEM,KAAK,UAAU,oBAAoB,CAAC,MAAuB;IAChE,MAAM,MAAM,GAAG,UAAiB,CAAA;IAChC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;QAC5B,MAAM,CAAC,eAAe,GAAG,EAAE,CAAA;IAC7B,CAAC;IACD,MAAM,eAAe,GAAG,MAAM,CAAC,eAAe,CAAA;IAE9C,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM;QACpC,CAAC,CAAC,MAAM,CAAC,MAAM;QACf,CAAC,CAAC,eAAe,CAAC,MAAM,CAAA;IAC1B,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,IAAI,8BAAqB,CAC7B,kBAAS,CAAC,gBAAgB,EAC1B,oBAAoB,EACpB,EAAE,MAAM,EAAE,EACV,2CAA2C,EAC3C,sBAAsB,CACvB,CAAA;IACH,CAAC;IAED,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QACzD,eAAe,CAAC,KAAK,GAAG,MAAM,YAAK,CAAC,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC,CAAA;IACtE,CAAC;SAAM,CAAC;QACN,eAAe,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;YACl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|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Address } from
|
|
2
|
-
import { Chain } from
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { Chain } from '../data';
|
|
3
3
|
export interface EnvOption {
|
|
4
4
|
chain?: string | Chain | number;
|
|
5
5
|
gasSponsor?: {
|
|
6
6
|
sponsorAddress?: Address;
|
|
7
7
|
token?: string;
|
|
8
8
|
usePermit?: boolean;
|
|
9
|
+
useCheckoutSponsor?: boolean;
|
|
9
10
|
};
|
|
10
11
|
fee?: {
|
|
11
12
|
token?: string;
|
|
@@ -15,6 +16,7 @@ export interface EnvOption {
|
|
|
15
16
|
};
|
|
16
17
|
skipDBAction?: boolean;
|
|
17
18
|
nonce?: bigint;
|
|
19
|
+
bypassInit?: boolean;
|
|
18
20
|
}
|
|
19
21
|
export interface GlobalEnvOption extends EnvOption {
|
|
20
22
|
apiKey?: string;
|
package/dist/src/data/Chain.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Address, Hex, PublicClient } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Address, Hex, PublicClient } from 'viem';
|
|
2
|
+
import { UserOperationGasPrice } from '../apis';
|
|
3
|
+
import { EstimateGasResult } from '../common';
|
|
4
|
+
import { ChainInput, UserOperation } from './types';
|
|
5
5
|
export declare class Chain {
|
|
6
6
|
private initialized;
|
|
7
7
|
private id?;
|
package/dist/src/data/Chain.js
CHANGED
|
@@ -11,7 +11,7 @@ class Chain {
|
|
|
11
11
|
this.initialized = false;
|
|
12
12
|
this.addresses = {};
|
|
13
13
|
if (!chainInput.chainIdentifier && !chainInput.rpcUrl) {
|
|
14
|
-
throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidChainIdentifier,
|
|
14
|
+
throw new errors_1.InvalidParameterError(errors_1.ErrorCode.InvalidChainIdentifier, 'valid chain identifier or rpcUrl is required, could be chainId, chainName, Fun Chain object, or rpcUrl', { chainInput }, 'Please provide valid chain identifier or rpcUrl', 'https://docs.fun.xyz');
|
|
15
15
|
}
|
|
16
16
|
if (chainInput.rpcUrl) {
|
|
17
17
|
this.rpcUrl = chainInput.rpcUrl;
|
|
@@ -19,7 +19,8 @@ class Chain {
|
|
|
19
19
|
else if (chainInput.chainIdentifier instanceof Chain) {
|
|
20
20
|
return chainInput.chainIdentifier;
|
|
21
21
|
}
|
|
22
|
-
else if (typeof chainInput.chainIdentifier ===
|
|
22
|
+
else if (typeof chainInput.chainIdentifier === 'number' ||
|
|
23
|
+
Number(chainInput.chainIdentifier)) {
|
|
23
24
|
this.id = chainInput.chainIdentifier.toString();
|
|
24
25
|
}
|
|
25
26
|
else {
|
|
@@ -31,17 +32,19 @@ class Chain {
|
|
|
31
32
|
return chainInput.chainIdentifier;
|
|
32
33
|
}
|
|
33
34
|
else if (!Chain.chain ||
|
|
34
|
-
((await Chain.chain.getChainId()) !==
|
|
35
|
-
|
|
35
|
+
((await Chain.chain.getChainId()) !==
|
|
36
|
+
chainInput.chainIdentifier?.toString() &&
|
|
37
|
+
(await Chain.chain.getChainName()) !==
|
|
38
|
+
chainInput.chainIdentifier?.toString() &&
|
|
36
39
|
(await Chain.chain.getRpcUrl()) !== chainInput.rpcUrl)) {
|
|
37
|
-
if (typeof chainInput.chainIdentifier ===
|
|
38
|
-
chainInput.chainIdentifier = chainInput.chainIdentifier.replace(/\s/g,
|
|
40
|
+
if (typeof chainInput.chainIdentifier === 'string') {
|
|
41
|
+
chainInput.chainIdentifier = chainInput.chainIdentifier.replace(/\s/g, '');
|
|
39
42
|
}
|
|
40
|
-
if (chainInput.chainIdentifier ===
|
|
41
|
-
chainInput.chainIdentifier =
|
|
43
|
+
if (chainInput.chainIdentifier === 'ethereum-goerli') {
|
|
44
|
+
chainInput.chainIdentifier = 'goerli';
|
|
42
45
|
}
|
|
43
|
-
if (chainInput.chainIdentifier ===
|
|
44
|
-
chainInput.chainIdentifier =
|
|
46
|
+
if (chainInput.chainIdentifier === 'polygon') {
|
|
47
|
+
chainInput.chainIdentifier = 'polygon-mainnet';
|
|
45
48
|
}
|
|
46
49
|
Chain.chain = new Chain(chainInput);
|
|
47
50
|
}
|
|
@@ -63,7 +66,7 @@ class Chain {
|
|
|
63
66
|
}
|
|
64
67
|
async loadChainFromRpc() {
|
|
65
68
|
this.client = (0, viem_1.createPublicClient)({
|
|
66
|
-
transport: (0, viem_1.http)(this.rpcUrl)
|
|
69
|
+
transport: (0, viem_1.http)(this.rpcUrl),
|
|
67
70
|
});
|
|
68
71
|
this.id = (await this.client.getChainId()).toString();
|
|
69
72
|
await this.loadChain(this.id);
|
|
@@ -86,7 +89,7 @@ class Chain {
|
|
|
86
89
|
const addresses = { ...abisAddresses };
|
|
87
90
|
this.rpcUrl = chain.rpcUrls.default;
|
|
88
91
|
this.client = (0, viem_1.createPublicClient)({
|
|
89
|
-
transport: (0, viem_1.http)(this.rpcUrl)
|
|
92
|
+
transport: (0, viem_1.http)(this.rpcUrl),
|
|
90
93
|
});
|
|
91
94
|
Object.assign(this, { ...this, addresses });
|
|
92
95
|
}
|
|
@@ -106,7 +109,7 @@ class Chain {
|
|
|
106
109
|
await this.init();
|
|
107
110
|
const res = this.addresses[name];
|
|
108
111
|
if (!res) {
|
|
109
|
-
throw new errors_1.ResourceNotFoundError(errors_1.ErrorCode.AddressNotFound,
|
|
112
|
+
throw new errors_1.ResourceNotFoundError(errors_1.ErrorCode.AddressNotFound, 'address not found', { name }, 'Provide correct name to query address', 'https://docs.fun.xyz');
|
|
110
113
|
}
|
|
111
114
|
return res;
|
|
112
115
|
}
|
|
@@ -132,7 +135,7 @@ class Chain {
|
|
|
132
135
|
const fallBackGasPrice = await this.client.getGasPrice();
|
|
133
136
|
result = {
|
|
134
137
|
maxFeePerGas: fallBackGasPrice,
|
|
135
|
-
maxPriorityFeePerGas: fallBackGasPrice
|
|
138
|
+
maxPriorityFeePerGas: fallBackGasPrice,
|
|
136
139
|
};
|
|
137
140
|
}
|
|
138
141
|
return result;
|
|
@@ -140,26 +143,33 @@ class Chain {
|
|
|
140
143
|
async estimateOpGas(partialOp) {
|
|
141
144
|
await this.init();
|
|
142
145
|
if (!this.addresses || !this.addresses.entryPointAddress) {
|
|
143
|
-
throw new errors_1.InternalFailureError(errors_1.ErrorCode.AddressNotFound,
|
|
146
|
+
throw new errors_1.InternalFailureError(errors_1.ErrorCode.AddressNotFound, 'entryPointAddress is required', { partialOp }, 'This is an internal error, please contact support.', 'https://docs.fun.xyz');
|
|
144
147
|
}
|
|
145
148
|
// clone partialOp and replace paymasterAndData with a workaround for pimlico since they overestimate gas limits for simulation
|
|
146
149
|
const estimationUserOp = Object.assign({}, partialOp);
|
|
147
|
-
if (this.id ===
|
|
148
|
-
estimationUserOp.paymasterAndData =
|
|
150
|
+
if (this.id === '8453') {
|
|
151
|
+
estimationUserOp.paymasterAndData =
|
|
152
|
+
common_1.BASE_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION;
|
|
149
153
|
}
|
|
150
|
-
else if (this.id ===
|
|
151
|
-
estimationUserOp.paymasterAndData =
|
|
154
|
+
else if (this.id === '10') {
|
|
155
|
+
estimationUserOp.paymasterAndData =
|
|
156
|
+
common_1.OPTIMISM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION;
|
|
152
157
|
}
|
|
153
|
-
else if (this.id ===
|
|
154
|
-
estimationUserOp.paymasterAndData =
|
|
158
|
+
else if (this.id === '1' || this.id === '36865') {
|
|
159
|
+
estimationUserOp.paymasterAndData =
|
|
160
|
+
common_1.ETHEREUM_PIMLICO_PAYMASTER_AND_DATA_ESTIMATION;
|
|
155
161
|
}
|
|
156
162
|
let { preVerificationGas, callGasLimit, verificationGasLimit } = await (0, apis_1.estimateOp)({
|
|
157
163
|
chainId: this.id,
|
|
158
164
|
entryPointAddress: this.addresses.entryPointAddress,
|
|
159
|
-
userOp: estimationUserOp
|
|
165
|
+
userOp: estimationUserOp,
|
|
160
166
|
});
|
|
161
167
|
if (!preVerificationGas || !verificationGasLimit || !callGasLimit) {
|
|
162
|
-
throw new Error(JSON.stringify({
|
|
168
|
+
throw new Error(JSON.stringify({
|
|
169
|
+
preVerificationGas,
|
|
170
|
+
callGasLimit,
|
|
171
|
+
verificationGasLimit,
|
|
172
|
+
}));
|
|
163
173
|
}
|
|
164
174
|
callGasLimit = BigInt(callGasLimit) * 2n;
|
|
165
175
|
preVerificationGas = BigInt(preVerificationGas);
|
|
@@ -169,16 +179,17 @@ class Chain {
|
|
|
169
179
|
async getTxId(userOpHash, timeout = 60000, interval = 5000, fromBlock) {
|
|
170
180
|
const endtime = Date.now() + timeout;
|
|
171
181
|
const client = await this.getClient();
|
|
172
|
-
const entryPointAddress = await this.getAddress(
|
|
182
|
+
const entryPointAddress = await this.getAddress('entryPointAddress');
|
|
173
183
|
fromBlock = fromBlock ? fromBlock : (await client.getBlockNumber()) - 100n;
|
|
174
184
|
let filter;
|
|
175
185
|
while (Date.now() < endtime) {
|
|
176
186
|
let events;
|
|
177
|
-
if ((await client.getChainId()) === 84531 ||
|
|
178
|
-
|
|
187
|
+
if ((await client.getChainId()) === 84531 ||
|
|
188
|
+
(await client.getChainId()) === 36865) {
|
|
189
|
+
events = await common_1.ENTRYPOINT_CONTRACT_INTERFACE.getLog(entryPointAddress, 'UserOperationEvent', { userOpHash }, client, fromBlock);
|
|
179
190
|
}
|
|
180
191
|
else {
|
|
181
|
-
filter = await common_1.ENTRYPOINT_CONTRACT_INTERFACE.createFilter(entryPointAddress,
|
|
192
|
+
filter = await common_1.ENTRYPOINT_CONTRACT_INTERFACE.createFilter(entryPointAddress, 'UserOperationEvent', [userOpHash], client, fromBlock);
|
|
182
193
|
events = await client.getFilterLogs({ filter });
|
|
183
194
|
}
|
|
184
195
|
if (events.length > 0) {
|