@funkit/core 0.8.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/README.md +110 -0
- package/dist/fetch-polyfill.d.ts +1 -0
- package/dist/fetch-polyfill.js +35 -0
- package/dist/fetch-polyfill.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/src/abis/ApproveAndExec.json +1 -0
- package/dist/src/abis/ApproveAndSwap.json +1 -0
- package/dist/src/abis/ERC20.json +1 -0
- package/dist/src/abis/ERC721.json +1 -0
- package/dist/src/abis/EntryPoint.json +1 -0
- package/dist/src/abis/EstimationPaymaster.json +1 -0
- package/dist/src/abis/FeePercentOracle.json +1 -0
- package/dist/src/abis/FunWallet.json +1 -0
- package/dist/src/abis/FunWalletFactory.json +1 -0
- package/dist/src/abis/GaslessPaymaster.json +1 -0
- package/dist/src/abis/LidoWithdrawQueue.json +1 -0
- package/dist/src/abis/RoleBasedAccessControl.json +1 -0
- package/dist/src/abis/TestNFT.json +1 -0
- package/dist/src/abis/TokenPaymaster.json +1 -0
- package/dist/src/abis/TokenPriceOracle.json +1 -0
- package/dist/src/abis/UniswapV2Factory.json +1 -0
- package/dist/src/abis/UniswapV2Router02.json +1 -0
- package/dist/src/abis/UniswapV3LimitOrder.json +1 -0
- package/dist/src/abis/UserAuthentication.json +1 -0
- package/dist/src/abis/univ3factory.json +1 -0
- package/dist/src/abis/univ3quoter.json +1 -0
- package/dist/src/abis/univ3router.json +1 -0
- package/dist/src/actions/AccessControl.d.ts +9 -0
- package/dist/src/actions/AccessControl.js +88 -0
- package/dist/src/actions/AccessControl.js.map +1 -0
- package/dist/src/actions/BatchActions.d.ts +3 -0
- package/dist/src/actions/BatchActions.js +12 -0
- package/dist/src/actions/BatchActions.js.map +1 -0
- package/dist/src/actions/FirstClassActions.d.ts +161 -0
- package/dist/src/actions/FirstClassActions.js +347 -0
- package/dist/src/actions/FirstClassActions.js.map +1 -0
- package/dist/src/actions/Group.d.ts +6 -0
- package/dist/src/actions/Group.js +44 -0
- package/dist/src/actions/Group.js.map +1 -0
- package/dist/src/actions/LimitOrder.d.ts +4 -0
- package/dist/src/actions/LimitOrder.js +45 -0
- package/dist/src/actions/LimitOrder.js.map +1 -0
- package/dist/src/actions/Stake.d.ts +8 -0
- package/dist/src/actions/Stake.js +124 -0
- package/dist/src/actions/Stake.js.map +1 -0
- package/dist/src/actions/Swap.d.ts +9 -0
- package/dist/src/actions/Swap.js +169 -0
- package/dist/src/actions/Swap.js.map +1 -0
- package/dist/src/actions/Token.d.ts +12 -0
- package/dist/src/actions/Token.js +102 -0
- package/dist/src/actions/Token.js.map +1 -0
- package/dist/src/actions/index.d.ts +7 -0
- package/dist/src/actions/index.js +24 -0
- package/dist/src/actions/index.js.map +1 -0
- package/dist/src/actions/types.d.ts +117 -0
- package/dist/src/actions/types.js +11 -0
- package/dist/src/actions/types.js.map +1 -0
- package/dist/src/apis/AccessControlApis.d.ts +5 -0
- package/dist/src/apis/AccessControlApis.js +22 -0
- package/dist/src/apis/AccessControlApis.js.map +1 -0
- package/dist/src/apis/AssetApis.d.ts +79 -0
- package/dist/src/apis/AssetApis.js +100 -0
- package/dist/src/apis/AssetApis.js.map +1 -0
- package/dist/src/apis/ContractApis.d.ts +1 -0
- package/dist/src/apis/ContractApis.js +11 -0
- package/dist/src/apis/ContractApis.js.map +1 -0
- package/dist/src/apis/GroupApis.d.ts +8 -0
- package/dist/src/apis/GroupApis.js +45 -0
- package/dist/src/apis/GroupApis.js.map +1 -0
- package/dist/src/apis/InfoApis.d.ts +6 -0
- package/dist/src/apis/InfoApis.js +59 -0
- package/dist/src/apis/InfoApis.js.map +1 -0
- package/dist/src/apis/ListenerApis.d.ts +3 -0
- package/dist/src/apis/ListenerApis.js +36 -0
- package/dist/src/apis/ListenerApis.js.map +1 -0
- package/dist/src/apis/NFTApis.d.ts +22 -0
- package/dist/src/apis/NFTApis.js +34 -0
- package/dist/src/apis/NFTApis.js.map +1 -0
- package/dist/src/apis/OnOffRampApis.d.ts +2 -0
- package/dist/src/apis/OnOffRampApis.js +23 -0
- package/dist/src/apis/OnOffRampApis.js.map +1 -0
- package/dist/src/apis/OnOffRampUtils.d.ts +2 -0
- package/dist/src/apis/OnOffRampUtils.js +23 -0
- package/dist/src/apis/OnOffRampUtils.js.map +1 -0
- package/dist/src/apis/OperationApis.d.ts +14 -0
- package/dist/src/apis/OperationApis.js +77 -0
- package/dist/src/apis/OperationApis.js.map +1 -0
- package/dist/src/apis/PaymasterApis.d.ts +15 -0
- package/dist/src/apis/PaymasterApis.js +89 -0
- package/dist/src/apis/PaymasterApis.js.map +1 -0
- package/dist/src/apis/UserApis.d.ts +12 -0
- package/dist/src/apis/UserApis.js +77 -0
- package/dist/src/apis/UserApis.js.map +1 -0
- package/dist/src/apis/index.d.ts +10 -0
- package/dist/src/apis/index.js +27 -0
- package/dist/src/apis/index.js.map +1 -0
- package/dist/src/apis/types.d.ts +49 -0
- package/dist/src/apis/types.js +3 -0
- package/dist/src/apis/types.js.map +1 -0
- package/dist/src/auth/Auth.d.ts +81 -0
- package/dist/src/auth/Auth.js +317 -0
- package/dist/src/auth/Auth.js.map +1 -0
- package/dist/src/auth/SessionKeyAuth.d.ts +19 -0
- package/dist/src/auth/SessionKeyAuth.js +118 -0
- package/dist/src/auth/SessionKeyAuth.js.map +1 -0
- package/dist/src/auth/index.d.ts +2 -0
- package/dist/src/auth/index.js +19 -0
- package/dist/src/auth/index.js.map +1 -0
- package/dist/src/auth/types.d.ts +20 -0
- package/dist/src/auth/types.js +3 -0
- package/dist/src/auth/types.js.map +1 -0
- package/dist/src/common/constants.d.ts +1072 -0
- package/dist/src/common/constants.js +153 -0
- package/dist/src/common/constants.js.map +1 -0
- package/dist/src/common/index.d.ts +2 -0
- package/dist/src/common/index.js +19 -0
- package/dist/src/common/index.js.map +1 -0
- package/dist/src/common/types.d.ts +32 -0
- package/dist/src/common/types.js +3 -0
- package/dist/src/common/types.js.map +1 -0
- package/dist/src/config/Config.d.ts +3 -0
- package/dist/src/config/Config.js +46 -0
- package/dist/src/config/Config.js.map +1 -0
- package/dist/src/config/index.d.ts +2 -0
- package/dist/src/config/index.js +19 -0
- package/dist/src/config/index.js.map +1 -0
- package/dist/src/config/types.d.ts +21 -0
- package/dist/src/config/types.js +3 -0
- package/dist/src/config/types.js.map +1 -0
- package/dist/src/data/Chain.d.ts +29 -0
- package/dist/src/data/Chain.js +174 -0
- package/dist/src/data/Chain.js.map +1 -0
- package/dist/src/data/NFT.d.ts +24 -0
- package/dist/src/data/NFT.js +104 -0
- package/dist/src/data/NFT.js.map +1 -0
- package/dist/src/data/Operation.d.ts +33 -0
- package/dist/src/data/Operation.js +68 -0
- package/dist/src/data/Operation.js.map +1 -0
- package/dist/src/data/SolidityData.d.ts +8 -0
- package/dist/src/data/SolidityData.js +72 -0
- package/dist/src/data/SolidityData.js.map +1 -0
- package/dist/src/data/Token.d.ts +26 -0
- package/dist/src/data/Token.js +122 -0
- package/dist/src/data/Token.js.map +1 -0
- package/dist/src/data/index.d.ts +6 -0
- package/dist/src/data/index.js +23 -0
- package/dist/src/data/index.js.map +1 -0
- package/dist/src/data/types.d.ts +112 -0
- package/dist/src/data/types.js +25 -0
- package/dist/src/data/types.js.map +1 -0
- package/dist/src/errors/BaseError.d.ts +9 -0
- package/dist/src/errors/BaseError.js +23 -0
- package/dist/src/errors/BaseError.js.map +1 -0
- package/dist/src/errors/ClientError.d.ts +22 -0
- package/dist/src/errors/ClientError.js +75 -0
- package/dist/src/errors/ClientError.js.map +1 -0
- package/dist/src/errors/ServerError.d.ts +7 -0
- package/dist/src/errors/ServerError.js +18 -0
- package/dist/src/errors/ServerError.js.map +1 -0
- package/dist/src/errors/index.d.ts +4 -0
- package/dist/src/errors/index.js +21 -0
- package/dist/src/errors/index.js.map +1 -0
- package/dist/src/errors/types.d.ts +54 -0
- package/dist/src/errors/types.js +45 -0
- package/dist/src/errors/types.js.map +1 -0
- package/dist/src/sponsors/GaslessSponsor.d.ts +19 -0
- package/dist/src/sponsors/GaslessSponsor.js +91 -0
- package/dist/src/sponsors/GaslessSponsor.js.map +1 -0
- package/dist/src/sponsors/Sponsor.d.ts +31 -0
- package/dist/src/sponsors/Sponsor.js +94 -0
- package/dist/src/sponsors/Sponsor.js.map +1 -0
- package/dist/src/sponsors/TokenSponsor.d.ts +40 -0
- package/dist/src/sponsors/TokenSponsor.js +271 -0
- package/dist/src/sponsors/TokenSponsor.js.map +1 -0
- package/dist/src/sponsors/index.d.ts +3 -0
- package/dist/src/sponsors/index.js +20 -0
- package/dist/src/sponsors/index.js.map +1 -0
- package/dist/src/sponsors/types.d.ts +9 -0
- package/dist/src/sponsors/types.js +10 -0
- package/dist/src/sponsors/types.js.map +1 -0
- package/dist/src/utils/ApiUtils.d.ts +19 -0
- package/dist/src/utils/ApiUtils.js +97 -0
- package/dist/src/utils/ApiUtils.js.map +1 -0
- package/dist/src/utils/AuthUtils.d.ts +4 -0
- package/dist/src/utils/AuthUtils.js +54 -0
- package/dist/src/utils/AuthUtils.js.map +1 -0
- package/dist/src/utils/ChainUtils.d.ts +12 -0
- package/dist/src/utils/ChainUtils.js +89 -0
- package/dist/src/utils/ChainUtils.js.map +1 -0
- package/dist/src/utils/MerkleUtils.d.ts +18 -0
- package/dist/src/utils/MerkleUtils.js +96 -0
- package/dist/src/utils/MerkleUtils.js.map +1 -0
- package/dist/src/utils/PaymasterUtils.d.ts +3 -0
- package/dist/src/utils/PaymasterUtils.js +17 -0
- package/dist/src/utils/PaymasterUtils.js.map +1 -0
- package/dist/src/utils/SwapUtils.d.ts +35 -0
- package/dist/src/utils/SwapUtils.js +193 -0
- package/dist/src/utils/SwapUtils.js.map +1 -0
- package/dist/src/utils/TypeUtils.d.ts +1 -0
- package/dist/src/utils/TypeUtils.js +13 -0
- package/dist/src/utils/TypeUtils.js.map +1 -0
- package/dist/src/utils/UserOpUtils.d.ts +12 -0
- package/dist/src/utils/UserOpUtils.js +166 -0
- package/dist/src/utils/UserOpUtils.js.map +1 -0
- package/dist/src/utils/ViemUtils.d.ts +9 -0
- package/dist/src/utils/ViemUtils.js +30 -0
- package/dist/src/utils/ViemUtils.js.map +1 -0
- package/dist/src/utils/WalletUtils.d.ts +11 -0
- package/dist/src/utils/WalletUtils.js +61 -0
- package/dist/src/utils/WalletUtils.js.map +1 -0
- package/dist/src/utils/index.d.ts +7 -0
- package/dist/src/utils/index.js +24 -0
- package/dist/src/utils/index.js.map +1 -0
- package/dist/src/viem/ContractInterface.d.ts +19 -0
- package/dist/src/viem/ContractInterface.js +88 -0
- package/dist/src/viem/ContractInterface.js.map +1 -0
- package/dist/src/viem/Converter.d.ts +1770 -0
- package/dist/src/viem/Converter.js +50 -0
- package/dist/src/viem/Converter.js.map +1 -0
- package/dist/src/viem/index.d.ts +2 -0
- package/dist/src/viem/index.js +19 -0
- package/dist/src/viem/index.js.map +1 -0
- package/dist/src/wallet/FunWallet.d.ts +185 -0
- package/dist/src/wallet/FunWallet.js +720 -0
- package/dist/src/wallet/FunWallet.js.map +1 -0
- package/dist/src/wallet/index.d.ts +2 -0
- package/dist/src/wallet/index.js +19 -0
- package/dist/src/wallet/index.js.map +1 -0
- package/dist/src/wallet/types.d.ts +13 -0
- package/dist/src/wallet/types.js +3 -0
- package/dist/src/wallet/types.js.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOffRampUrl = exports.getOnRampUrl = void 0;
|
|
4
|
+
const constants_1 = require("../common/constants");
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const ApiUtils_1 = require("../utils/ApiUtils");
|
|
7
|
+
async function getOnRampUrl(walletAddr) {
|
|
8
|
+
const url = (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `on-ramp/${walletAddr}?provider=moonpay`))?.url;
|
|
9
|
+
if (!url) {
|
|
10
|
+
throw new errors_1.InternalFailureError(errors_1.ErrorCode.ServerFailure, `fail to get on ramp url for ${walletAddr}`, { walletAddr }, "retry later. if it still fails, please contact us.", "https://docs.fun.xyz");
|
|
11
|
+
}
|
|
12
|
+
return url;
|
|
13
|
+
}
|
|
14
|
+
exports.getOnRampUrl = getOnRampUrl;
|
|
15
|
+
async function getOffRampUrl(walletAddr) {
|
|
16
|
+
const url = (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `off-ramp/${walletAddr}?provider=moonpay`))?.url;
|
|
17
|
+
if (!url) {
|
|
18
|
+
throw new errors_1.InternalFailureError(errors_1.ErrorCode.ServerFailure, `fail to get off ramp url for ${walletAddr}`, { walletAddr }, "retry later. if it still fails, please contact us.", "https://docs.fun.xyz");
|
|
19
|
+
}
|
|
20
|
+
return url;
|
|
21
|
+
}
|
|
22
|
+
exports.getOffRampUrl = getOffRampUrl;
|
|
23
|
+
//# sourceMappingURL=OnOffRampUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OnOffRampUtils.js","sourceRoot":"","sources":["../../../src/apis/OnOffRampUtils.ts"],"names":[],"mappings":";;;AAAA,mDAA6C;AAC7C,sCAA2D;AAC3D,gDAAkD;AAE3C,KAAK,UAAU,YAAY,CAAC,UAAkB;IACjD,MAAM,GAAG,GAAG,CAAC,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,WAAW,UAAU,mBAAmB,CAAC,CAAC,EAAE,GAAG,CAAA;IAC1F,IAAI,CAAC,GAAG,EAAE;QACN,MAAM,IAAI,6BAAoB,CAC1B,kBAAS,CAAC,aAAa,EACvB,+BAA+B,UAAU,EAAE,EAC3C,EAAE,UAAU,EAAE,EACd,oDAAoD,EACpD,sBAAsB,CACzB,CAAA;KACJ;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAZD,oCAYC;AAEM,KAAK,UAAU,aAAa,CAAC,UAAkB;IAClD,MAAM,GAAG,GAAG,CAAC,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,YAAY,UAAU,mBAAmB,CAAC,CAAC,EAAE,GAAG,CAAA;IAC3F,IAAI,CAAC,GAAG,EAAE;QACN,MAAM,IAAI,6BAAoB,CAC1B,kBAAS,CAAC,aAAa,EACvB,gCAAgC,UAAU,EAAE,EAC5C,EAAE,UAAU,EAAE,EACd,oDAAoD,EACpD,sBAAsB,CACzB,CAAA;KACJ;IACD,OAAO,GAAG,CAAA;AACd,CAAC;AAZD,sCAYC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Address, Hex } from "viem";
|
|
2
|
+
import { EstimateOpInput, EstimatedGas, ExecuteOpInput, ScheduleOpInput } from "./types";
|
|
3
|
+
import { ExecutionReceipt } from "../common/types";
|
|
4
|
+
import { Operation, OperationStatus } from "../data";
|
|
5
|
+
export declare function createOp(op: Operation): Promise<string>;
|
|
6
|
+
export declare function getOpsOfGroup(groupId: Hex, chainId: string, status: OperationStatus): Promise<Operation[]>;
|
|
7
|
+
export declare function getOpsOfWallet(walletAddr: Address, chainId: string, status?: OperationStatus): Promise<Operation[]>;
|
|
8
|
+
export declare function getOps(opIds: Hex[], chainId: string): Promise<Operation[]>;
|
|
9
|
+
export declare function deleteOp(opId: Hex, chainId: string): Promise<void>;
|
|
10
|
+
export declare function signOp(opId: Hex, chainId: string, signature: Hex, signedBy: Address, threshold?: number): Promise<void>;
|
|
11
|
+
export declare function executeOp(executeOpInput: ExecuteOpInput): Promise<ExecutionReceipt>;
|
|
12
|
+
export declare function estimateOp(estimateOpInput: EstimateOpInput): Promise<EstimatedGas>;
|
|
13
|
+
export declare function scheduleOp(scheduleOpInput: ScheduleOpInput): Promise<void>;
|
|
14
|
+
export declare const getFullReceipt: (opId: any, chainId: any, userOpHash: any) => Promise<ExecutionReceipt>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFullReceipt = exports.scheduleOp = exports.estimateOp = exports.executeOp = exports.signOp = exports.deleteOp = exports.getOps = exports.getOpsOfWallet = exports.getOpsOfGroup = exports.createOp = void 0;
|
|
4
|
+
const constants_1 = require("../common/constants");
|
|
5
|
+
const data_1 = require("../data");
|
|
6
|
+
const ApiUtils_1 = require("../utils/ApiUtils");
|
|
7
|
+
async function createOp(op) {
|
|
8
|
+
return (await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "operation", { ...op })).opId;
|
|
9
|
+
}
|
|
10
|
+
exports.createOp = createOp;
|
|
11
|
+
async function getOpsOfGroup(groupId, chainId, status) {
|
|
12
|
+
const endpoint = status === data_1.OperationStatus.ALL
|
|
13
|
+
? `operation/group/${groupId}/${chainId}`
|
|
14
|
+
: `operation/group/${groupId}/chain/${chainId}?status=${status}`;
|
|
15
|
+
return (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, endpoint)).operations;
|
|
16
|
+
}
|
|
17
|
+
exports.getOpsOfGroup = getOpsOfGroup;
|
|
18
|
+
async function getOpsOfWallet(walletAddr, chainId, status) {
|
|
19
|
+
const endpoint = status
|
|
20
|
+
? `operation/wallet/${walletAddr}/chain/${chainId}?status=${status}`
|
|
21
|
+
: `operation/wallet/${walletAddr}/chain/${chainId}`;
|
|
22
|
+
return (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, endpoint)).operations;
|
|
23
|
+
}
|
|
24
|
+
exports.getOpsOfWallet = getOpsOfWallet;
|
|
25
|
+
async function getOps(opIds, chainId) {
|
|
26
|
+
return (await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "operation/get-operations", { opIds, chainId })).operations;
|
|
27
|
+
}
|
|
28
|
+
exports.getOps = getOps;
|
|
29
|
+
async function deleteOp(opId, chainId) {
|
|
30
|
+
await (0, ApiUtils_1.sendDeleteRequest)(constants_1.API_URL, `operation/${opId}/chain/${chainId}`);
|
|
31
|
+
}
|
|
32
|
+
exports.deleteOp = deleteOp;
|
|
33
|
+
async function signOp(opId, chainId, signature, signedBy, threshold) {
|
|
34
|
+
await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "operation/sign", { opId, chainId, signature, signedBy, threshold });
|
|
35
|
+
}
|
|
36
|
+
exports.signOp = signOp;
|
|
37
|
+
async function executeOp(executeOpInput) {
|
|
38
|
+
return await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "operation/execute", executeOpInput);
|
|
39
|
+
}
|
|
40
|
+
exports.executeOp = executeOp;
|
|
41
|
+
async function estimateOp(estimateOpInput) {
|
|
42
|
+
return await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "operation/estimate", estimateOpInput);
|
|
43
|
+
}
|
|
44
|
+
exports.estimateOp = estimateOp;
|
|
45
|
+
async function scheduleOp(scheduleOpInput) {
|
|
46
|
+
await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "operation/schedule", scheduleOpInput);
|
|
47
|
+
}
|
|
48
|
+
exports.scheduleOp = scheduleOp;
|
|
49
|
+
const getFullReceipt = async (opId, chainId, userOpHash) => {
|
|
50
|
+
const retries = 12;
|
|
51
|
+
let result;
|
|
52
|
+
for (let i = 0; i < retries; i++) {
|
|
53
|
+
try {
|
|
54
|
+
result = await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `operation/${opId}/chain/${chainId}/receipt?userOpHash=${userOpHash}`);
|
|
55
|
+
if (result.status === "included") {
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
/* empty */
|
|
61
|
+
}
|
|
62
|
+
await new Promise((resolve) => setTimeout(resolve, 2500));
|
|
63
|
+
}
|
|
64
|
+
if (!result.receipt) {
|
|
65
|
+
result.receipt = {
|
|
66
|
+
txId: "Failed to find.",
|
|
67
|
+
gasUsed: "Failed to find.",
|
|
68
|
+
opFeeUSD: "Failed to find.",
|
|
69
|
+
opFee: "Failed to find."
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
...result.receipt
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
exports.getFullReceipt = getFullReceipt;
|
|
77
|
+
//# sourceMappingURL=OperationApis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OperationApis.js","sourceRoot":"","sources":["../../../src/apis/OperationApis.ts"],"names":[],"mappings":";;;AAEA,mDAA6C;AAE7C,kCAAoD;AACpD,gDAAsF;AAE/E,KAAK,UAAU,QAAQ,CAAC,EAAa;IACxC,OAAO,CAAC,MAAM,IAAA,0BAAe,EAAC,mBAAO,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AACxE,CAAC;AAFD,4BAEC;AAEM,KAAK,UAAU,aAAa,CAAC,OAAY,EAAE,OAAe,EAAE,MAAuB;IACtF,MAAM,QAAQ,GACV,MAAM,KAAK,sBAAe,CAAC,GAAG;QAC1B,CAAC,CAAC,mBAAmB,OAAO,IAAI,OAAO,EAAE;QACzC,CAAC,CAAC,mBAAmB,OAAO,UAAU,OAAO,WAAW,MAAM,EAAE,CAAA;IACxE,OAAO,CAAC,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAA;AAC/D,CAAC;AAND,sCAMC;AAEM,KAAK,UAAU,cAAc,CAAC,UAAmB,EAAE,OAAe,EAAE,MAAwB;IAC/F,MAAM,QAAQ,GAAG,MAAM;QACnB,CAAC,CAAC,oBAAoB,UAAU,UAAU,OAAO,WAAW,MAAM,EAAE;QACpE,CAAC,CAAC,oBAAoB,UAAU,UAAU,OAAO,EAAE,CAAA;IACvD,OAAO,CAAC,MAAM,IAAA,yBAAc,EAAC,mBAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAA;AAC/D,CAAC;AALD,wCAKC;AAEM,KAAK,UAAU,MAAM,CAAC,KAAY,EAAE,OAAe;IACtD,OAAO,CAAC,MAAM,IAAA,0BAAe,E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,yBAAc,EAAC,mBAAO,EAAE,aAAa,IAAI,UAAU,OAAO,uBAAuB,UAAU,EAAE,CAAC,CAAA;YAC7G,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,EAAE;gBAC9B,MAAK;aACR;SACJ;QAAC,OAAO,CAAC,EAAE;YACR,WAAW;SACd;QAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAA;KAC5D;IACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;QACjB,MAAM,CAAC,OAAO,GAAG;YACb,IAAI,EAAE,iBAAiB;YACvB,OAAO,EAAE,iBAAiB;YAC1B,QAAQ,EAAE,iBAAiB;YAC3B,KAAK,EAAE,iBAAiB;SAC3B,CAAA;KACJ;IAED,OAAO;QACH,GAAG,MAAM,CAAC,OAAO;KACpB,CAAA;AACL,CAAC,CAAA;AA3BY,QAAA,cAAc,kBA2B1B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { PaymasterType } from "../sponsors/types";
|
|
2
|
+
export interface PaymasterTransaction {
|
|
3
|
+
action: string;
|
|
4
|
+
amount: number;
|
|
5
|
+
from: string;
|
|
6
|
+
to: string;
|
|
7
|
+
token: string;
|
|
8
|
+
txid?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function updatePaymasterMode(chainId: string, updateObj: any, paymasterType: PaymasterType, sponsorAddress: string): Promise<any>;
|
|
11
|
+
export declare function removeFromList(chainId: string, address: string[], listType: string, paymasterType: PaymasterType, sponsorAddress: string): Promise<any>;
|
|
12
|
+
export declare function addToList(chainId: string, address: string[], listType: string, paymasterType: PaymasterType, sponsorAddress: string): Promise<any>;
|
|
13
|
+
export declare function addTransaction(chainId: string, timestamp: number, txid: any, transaction: PaymasterTransaction, paymasterType: PaymasterType, sponsorAddress: string): Promise<any>;
|
|
14
|
+
export declare function addPaymasterToken(chainId: string, tokenAddress: string): Promise<any>;
|
|
15
|
+
export declare function batchOperation(chainId: string, addresses: string[], modes: boolean[], list: string, paymasterType: PaymasterType, sponsorAddress: string): Promise<any>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.batchOperation = exports.addPaymasterToken = exports.addTransaction = exports.addToList = exports.removeFromList = exports.updatePaymasterMode = void 0;
|
|
4
|
+
const constants_1 = require("../common/constants");
|
|
5
|
+
const ApiUtils_1 = require("../utils/ApiUtils");
|
|
6
|
+
async function updatePaymasterMode(chainId, updateObj, paymasterType, sponsorAddress) {
|
|
7
|
+
try {
|
|
8
|
+
return await (0, ApiUtils_1.sendPostRequest)(constants_1.DASHBOARD_API_URL, "paymasters/update", {
|
|
9
|
+
chain: chainId,
|
|
10
|
+
sponsorAddress,
|
|
11
|
+
type: paymasterType,
|
|
12
|
+
updateObj
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
/* empty */
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.updatePaymasterMode = updatePaymasterMode;
|
|
20
|
+
async function removeFromList(chainId, address, listType, paymasterType, sponsorAddress) {
|
|
21
|
+
try {
|
|
22
|
+
return await (0, ApiUtils_1.sendPostRequest)(constants_1.DASHBOARD_API_URL, "paymasters/remove-from-list", {
|
|
23
|
+
chain: chainId,
|
|
24
|
+
sponsorAddress,
|
|
25
|
+
type: paymasterType,
|
|
26
|
+
listType,
|
|
27
|
+
updateAddrs: address
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
/* empty */
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.removeFromList = removeFromList;
|
|
35
|
+
async function addToList(chainId, address, listType, paymasterType, sponsorAddress) {
|
|
36
|
+
try {
|
|
37
|
+
return await (0, ApiUtils_1.sendPostRequest)(constants_1.DASHBOARD_API_URL, "paymasters/add-to-list", {
|
|
38
|
+
chain: chainId,
|
|
39
|
+
sponsorAddress,
|
|
40
|
+
type: paymasterType,
|
|
41
|
+
listType,
|
|
42
|
+
updateAddrs: address
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
/* empty */
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.addToList = addToList;
|
|
50
|
+
async function addTransaction(chainId, timestamp, txid, transaction, paymasterType, sponsorAddress) {
|
|
51
|
+
try {
|
|
52
|
+
return await (0, ApiUtils_1.sendPostRequest)(constants_1.DASHBOARD_API_URL, "paymasters/add-transaction", {
|
|
53
|
+
chain: chainId,
|
|
54
|
+
sponsorAddress,
|
|
55
|
+
type: paymasterType,
|
|
56
|
+
timestamp,
|
|
57
|
+
transaction,
|
|
58
|
+
txid
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
catch (e) {
|
|
62
|
+
/* empty */
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.addTransaction = addTransaction;
|
|
66
|
+
async function addPaymasterToken(chainId, tokenAddress) {
|
|
67
|
+
try {
|
|
68
|
+
return await (0, ApiUtils_1.sendPostRequest)(constants_1.DASHBOARD_API_URL, "paymasters/supported-tokens/add", {
|
|
69
|
+
chain: chainId,
|
|
70
|
+
tokenAddress
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
/* empty */
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.addPaymasterToken = addPaymasterToken;
|
|
78
|
+
async function batchOperation(chainId, addresses, modes, list, paymasterType, sponsorAddress) {
|
|
79
|
+
const addList = addresses.filter((_, i) => {
|
|
80
|
+
return modes[i];
|
|
81
|
+
});
|
|
82
|
+
const removeList = addresses.filter((_, i) => {
|
|
83
|
+
return !modes[i];
|
|
84
|
+
});
|
|
85
|
+
await addToList(chainId.toString(), addList, list, paymasterType, sponsorAddress);
|
|
86
|
+
await removeFromList(chainId, removeList, list, paymasterType, sponsorAddress);
|
|
87
|
+
}
|
|
88
|
+
exports.batchOperation = batchOperation;
|
|
89
|
+
//# sourceMappingURL=PaymasterApis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymasterApis.js","sourceRoot":"","sources":["../../../src/apis/PaymasterApis.ts"],"names":[],"mappings":";;;AAAA,mDAAuD;AAEvD,gDAAmD;AAU5C,KAAK,UAAU,mBAAmB,CACrC,OAAe,EACf,SAAc,EACd,aAA4B,EAC5B,cAAsB;IAEtB,IAAI;QACA,OAAO,MAAM,IAAA,0BAAe,EAAC,6BAAiB,EAAE,mBAAmB,EAAE;YACjE,KAAK,EAAE,OAAO;YACd,cAAc;YACd,IAAI,EAAE,aAAa;YACnB,SAAS;SACZ,CAAC,CAAA;KACL;IAAC,OAAO,CAAC,EAAE;QACR,WAAW;KACd;AACL,CAAC;AAhBD,kDAgBC;AAEM,KAAK,UAAU,cAAc,CAChC,OAAe,EACf,OAAiB,EACjB,QAAgB,EAChB,aAA4B,EAC5B,cAAsB;IAEtB,IAAI;QACA,OAAO,MAAM,IAAA,0BAAe,EAAC,6BAAiB,EAAE,6BAA6B,EAAE;YAC3E,KAAK,EAAE,OAAO;YACd,cAAc;YACd,IAAI,EAAE,aAAa;YACnB,QAAQ;YACR,WAAW,EAAE,OAAO;SACvB,CAAC,CAAA;KACL;IAAC,OAAO,CAAC,EAAE;QACR,WAAW;KACd;AACL,CAAC;AAlBD,wCAkBC;AAEM,KAAK,UAAU,SAAS,CAC3B,OAAe,EACf,OAAiB,EACjB,QAAgB,EAChB,aAA4B,EAC5B,cAAsB;IAEtB,IAAI;QACA,OAAO,MAAM,IAAA,0BAAe,EAAC,6BAAiB,EAAE,wBAAwB,EAAE;YACtE,KAAK,EAAE,OAAO;YACd,cAAc;YACd,IAAI,EAAE,aAAa;YACnB,QAAQ;YACR,WAAW,EAAE,OAAO;SACvB,CAAC,CAAA;KACL;IAAC,OAAO,CAAC,EAAE;QACR,WAAW;KAC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AAC,CAAA;AAClF,CAAC;AAjBD,wCAiBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Address, Hex } from "viem";
|
|
2
|
+
import { Wallet } from "./types";
|
|
3
|
+
export declare function createUser(authId: string, addr: string, method: string, userUniqueId: string): Promise<void>;
|
|
4
|
+
export declare function getUserUniqueId(authId: string): Promise<string>;
|
|
5
|
+
export declare function getUserAddr(authId: string): Promise<string>;
|
|
6
|
+
export declare function getUserWalletsByAddr(addr: string, chainId?: string): Promise<Wallet[]>;
|
|
7
|
+
export declare function getUserAuthIdByAddr(addr: string): Promise<string>;
|
|
8
|
+
export declare function addUserToWallet(authId: string, chainId: string, walletAddr: Address, userIds: Hex[], walletUniqueId?: string): Promise<void>;
|
|
9
|
+
export declare function removeUserWalletIdentity(authId: string, chainId: string, walletAddr: Address, userId: Hex): Promise<void>;
|
|
10
|
+
export declare function getUserWalletIdentities(authId: string, chainId: string, walletAddr: Address): Promise<Hex[]>;
|
|
11
|
+
export declare function addUserToGroup(authId: string, chainId: string, walletAddr: Address, groupId: Hex): Promise<void>;
|
|
12
|
+
export declare function removeUserFromGroup(authId: string, chainId: string, walletAddr: Address, groupId: Hex): Promise<void>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeUserFromGroup = exports.addUserToGroup = exports.getUserWalletIdentities = exports.removeUserWalletIdentity = exports.addUserToWallet = exports.getUserAuthIdByAddr = exports.getUserWalletsByAddr = exports.getUserAddr = exports.getUserUniqueId = exports.createUser = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const constants_1 = require("../common/constants");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const ApiUtils_1 = require("../utils/ApiUtils");
|
|
8
|
+
async function createUser(authId, addr, method, userUniqueId) {
|
|
9
|
+
await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, "user", {
|
|
10
|
+
authId,
|
|
11
|
+
addr,
|
|
12
|
+
method,
|
|
13
|
+
userUniqueId
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
exports.createUser = createUser;
|
|
17
|
+
async function getUserUniqueId(authId) {
|
|
18
|
+
try {
|
|
19
|
+
return (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `user/auth/${authId}/unique-id`)).userUniqueId;
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
if (err instanceof errors_1.ResourceNotFoundError) {
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
throw err;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.getUserUniqueId = getUserUniqueId;
|
|
29
|
+
async function getUserAddr(authId) {
|
|
30
|
+
return (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `user/auth/${authId}/addr`)).addr;
|
|
31
|
+
}
|
|
32
|
+
exports.getUserAddr = getUserAddr;
|
|
33
|
+
async function getUserWalletsByAddr(addr, chainId) {
|
|
34
|
+
const endpoint = chainId ? `user/addr/${addr}/wallets?chainId=${chainId}` : `user/addr/${addr}/wallets`;
|
|
35
|
+
return (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, endpoint)).wallets;
|
|
36
|
+
}
|
|
37
|
+
exports.getUserWalletsByAddr = getUserWalletsByAddr;
|
|
38
|
+
async function getUserAuthIdByAddr(addr) {
|
|
39
|
+
return (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `user/addr/${addr}/authId`)).authId;
|
|
40
|
+
}
|
|
41
|
+
exports.getUserAuthIdByAddr = getUserAuthIdByAddr;
|
|
42
|
+
async function addUserToWallet(authId, chainId, walletAddr, userIds, walletUniqueId) {
|
|
43
|
+
try {
|
|
44
|
+
await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, `user/auth/${authId}/chain/${chainId}/wallet`, {
|
|
45
|
+
walletAddr,
|
|
46
|
+
userIds,
|
|
47
|
+
walletUniqueId
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
if (err instanceof viem_1.InvalidParameterError) {
|
|
52
|
+
// swallow the error if the wallet already exists.
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.addUserToWallet = addUserToWallet;
|
|
58
|
+
async function removeUserWalletIdentity(authId, chainId, walletAddr, userId) {
|
|
59
|
+
await (0, ApiUtils_1.sendDeleteRequest)(constants_1.API_URL, `user/auth/${authId}/chain/${chainId}/wallet/${walletAddr}/identity/${userId}`);
|
|
60
|
+
}
|
|
61
|
+
exports.removeUserWalletIdentity = removeUserWalletIdentity;
|
|
62
|
+
// return userIds of the specificed Wallet.
|
|
63
|
+
async function getUserWalletIdentities(authId, chainId, walletAddr) {
|
|
64
|
+
return (await (0, ApiUtils_1.sendGetRequest)(constants_1.API_URL, `user/auth/${authId}/chain/${chainId}/wallet/${walletAddr}/identities`)).ids ?? [];
|
|
65
|
+
}
|
|
66
|
+
exports.getUserWalletIdentities = getUserWalletIdentities;
|
|
67
|
+
async function addUserToGroup(authId, chainId, walletAddr, groupId) {
|
|
68
|
+
await (0, ApiUtils_1.sendPostRequest)(constants_1.API_URL, `user/auth/${authId}/chain/${chainId}/wallet/${walletAddr}/group`, {
|
|
69
|
+
groupId
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
exports.addUserToGroup = addUserToGroup;
|
|
73
|
+
async function removeUserFromGroup(authId, chainId, walletAddr, groupId) {
|
|
74
|
+
await (0, ApiUtils_1.sendDeleteRequest)(constants_1.API_URL, `user/auth/${authId}/chain/${chainId}/wallet/${walletAddr}/group/${groupId}`);
|
|
75
|
+
}
|
|
76
|
+
exports.removeUserFromGroup = removeUserFromGroup;
|
|
77
|
+
//# sourceMappingURL=UserApis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserApis.js","sourceRoot":"","sources":["../../../src/apis/UserApis.ts"],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AC;AAFD,kDAEC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./AssetApis";
|
|
2
|
+
export * from "./ContractApis";
|
|
3
|
+
export * from "./GroupApis";
|
|
4
|
+
export * from "./InfoApis";
|
|
5
|
+
export * from "./NFTApis";
|
|
6
|
+
export * from "./OnOffRampApis";
|
|
7
|
+
export * from "./OperationApis";
|
|
8
|
+
export * from "./PaymasterApis";
|
|
9
|
+
export * from "./UserApis";
|
|
10
|
+
export * from "./types";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AssetApis"), exports);
|
|
18
|
+
__exportStar(require("./ContractApis"), exports);
|
|
19
|
+
__exportStar(require("./GroupApis"), exports);
|
|
20
|
+
__exportStar(require("./InfoApis"), exports);
|
|
21
|
+
__exportStar(require("./NFTApis"), exports);
|
|
22
|
+
__exportStar(require("./OnOffRampApis"), exports);
|
|
23
|
+
__exportStar(require("./OperationApis"), exports);
|
|
24
|
+
__exportStar(require("./PaymasterApis"), exports);
|
|
25
|
+
__exportStar(require("./UserApis"), exports);
|
|
26
|
+
__exportStar(require("./types"), exports);
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/apis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA2B;AAC3B,iDAA8B;AAC9B,8CAA2B;AAC3B,6CAA0B;AAC1B,4CAAyB;AACzB,kDAA+B;AAC/B,kDAA+B;AAC/B,kDAA+B;AAC/B,6CAA0B;AAC1B,0CAAuB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Address, Hex } from "viem";
|
|
2
|
+
import { UserOperation } from "../data";
|
|
3
|
+
import { GroupInfo } from "../wallet";
|
|
4
|
+
export type Wallet = {
|
|
5
|
+
walletUniqueId?: string;
|
|
6
|
+
walletAddr: Address;
|
|
7
|
+
userIds: Hex[];
|
|
8
|
+
};
|
|
9
|
+
export type GroupMetadata = {
|
|
10
|
+
groupId: Hex;
|
|
11
|
+
chainId: string;
|
|
12
|
+
threshold: number;
|
|
13
|
+
walletAddr: Address;
|
|
14
|
+
memberIds: Hex[];
|
|
15
|
+
};
|
|
16
|
+
export type UpdateGroupMetadata = {
|
|
17
|
+
threshold?: number;
|
|
18
|
+
memberIds?: Hex[];
|
|
19
|
+
};
|
|
20
|
+
export type ExecuteOpInput = {
|
|
21
|
+
opId: Hex;
|
|
22
|
+
chainId: string;
|
|
23
|
+
executedBy: string;
|
|
24
|
+
entryPointAddress: Address;
|
|
25
|
+
signature: Hex;
|
|
26
|
+
userOp?: UserOperation;
|
|
27
|
+
groupInfo?: GroupInfo;
|
|
28
|
+
};
|
|
29
|
+
export type ScheduleOpInput = {
|
|
30
|
+
opId: Hex;
|
|
31
|
+
chainId: string;
|
|
32
|
+
scheduledBy: string;
|
|
33
|
+
entryPointAddress: Address;
|
|
34
|
+
signature: Hex;
|
|
35
|
+
userOp?: UserOperation;
|
|
36
|
+
groupInfo?: GroupInfo;
|
|
37
|
+
};
|
|
38
|
+
export type EstimateOpInput = {
|
|
39
|
+
opId?: Hex;
|
|
40
|
+
chainId: string;
|
|
41
|
+
entryPointAddress?: Address;
|
|
42
|
+
signature?: Hex;
|
|
43
|
+
userOp?: UserOperation;
|
|
44
|
+
};
|
|
45
|
+
export type EstimatedGas = {
|
|
46
|
+
preVerificationGas: bigint;
|
|
47
|
+
callGasLimit: bigint;
|
|
48
|
+
verificationGasLimit: bigint;
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/apis/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Address, Hex, JsonRpcAccount, PrivateKeyAccount, TransactionReceipt, WalletClient } from "viem";
|
|
2
|
+
import { AuthInput } from "./types";
|
|
3
|
+
import { Wallet } from "../apis/types";
|
|
4
|
+
import { TransactionData, TransactionParams } from "../common";
|
|
5
|
+
import { EnvOption } from "../config";
|
|
6
|
+
import { Chain, Operation } from "../data";
|
|
7
|
+
export declare class Auth {
|
|
8
|
+
authId?: string;
|
|
9
|
+
signer?: PrivateKeyAccount | JsonRpcAccount;
|
|
10
|
+
client?: WalletClient;
|
|
11
|
+
inited: boolean;
|
|
12
|
+
account?: Address;
|
|
13
|
+
constructor(authInput: AuthInput);
|
|
14
|
+
init(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Signs a hash using the stored signer and returns the signature.
|
|
17
|
+
* @param {Hex} hash - The hash to be signed.
|
|
18
|
+
* @param {boolean} isGroupOp - Whether the operation is a group operation (default: false).
|
|
19
|
+
* @returns {Promise<Hex>} The signature of the hash.
|
|
20
|
+
*/
|
|
21
|
+
signHash(hash: Hex, isGroupOp?: boolean): Promise<Hex>;
|
|
22
|
+
/**
|
|
23
|
+
* Signs an operation using the stored signer and returns the signature.
|
|
24
|
+
* @param {Operation} operation - The operation to be signed.
|
|
25
|
+
* @param {Chain} chain - The chain instance associated with the operation.
|
|
26
|
+
* @param {boolean} isGroupOp - Whether the operation is a group operation (default: false).
|
|
27
|
+
* @returns {Promise<Hex>} The signature of the operation.
|
|
28
|
+
*/
|
|
29
|
+
signOp(operation: Operation, chain: Chain, isGroupOp?: boolean): Promise<Hex>;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves the address associated with the initialized signer or client.
|
|
32
|
+
* @returns {Promise<Address>} The address associated with the signer or client.
|
|
33
|
+
* @throws {Error} If no signer or client is available.
|
|
34
|
+
*/
|
|
35
|
+
getAddress(): Promise<Address>;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves the user ID by padding the address associated with the signer or client.
|
|
38
|
+
* @returns {Promise<Hex>} The padded user ID.
|
|
39
|
+
*/
|
|
40
|
+
getUserId(): Promise<Hex>;
|
|
41
|
+
/**
|
|
42
|
+
* Generates an estimate gas signature for an operation using the provided user ID.
|
|
43
|
+
* @param {string} userId - The user ID to generate the estimate gas signature for.
|
|
44
|
+
* @param {Operation} _ - The operation (not used in this method).
|
|
45
|
+
* @returns {Promise<Hex>} The estimate gas signature.
|
|
46
|
+
*/
|
|
47
|
+
getEstimateGasSignature(userId: string, _: Operation): Promise<Hex>;
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves a unique ID for the wallet based on an index and optional skipDBActions flag.
|
|
50
|
+
* @param {number} index - The index for generating the unique ID (default: 0).
|
|
51
|
+
* @param {boolean} skipDBActions - Whether to skip database actions (default: false).
|
|
52
|
+
* @returns {Promise<Hex>} The generated unique ID for the wallet.
|
|
53
|
+
*/
|
|
54
|
+
getWalletUniqueId(index?: number, skipDBActions?: boolean): Promise<Hex>;
|
|
55
|
+
/**
|
|
56
|
+
* Sends a transaction with the provided transaction data and options.
|
|
57
|
+
* @param {TransactionParams} txData - The transaction data including 'to', 'data', and 'value'.
|
|
58
|
+
* @param {EnvOption} options - The environment options (default: globalEnvOption).
|
|
59
|
+
* @returns {Promise<TransactionReceipt>} The transaction receipt.
|
|
60
|
+
*/
|
|
61
|
+
sendTx(txData: TransactionParams, options?: EnvOption): Promise<TransactionReceipt>;
|
|
62
|
+
/**
|
|
63
|
+
* Sends an array of transactions and returns an array of corresponding transaction receipts.
|
|
64
|
+
* @param {TransactionData[]} txs - An array of transaction data.
|
|
65
|
+
* @returns {Promise<TransactionReceipt[]>} An array of transaction receipts.
|
|
66
|
+
*/
|
|
67
|
+
sendTxs(txs: TransactionData[]): Promise<TransactionReceipt[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves the user IDs of the current auth object associated with a wallet address on a specific chain.
|
|
70
|
+
* @param {Address} wallet - The wallet address for which to retrieve user IDs.
|
|
71
|
+
* @param {string} chainId - The chain identifier.
|
|
72
|
+
* @returns {Promise<Hex[]>} An array of user IDs associated with the wallet address.
|
|
73
|
+
*/
|
|
74
|
+
getUserIds(wallet: Address, chainId: string): Promise<Hex[]>;
|
|
75
|
+
/**
|
|
76
|
+
* Retrieves the wallets associated with the current auth object.
|
|
77
|
+
* @param {string} [chainId] - Optional chain identifier.
|
|
78
|
+
* @returns {Promise<Wallet[]>} An array of wallet objects associated with the address.
|
|
79
|
+
*/
|
|
80
|
+
getWallets(chainId?: string): Promise<Wallet[]>;
|
|
81
|
+
}
|