@aa-sdk/core 4.0.0-alpha.1 → 4.0.0-alpha.3
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/cjs/ens/utils.d.ts +1 -1
- package/dist/cjs/ens/utils.js +3 -3
- package/dist/cjs/ens/utils.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.js +35 -58
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/signer/local-account.d.ts +2 -2
- package/dist/cjs/signer/wallet-client.d.ts +2 -2
- package/dist/cjs/utils/defaults.d.ts +1 -1
- package/dist/cjs/utils/defaults.js +25 -25
- package/dist/cjs/utils/defaults.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +0 -3
- package/dist/cjs/utils/index.js +1 -25
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/ens/utils.d.ts +1 -1
- package/dist/esm/ens/utils.js +1 -1
- package/dist/esm/ens/utils.js.map +1 -1
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/signer/local-account.d.ts +2 -2
- package/dist/esm/signer/wallet-client.d.ts +2 -2
- package/dist/esm/utils/defaults.d.ts +1 -1
- package/dist/esm/utils/defaults.js +2 -2
- package/dist/esm/utils/defaults.js.map +1 -1
- package/dist/esm/utils/index.d.ts +0 -3
- package/dist/esm/utils/index.js +0 -11
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/ens/utils.d.ts +1 -1
- package/dist/types/ens/utils.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/signer/local-account.d.ts +2 -2
- package/dist/types/signer/wallet-client.d.ts +2 -2
- package/dist/types/utils/defaults.d.ts +1 -1
- package/dist/types/utils/defaults.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +0 -10
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/ens/utils.ts +1 -2
- package/src/index.ts +0 -23
- package/src/utils/defaults.ts +3 -4
- package/src/utils/index.ts +0 -23
- package/src/version.ts +1 -1
- package/dist/cjs/chains/index.d.ts +0 -20
- package/dist/cjs/chains/index.js +0 -169
- package/dist/cjs/chains/index.js.map +0 -1
- package/dist/esm/chains/index.d.ts +0 -20
- package/dist/esm/chains/index.js +0 -166
- package/dist/esm/chains/index.js.map +0 -1
- package/dist/types/chains/index.d.ts +0 -21
- package/dist/types/chains/index.d.ts.map +0 -1
- package/src/chains/index.ts +0 -194
package/dist/cjs/ens/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Chain } from "viem/chains";
|
|
2
1
|
import * as chains from "viem/chains";
|
|
2
|
+
import { type Chain } from "viem/chains";
|
|
3
3
|
export declare const ChainsById: Map<number, chains.Chain>;
|
|
4
4
|
export declare const convertChainIdToCoinType: (chainId: number) => number;
|
|
5
5
|
export declare const convertCoinTypeToChainId: (coinType: number) => number;
|
package/dist/cjs/ens/utils.js
CHANGED
|
@@ -25,10 +25,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.convertCoinTypeToChain = exports.convertCoinTypeToChainId = exports.convertChainIdToCoinType = exports.ChainsById = void 0;
|
|
27
27
|
const chains = __importStar(require("viem/chains"));
|
|
28
|
-
const
|
|
28
|
+
const chains_1 = require("viem/chains");
|
|
29
29
|
exports.ChainsById = new Map(Object.values(chains).map((x) => [x.id, x]));
|
|
30
30
|
const convertChainIdToCoinType = (chainId) => {
|
|
31
|
-
if (chainId ===
|
|
31
|
+
if (chainId === chains_1.mainnet.id) {
|
|
32
32
|
return 60;
|
|
33
33
|
}
|
|
34
34
|
return (0x80000000 | chainId) >>> 0;
|
|
@@ -36,7 +36,7 @@ const convertChainIdToCoinType = (chainId) => {
|
|
|
36
36
|
exports.convertChainIdToCoinType = convertChainIdToCoinType;
|
|
37
37
|
const convertCoinTypeToChainId = (coinType) => {
|
|
38
38
|
if (coinType === 60) {
|
|
39
|
-
return
|
|
39
|
+
return chains_1.mainnet.id;
|
|
40
40
|
}
|
|
41
41
|
return (0x7fffffff & coinType) >> 0;
|
|
42
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,wCAAkD;AAErC,QAAA,UAAU,GAA8B,IAAI,GAAG,CAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAC5C,CAAC;AAgBK,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,IAAI,OAAO,KAAK,gBAAO,CAAC,EAAE,EAAE,CAAC;QAE3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAGD,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AARW,QAAA,wBAAwB,4BAQnC;AAiBK,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnE,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QAEpB,OAAO,gBAAO,CAAC,EAAE,CAAC;IACpB,CAAC;IAGD,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AARW,QAAA,wBAAwB,4BAQnC;AAkBK,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAS,EAAE;IAChE,MAAM,OAAO,GAAG,IAAA,gCAAwB,EAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,kBAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AARW,QAAA,sBAAsB,0BAQjC","sourcesContent":["import * as chains from \"viem/chains\";\nimport { mainnet, type Chain } from \"viem/chains\";\n\nexport const ChainsById: Map<number, chains.Chain> = new Map(\n Object.values(chains).map((x) => [x.id, x])\n);\n\n/**\n * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * ```\n *\n * @param {number} chainId the blockchain chain ID that you want to convert to a coin type\n * @returns {number} the corresponding coin type for the given chain ID\n */\nexport const convertChainIdToCoinType = (chainId: number): number => {\n if (chainId === mainnet.id) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return 60;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x80000000 | chainId) >>> 0;\n};\n\n/**\n * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChainId } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chainId = convertCoinTypeToChainId(coinType);\n * ```\n *\n * @param {number} coinType the coin type to be converted to a chain ID\n * @returns {number} the corresponding chain ID\n */\nexport const convertCoinTypeToChainId = (coinType: number): number => {\n if (coinType === 60) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return mainnet.id;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x7fffffff & coinType) >> 0;\n};\n\n/**\n * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChain } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chain = convertCoinTypeToChain(coinType);\n * ```\n *\n * @param {number} coinType The numerical identifier for the coin type\n * @returns {Chain} The corresponding blockchain chain\n * @throws {Error} If the coin type does not map to a supported chain\n */\nexport const convertCoinTypeToChain = (coinType: number): Chain => {\n const chainId = convertCoinTypeToChainId(coinType);\n const chain = ChainsById.get(chainId);\n if (!chain) {\n throw new Error(\"CoinType does not map to a supported chain\");\n }\n\n return chain;\n};\n"]}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ export { sendTransactions } from "./actions/smartAccount/sendTransactions.js";
|
|
|
22
22
|
export { sendUserOperation } from "./actions/smartAccount/sendUserOperation.js";
|
|
23
23
|
export type * from "./actions/smartAccount/types.js";
|
|
24
24
|
export { waitForUserOperationTransaction } from "./actions/smartAccount/waitForUserOperationTransacation.js";
|
|
25
|
-
export { arbitrum, arbitrumGoerli, arbitrumSepolia, base, baseGoerli, baseSepolia, fraxtal, fraxtalSepolia, goerli, mainnet, optimism, optimismGoerli, optimismSepolia, polygon, polygonAmoy, polygonMumbai, sepolia, zora, zoraSepolia, } from "./chains/index.js";
|
|
26
25
|
export type * from "./client/bundlerClient.js";
|
|
27
26
|
export { createBundlerClient, createBundlerClientFromExisting, } from "./client/bundlerClient.js";
|
|
28
27
|
export type * from "./client/decorators/bundlerClient.js";
|
|
@@ -60,4 +59,4 @@ export { WalletClientSigner } from "./signer/wallet-client.js";
|
|
|
60
59
|
export { split, type SplitTransportParams } from "./transport/split.js";
|
|
61
60
|
export type * from "./types.js";
|
|
62
61
|
export type * from "./utils/index.js";
|
|
63
|
-
export {
|
|
62
|
+
export { BigNumberishRangeSchema, BigNumberishSchema, ChainSchema, HexSchema, MultiplierSchema, allEqual, applyUserOpFeeOption, applyUserOpOverride, applyUserOpOverrideOrFeeOption, asyncPipe, bigIntMax, bigIntMultiply, bypassPaymasterAndData, bypassPaymasterAndDataEmptyHex, concatPaymasterAndData, deepHexlify, filterUndefined, getDefaultSimpleAccountFactoryAddress, getDefaultUserOperationFeeOptions, isBigNumberish, isMultiplier, isValidRequest, parsePaymasterAndData, pick, resolveProperties, takeBytes, toRecord, } from "./utils/index.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -23,9 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.
|
|
28
|
-
exports.toRecord = exports.takeBytes = exports.resolveProperties = exports.pick = exports.parsePaymasterAndData = exports.isValidRequest = exports.isMultiplier = exports.isBigNumberish = exports.getDefaultUserOperationFeeOptions = exports.getDefaultSimpleAccountFactoryAddress = exports.getChain = exports.filterUndefined = exports.deepHexlify = exports.concatPaymasterAndData = exports.bypassPaymasterAndDataEmptyHex = exports.bypassPaymasterAndData = exports.bigIntMultiply = exports.bigIntMax = exports.asyncPipe = exports.applyUserOpOverrideOrFeeOption = exports.applyUserOpOverride = void 0;
|
|
26
|
+
exports.ChainNotFoundError = exports.BaseError = exports.UpgradesNotSupportedError = exports.UpgradeToAndCallNotSupportedError = exports.SmartAccountWithSignerRequiredError = exports.SignTransactionNotSupportedError = exports.IncorrectAccountType = exports.GetCounterFactualAddressError = exports.FailedToGetStorageSlotError = exports.DefaultFactoryNotDefinedError = exports.BatchExecutionNotSupportedError = exports.AccountRequiresOwnerError = exports.AccountNotFoundError = exports.isEntryPointVersion = exports.getEntryPoint = exports.entryPointRegistry = exports.defaultEntryPointVersion = exports.convertCoinTypeToChainId = exports.convertCoinTypeToChain = exports.convertChainIdToCoinType = exports.createSmartAccountClientFromExisting = exports.createSmartAccountClient = exports.SmartAccountClientOptsSchema = exports.ConnectionConfigSchema = exports.isSmartAccountClient = exports.smartAccountClientActions = exports.bundlerActions = exports.createBundlerClientFromExisting = exports.createBundlerClient = exports.waitForUserOperationTransaction = exports.sendUserOperation = exports.sendTransactions = exports.sendTransaction = exports.dropAndReplaceUserOperation = exports.checkGasSponsorshipEligibility = exports.buildUserOperationFromTxs = exports.buildUserOperationFromTx = exports.buildUserOperation = exports.toSmartContractAccount = exports.parseFactoryAddressFromAccountInitCode = exports.isSmartAccountWithSigner = exports.getAccountAddress = exports.createSimpleSmartAccount = exports.BaseSmartContractAccount = exports.SimpleAccountFactoryAbi = exports.SimpleAccountAbi_v7 = exports.SimpleAccountAbi_v6 = exports.EntryPointAbi_v7 = exports.EntryPointAbi_v6 = exports.chains = void 0;
|
|
27
|
+
exports.toRecord = exports.takeBytes = exports.resolveProperties = exports.pick = exports.parsePaymasterAndData = exports.isValidRequest = exports.isMultiplier = exports.isBigNumberish = exports.getDefaultUserOperationFeeOptions = exports.getDefaultSimpleAccountFactoryAddress = exports.filterUndefined = exports.deepHexlify = exports.concatPaymasterAndData = exports.bypassPaymasterAndDataEmptyHex = exports.bypassPaymasterAndData = exports.bigIntMultiply = exports.bigIntMax = exports.asyncPipe = exports.applyUserOpOverrideOrFeeOption = exports.applyUserOpOverride = exports.applyUserOpFeeOption = exports.allEqual = exports.MultiplierSchema = exports.HexSchema = exports.ChainSchema = exports.BigNumberishSchema = exports.BigNumberishRangeSchema = exports.split = exports.WalletClientSigner = exports.wrapSignatureWith6492 = exports.isSigner = exports.SignerSchema = exports.LocalAccountSigner = exports.noopMiddleware = exports.defaultUserOpSigner = exports.defaultPaymasterAndData = exports.defaultGasEstimator = exports.defaultFeeEstimator = exports.middlewareActions = exports.Logger = exports.LogLevel = exports.WaitForUserOperationError = exports.InvalidUserOperationError = exports.TransactionMissingToParamError = exports.FailedToFindTransactionError = exports.InvalidSignerTypeError = exports.InvalidEntryPointError = exports.EntryPointNotFoundError = exports.InvalidRpcUrlError = exports.IncompatibleClientError = void 0;
|
|
29
28
|
exports.chains = __importStar(require("viem/chains"));
|
|
30
29
|
var EntryPointAbi_v6_js_1 = require("./abis/EntryPointAbi_v6.js");
|
|
31
30
|
Object.defineProperty(exports, "EntryPointAbi_v6", { enumerable: true, get: function () { return EntryPointAbi_v6_js_1.EntryPointAbi_v6; } });
|
|
@@ -64,26 +63,6 @@ var sendUserOperation_js_1 = require("./actions/smartAccount/sendUserOperation.j
|
|
|
64
63
|
Object.defineProperty(exports, "sendUserOperation", { enumerable: true, get: function () { return sendUserOperation_js_1.sendUserOperation; } });
|
|
65
64
|
var waitForUserOperationTransacation_js_1 = require("./actions/smartAccount/waitForUserOperationTransacation.js");
|
|
66
65
|
Object.defineProperty(exports, "waitForUserOperationTransaction", { enumerable: true, get: function () { return waitForUserOperationTransacation_js_1.waitForUserOperationTransaction; } });
|
|
67
|
-
var index_js_1 = require("./chains/index.js");
|
|
68
|
-
Object.defineProperty(exports, "arbitrum", { enumerable: true, get: function () { return index_js_1.arbitrum; } });
|
|
69
|
-
Object.defineProperty(exports, "arbitrumGoerli", { enumerable: true, get: function () { return index_js_1.arbitrumGoerli; } });
|
|
70
|
-
Object.defineProperty(exports, "arbitrumSepolia", { enumerable: true, get: function () { return index_js_1.arbitrumSepolia; } });
|
|
71
|
-
Object.defineProperty(exports, "base", { enumerable: true, get: function () { return index_js_1.base; } });
|
|
72
|
-
Object.defineProperty(exports, "baseGoerli", { enumerable: true, get: function () { return index_js_1.baseGoerli; } });
|
|
73
|
-
Object.defineProperty(exports, "baseSepolia", { enumerable: true, get: function () { return index_js_1.baseSepolia; } });
|
|
74
|
-
Object.defineProperty(exports, "fraxtal", { enumerable: true, get: function () { return index_js_1.fraxtal; } });
|
|
75
|
-
Object.defineProperty(exports, "fraxtalSepolia", { enumerable: true, get: function () { return index_js_1.fraxtalSepolia; } });
|
|
76
|
-
Object.defineProperty(exports, "goerli", { enumerable: true, get: function () { return index_js_1.goerli; } });
|
|
77
|
-
Object.defineProperty(exports, "mainnet", { enumerable: true, get: function () { return index_js_1.mainnet; } });
|
|
78
|
-
Object.defineProperty(exports, "optimism", { enumerable: true, get: function () { return index_js_1.optimism; } });
|
|
79
|
-
Object.defineProperty(exports, "optimismGoerli", { enumerable: true, get: function () { return index_js_1.optimismGoerli; } });
|
|
80
|
-
Object.defineProperty(exports, "optimismSepolia", { enumerable: true, get: function () { return index_js_1.optimismSepolia; } });
|
|
81
|
-
Object.defineProperty(exports, "polygon", { enumerable: true, get: function () { return index_js_1.polygon; } });
|
|
82
|
-
Object.defineProperty(exports, "polygonAmoy", { enumerable: true, get: function () { return index_js_1.polygonAmoy; } });
|
|
83
|
-
Object.defineProperty(exports, "polygonMumbai", { enumerable: true, get: function () { return index_js_1.polygonMumbai; } });
|
|
84
|
-
Object.defineProperty(exports, "sepolia", { enumerable: true, get: function () { return index_js_1.sepolia; } });
|
|
85
|
-
Object.defineProperty(exports, "zora", { enumerable: true, get: function () { return index_js_1.zora; } });
|
|
86
|
-
Object.defineProperty(exports, "zoraSepolia", { enumerable: true, get: function () { return index_js_1.zoraSepolia; } });
|
|
87
66
|
var bundlerClient_js_1 = require("./client/bundlerClient.js");
|
|
88
67
|
Object.defineProperty(exports, "createBundlerClient", { enumerable: true, get: function () { return bundlerClient_js_1.createBundlerClient; } });
|
|
89
68
|
Object.defineProperty(exports, "createBundlerClientFromExisting", { enumerable: true, get: function () { return bundlerClient_js_1.createBundlerClientFromExisting; } });
|
|
@@ -103,11 +82,11 @@ var utils_js_1 = require("./ens/utils.js");
|
|
|
103
82
|
Object.defineProperty(exports, "convertChainIdToCoinType", { enumerable: true, get: function () { return utils_js_1.convertChainIdToCoinType; } });
|
|
104
83
|
Object.defineProperty(exports, "convertCoinTypeToChain", { enumerable: true, get: function () { return utils_js_1.convertCoinTypeToChain; } });
|
|
105
84
|
Object.defineProperty(exports, "convertCoinTypeToChainId", { enumerable: true, get: function () { return utils_js_1.convertCoinTypeToChainId; } });
|
|
106
|
-
var
|
|
107
|
-
Object.defineProperty(exports, "defaultEntryPointVersion", { enumerable: true, get: function () { return
|
|
108
|
-
Object.defineProperty(exports, "entryPointRegistry", { enumerable: true, get: function () { return
|
|
109
|
-
Object.defineProperty(exports, "getEntryPoint", { enumerable: true, get: function () { return
|
|
110
|
-
Object.defineProperty(exports, "isEntryPointVersion", { enumerable: true, get: function () { return
|
|
85
|
+
var index_js_1 = require("./entrypoint/index.js");
|
|
86
|
+
Object.defineProperty(exports, "defaultEntryPointVersion", { enumerable: true, get: function () { return index_js_1.defaultEntryPointVersion; } });
|
|
87
|
+
Object.defineProperty(exports, "entryPointRegistry", { enumerable: true, get: function () { return index_js_1.entryPointRegistry; } });
|
|
88
|
+
Object.defineProperty(exports, "getEntryPoint", { enumerable: true, get: function () { return index_js_1.getEntryPoint; } });
|
|
89
|
+
Object.defineProperty(exports, "isEntryPointVersion", { enumerable: true, get: function () { return index_js_1.isEntryPointVersion; } });
|
|
111
90
|
var account_js_1 = require("./errors/account.js");
|
|
112
91
|
Object.defineProperty(exports, "AccountNotFoundError", { enumerable: true, get: function () { return account_js_1.AccountNotFoundError; } });
|
|
113
92
|
Object.defineProperty(exports, "AccountRequiresOwnerError", { enumerable: true, get: function () { return account_js_1.AccountRequiresOwnerError; } });
|
|
@@ -163,34 +142,32 @@ var wallet_client_js_1 = require("./signer/wallet-client.js");
|
|
|
163
142
|
Object.defineProperty(exports, "WalletClientSigner", { enumerable: true, get: function () { return wallet_client_js_1.WalletClientSigner; } });
|
|
164
143
|
var split_js_1 = require("./transport/split.js");
|
|
165
144
|
Object.defineProperty(exports, "split", { enumerable: true, get: function () { return split_js_1.split; } });
|
|
166
|
-
var
|
|
167
|
-
Object.defineProperty(exports, "
|
|
168
|
-
Object.defineProperty(exports, "
|
|
169
|
-
Object.defineProperty(exports, "
|
|
170
|
-
Object.defineProperty(exports, "
|
|
171
|
-
Object.defineProperty(exports, "
|
|
172
|
-
Object.defineProperty(exports, "
|
|
173
|
-
Object.defineProperty(exports, "
|
|
174
|
-
Object.defineProperty(exports, "
|
|
175
|
-
Object.defineProperty(exports, "
|
|
176
|
-
Object.defineProperty(exports, "
|
|
177
|
-
Object.defineProperty(exports, "
|
|
178
|
-
Object.defineProperty(exports, "
|
|
179
|
-
Object.defineProperty(exports, "
|
|
180
|
-
Object.defineProperty(exports, "
|
|
181
|
-
Object.defineProperty(exports, "
|
|
182
|
-
Object.defineProperty(exports, "
|
|
183
|
-
Object.defineProperty(exports, "
|
|
184
|
-
Object.defineProperty(exports, "
|
|
185
|
-
Object.defineProperty(exports, "
|
|
186
|
-
Object.defineProperty(exports, "
|
|
187
|
-
Object.defineProperty(exports, "
|
|
188
|
-
Object.defineProperty(exports, "
|
|
189
|
-
Object.defineProperty(exports, "
|
|
190
|
-
Object.defineProperty(exports, "
|
|
191
|
-
Object.defineProperty(exports, "
|
|
192
|
-
Object.defineProperty(exports, "
|
|
193
|
-
Object.defineProperty(exports, "
|
|
194
|
-
Object.defineProperty(exports, "takeBytes", { enumerable: true, get: function () { return index_js_3.takeBytes; } });
|
|
195
|
-
Object.defineProperty(exports, "toRecord", { enumerable: true, get: function () { return index_js_3.toRecord; } });
|
|
145
|
+
var index_js_2 = require("./utils/index.js");
|
|
146
|
+
Object.defineProperty(exports, "BigNumberishRangeSchema", { enumerable: true, get: function () { return index_js_2.BigNumberishRangeSchema; } });
|
|
147
|
+
Object.defineProperty(exports, "BigNumberishSchema", { enumerable: true, get: function () { return index_js_2.BigNumberishSchema; } });
|
|
148
|
+
Object.defineProperty(exports, "ChainSchema", { enumerable: true, get: function () { return index_js_2.ChainSchema; } });
|
|
149
|
+
Object.defineProperty(exports, "HexSchema", { enumerable: true, get: function () { return index_js_2.HexSchema; } });
|
|
150
|
+
Object.defineProperty(exports, "MultiplierSchema", { enumerable: true, get: function () { return index_js_2.MultiplierSchema; } });
|
|
151
|
+
Object.defineProperty(exports, "allEqual", { enumerable: true, get: function () { return index_js_2.allEqual; } });
|
|
152
|
+
Object.defineProperty(exports, "applyUserOpFeeOption", { enumerable: true, get: function () { return index_js_2.applyUserOpFeeOption; } });
|
|
153
|
+
Object.defineProperty(exports, "applyUserOpOverride", { enumerable: true, get: function () { return index_js_2.applyUserOpOverride; } });
|
|
154
|
+
Object.defineProperty(exports, "applyUserOpOverrideOrFeeOption", { enumerable: true, get: function () { return index_js_2.applyUserOpOverrideOrFeeOption; } });
|
|
155
|
+
Object.defineProperty(exports, "asyncPipe", { enumerable: true, get: function () { return index_js_2.asyncPipe; } });
|
|
156
|
+
Object.defineProperty(exports, "bigIntMax", { enumerable: true, get: function () { return index_js_2.bigIntMax; } });
|
|
157
|
+
Object.defineProperty(exports, "bigIntMultiply", { enumerable: true, get: function () { return index_js_2.bigIntMultiply; } });
|
|
158
|
+
Object.defineProperty(exports, "bypassPaymasterAndData", { enumerable: true, get: function () { return index_js_2.bypassPaymasterAndData; } });
|
|
159
|
+
Object.defineProperty(exports, "bypassPaymasterAndDataEmptyHex", { enumerable: true, get: function () { return index_js_2.bypassPaymasterAndDataEmptyHex; } });
|
|
160
|
+
Object.defineProperty(exports, "concatPaymasterAndData", { enumerable: true, get: function () { return index_js_2.concatPaymasterAndData; } });
|
|
161
|
+
Object.defineProperty(exports, "deepHexlify", { enumerable: true, get: function () { return index_js_2.deepHexlify; } });
|
|
162
|
+
Object.defineProperty(exports, "filterUndefined", { enumerable: true, get: function () { return index_js_2.filterUndefined; } });
|
|
163
|
+
Object.defineProperty(exports, "getDefaultSimpleAccountFactoryAddress", { enumerable: true, get: function () { return index_js_2.getDefaultSimpleAccountFactoryAddress; } });
|
|
164
|
+
Object.defineProperty(exports, "getDefaultUserOperationFeeOptions", { enumerable: true, get: function () { return index_js_2.getDefaultUserOperationFeeOptions; } });
|
|
165
|
+
Object.defineProperty(exports, "isBigNumberish", { enumerable: true, get: function () { return index_js_2.isBigNumberish; } });
|
|
166
|
+
Object.defineProperty(exports, "isMultiplier", { enumerable: true, get: function () { return index_js_2.isMultiplier; } });
|
|
167
|
+
Object.defineProperty(exports, "isValidRequest", { enumerable: true, get: function () { return index_js_2.isValidRequest; } });
|
|
168
|
+
Object.defineProperty(exports, "parsePaymasterAndData", { enumerable: true, get: function () { return index_js_2.parsePaymasterAndData; } });
|
|
169
|
+
Object.defineProperty(exports, "pick", { enumerable: true, get: function () { return index_js_2.pick; } });
|
|
170
|
+
Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function () { return index_js_2.resolveProperties; } });
|
|
171
|
+
Object.defineProperty(exports, "takeBytes", { enumerable: true, get: function () { return index_js_2.takeBytes; } });
|
|
172
|
+
Object.defineProperty(exports, "toRecord", { enumerable: true, get: function () { return index_js_2.toRecord; } });
|
|
196
173
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,sDAAsC;AAEtC,kEAA8D;AAArD,uHAAA,gBAAgB,OAAA;AACzB,kEAA8D;AAArD,uHAAA,gBAAgB,OAAA;AACzB,wEAAoE;AAA3D,6HAAA,mBAAmB,OAAA;AAC5B,wEAAoE;AAA3D,6HAAA,mBAAmB,OAAA;AAC5B,gFAA4E;AAAnE,qIAAA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A/D,iGAAA,KAAK,OAAA;AAGd,6CA4B0B;AA3BxB,mHAAA,uBAAuB,OAAA;AACvB,8GAAA,kBAAkB,OAAA;AAClB,uGAAA,WAAW,OAAA;AACX,qGAAA,SAAS,OAAA;AACT,4GAAA,gBAAgB,OAAA;AAChB,oGAAA,QAAQ,OAAA;AACR,gHAAA,oBAAoB,OAAA;AACpB,+GAAA,mBAAmB,OAAA;AACnB,0HAAA,8BAA8B,OAAA;AAC9B,qGAAA,SAAS,OAAA;AACT,qGAAA,SAAS,OAAA;AACT,0GAAA,cAAc,OAAA;AACd,kHAAA,sBAAsB,OAAA;AACtB,0HAAA,8BAA8B,OAAA;AAC9B,kHAAA,sBAAsB,OAAA;AACtB,uGAAA,WAAW,OAAA;AACX,2GAAA,eAAe,OAAA;AACf,iIAAA,qCAAqC,OAAA;AACrC,6HAAA,iCAAiC,OAAA;AACjC,0GAAA,cAAc,OAAA;AACd,wGAAA,YAAY,OAAA;AACZ,0GAAA,cAAc,OAAA;AACd,iHAAA,qBAAqB,OAAA;AACrB,gGAAA,IAAI,OAAA;AACJ,6GAAA,iBAAiB,OAAA;AACjB,qGAAA,SAAS,OAAA;AACT,oGAAA,QAAQ,OAAA","sourcesContent":["export type { Abi } from \"abitype\";\nexport type { Address, HttpTransport } from \"viem\";\nexport * as chains from \"viem/chains\";\n\nexport { EntryPointAbi_v6 } from \"./abis/EntryPointAbi_v6.js\";\nexport { EntryPointAbi_v7 } from \"./abis/EntryPointAbi_v7.js\";\nexport { SimpleAccountAbi_v6 } from \"./abis/SimpleAccountAbi_v6.js\";\nexport { SimpleAccountAbi_v7 } from \"./abis/SimpleAccountAbi_v7.js\";\nexport { SimpleAccountFactoryAbi } from \"./abis/SimpleAccountFactoryAbi.js\";\nexport { BaseSmartContractAccount } from \"./account/base.js\";\nexport { createSimpleSmartAccount } from \"./account/simple.js\";\nexport type { SimpleSmartAccount } from \"./account/simple.js\";\nexport type * from \"./account/smartContractAccount.js\";\nexport {\n getAccountAddress,\n isSmartAccountWithSigner,\n parseFactoryAddressFromAccountInitCode,\n toSmartContractAccount,\n} from \"./account/smartContractAccount.js\";\nexport type {\n BaseSmartAccountParams,\n SignTypedDataParams,\n} from \"./account/types.js\";\nexport { buildUserOperation } from \"./actions/smartAccount/buildUserOperation.js\";\nexport { buildUserOperationFromTx } from \"./actions/smartAccount/buildUserOperationFromTx.js\";\nexport { buildUserOperationFromTxs } from \"./actions/smartAccount/buildUserOperationFromTxs.js\";\nexport { checkGasSponsorshipEligibility } from \"./actions/smartAccount/checkGasSponsorshipEligibility.js\";\nexport { dropAndReplaceUserOperation } from \"./actions/smartAccount/dropAndReplaceUserOperation.js\";\nexport { sendTransaction } from \"./actions/smartAccount/sendTransaction.js\";\nexport { sendTransactions } from \"./actions/smartAccount/sendTransactions.js\";\nexport { sendUserOperation } from \"./actions/smartAccount/sendUserOperation.js\";\nexport type * from \"./actions/smartAccount/types.js\";\nexport { waitForUserOperationTransaction } from \"./actions/smartAccount/waitForUserOperationTransacation.js\";\nexport type * from \"./client/bundlerClient.js\";\nexport {\n createBundlerClient,\n createBundlerClientFromExisting,\n} from \"./client/bundlerClient.js\";\nexport type * from \"./client/decorators/bundlerClient.js\";\nexport { bundlerActions } from \"./client/decorators/bundlerClient.js\";\nexport type * from \"./client/decorators/smartAccountClient.js\";\nexport { smartAccountClientActions } from \"./client/decorators/smartAccountClient.js\";\nexport { isSmartAccountClient } from \"./client/isSmartAccountClient.js\";\nexport {\n ConnectionConfigSchema,\n SmartAccountClientOptsSchema,\n} from \"./client/schema.js\";\nexport type * from \"./client/smartAccountClient.js\";\nexport {\n createSmartAccountClient,\n createSmartAccountClientFromExisting,\n} from \"./client/smartAccountClient.js\";\nexport type * from \"./client/types.js\";\nexport {\n convertChainIdToCoinType,\n convertCoinTypeToChain,\n convertCoinTypeToChainId,\n} from \"./ens/utils.js\";\nexport {\n defaultEntryPointVersion,\n entryPointRegistry,\n getEntryPoint,\n isEntryPointVersion,\n} from \"./entrypoint/index.js\";\nexport type * from \"./entrypoint/types.js\";\nexport {\n AccountNotFoundError,\n AccountRequiresOwnerError,\n BatchExecutionNotSupportedError,\n DefaultFactoryNotDefinedError,\n FailedToGetStorageSlotError,\n GetCounterFactualAddressError,\n IncorrectAccountType,\n SignTransactionNotSupportedError,\n SmartAccountWithSignerRequiredError,\n UpgradeToAndCallNotSupportedError,\n UpgradesNotSupportedError,\n} from \"./errors/account.js\";\nexport { BaseError } from \"./errors/base.js\";\nexport {\n ChainNotFoundError,\n IncompatibleClientError,\n InvalidRpcUrlError,\n} from \"./errors/client.js\";\nexport {\n EntryPointNotFoundError,\n InvalidEntryPointError,\n} from \"./errors/entrypoint.js\";\nexport { InvalidSignerTypeError } from \"./errors/signer.js\";\nexport {\n FailedToFindTransactionError,\n TransactionMissingToParamError,\n} from \"./errors/transaction.js\";\nexport {\n InvalidUserOperationError,\n WaitForUserOperationError,\n} from \"./errors/useroperation.js\";\nexport { LogLevel, Logger } from \"./logger.js\";\nexport { middlewareActions } from \"./middleware/actions.js\";\nexport { defaultFeeEstimator } from \"./middleware/defaults/feeEstimator.js\";\nexport { defaultGasEstimator } from \"./middleware/defaults/gasEstimator.js\";\nexport { defaultPaymasterAndData } from \"./middleware/defaults/paymasterAndData.js\";\nexport { defaultUserOpSigner } from \"./middleware/defaults/userOpSigner.js\";\nexport { noopMiddleware } from \"./middleware/noopMiddleware.js\";\nexport type * from \"./middleware/types.js\";\nexport { LocalAccountSigner } from \"./signer/local-account.js\";\nexport { SignerSchema, isSigner } from \"./signer/schema.js\";\nexport type {\n SmartAccountAuthenticator,\n SmartAccountSigner,\n} from \"./signer/types.js\";\nexport { wrapSignatureWith6492 } from \"./signer/utils.js\";\nexport { WalletClientSigner } from \"./signer/wallet-client.js\";\nexport { split, type SplitTransportParams } from \"./transport/split.js\";\nexport type * from \"./types.js\";\nexport type * from \"./utils/index.js\";\nexport {\n BigNumberishRangeSchema,\n BigNumberishSchema,\n ChainSchema,\n HexSchema,\n MultiplierSchema,\n allEqual,\n applyUserOpFeeOption,\n applyUserOpOverride,\n applyUserOpOverrideOrFeeOption,\n asyncPipe,\n bigIntMax,\n bigIntMultiply,\n bypassPaymasterAndData,\n bypassPaymasterAndDataEmptyHex,\n concatPaymasterAndData,\n deepHexlify,\n filterUndefined,\n getDefaultSimpleAccountFactoryAddress,\n getDefaultUserOperationFeeOptions,\n isBigNumberish,\n isMultiplier,\n isValidRequest,\n parsePaymasterAndData,\n pick,\n resolveProperties,\n takeBytes,\n toRecord,\n} from \"./utils/index.js\";\n"]}
|
|
@@ -32,13 +32,13 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
32
32
|
[x: `bytes9[${string}]`]: undefined;
|
|
33
33
|
[x: `bytes10[${string}]`]: undefined;
|
|
34
34
|
[x: `bytes25[${string}]`]: undefined;
|
|
35
|
-
[x: `bytes18[${string}]`]: undefined;
|
|
36
35
|
[x: `bytes12[${string}]`]: undefined;
|
|
37
36
|
[x: `bytes13[${string}]`]: undefined;
|
|
38
37
|
[x: `bytes14[${string}]`]: undefined;
|
|
39
38
|
[x: `bytes15[${string}]`]: undefined;
|
|
40
39
|
[x: `bytes16[${string}]`]: undefined;
|
|
41
40
|
[x: `bytes17[${string}]`]: undefined;
|
|
41
|
+
[x: `bytes18[${string}]`]: undefined;
|
|
42
42
|
[x: `bytes19[${string}]`]: undefined;
|
|
43
43
|
[x: `bytes20[${string}]`]: undefined;
|
|
44
44
|
[x: `bytes21[${string}]`]: undefined;
|
|
@@ -134,13 +134,13 @@ export declare class LocalAccountSigner<T extends HDAccount | PrivateKeyAccount
|
|
|
134
134
|
bytes9?: undefined;
|
|
135
135
|
bytes10?: undefined;
|
|
136
136
|
bytes25?: undefined;
|
|
137
|
-
bytes18?: undefined;
|
|
138
137
|
bytes12?: undefined;
|
|
139
138
|
bytes13?: undefined;
|
|
140
139
|
bytes14?: undefined;
|
|
141
140
|
bytes15?: undefined;
|
|
142
141
|
bytes16?: undefined;
|
|
143
142
|
bytes17?: undefined;
|
|
143
|
+
bytes18?: undefined;
|
|
144
144
|
bytes19?: undefined;
|
|
145
145
|
bytes20?: undefined;
|
|
146
146
|
bytes21?: undefined;
|
|
@@ -33,13 +33,13 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
|
|
|
33
33
|
[x: `bytes9[${string}]`]: undefined;
|
|
34
34
|
[x: `bytes10[${string}]`]: undefined;
|
|
35
35
|
[x: `bytes25[${string}]`]: undefined;
|
|
36
|
-
[x: `bytes18[${string}]`]: undefined;
|
|
37
36
|
[x: `bytes12[${string}]`]: undefined;
|
|
38
37
|
[x: `bytes13[${string}]`]: undefined;
|
|
39
38
|
[x: `bytes14[${string}]`]: undefined;
|
|
40
39
|
[x: `bytes15[${string}]`]: undefined;
|
|
41
40
|
[x: `bytes16[${string}]`]: undefined;
|
|
42
41
|
[x: `bytes17[${string}]`]: undefined;
|
|
42
|
+
[x: `bytes18[${string}]`]: undefined;
|
|
43
43
|
[x: `bytes19[${string}]`]: undefined;
|
|
44
44
|
[x: `bytes20[${string}]`]: undefined;
|
|
45
45
|
[x: `bytes21[${string}]`]: undefined;
|
|
@@ -135,13 +135,13 @@ export declare class WalletClientSigner implements SmartAccountSigner<WalletClie
|
|
|
135
135
|
bytes9?: undefined;
|
|
136
136
|
bytes10?: undefined;
|
|
137
137
|
bytes25?: undefined;
|
|
138
|
-
bytes18?: undefined;
|
|
139
138
|
bytes12?: undefined;
|
|
140
139
|
bytes13?: undefined;
|
|
141
140
|
bytes14?: undefined;
|
|
142
141
|
bytes15?: undefined;
|
|
143
142
|
bytes16?: undefined;
|
|
144
143
|
bytes17?: undefined;
|
|
144
|
+
bytes18?: undefined;
|
|
145
145
|
bytes19?: undefined;
|
|
146
146
|
bytes20?: undefined;
|
|
147
147
|
bytes21?: undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address, type Chain } from "viem";
|
|
2
2
|
import type { EntryPointVersion } from "../entrypoint/types.js";
|
|
3
|
-
import type { UserOperationFeeOptions } from "../types";
|
|
3
|
+
import type { UserOperationFeeOptions } from "../types.js";
|
|
4
4
|
export declare const getDefaultSimpleAccountFactoryAddress: (chain: Chain, version?: EntryPointVersion) => Address;
|
|
5
5
|
export declare const minPriorityFeePerBidDefaults: Map<number, bigint>;
|
|
6
6
|
export declare const getDefaultUserOperationFeeOptions: (chain: Chain) => UserOperationFeeOptions;
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefaultUserOperationFeeOptions = exports.minPriorityFeePerBidDefaults = exports.getDefaultSimpleAccountFactoryAddress = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const chains_1 = require("viem/chains");
|
|
5
|
+
const index_js_1 = require("../entrypoint/index.js");
|
|
6
6
|
const account_js_1 = require("../errors/account.js");
|
|
7
|
-
const getDefaultSimpleAccountFactoryAddress = (chain, version =
|
|
7
|
+
const getDefaultSimpleAccountFactoryAddress = (chain, version = index_js_1.defaultEntryPointVersion) => {
|
|
8
8
|
switch (version) {
|
|
9
9
|
case "0.6.0":
|
|
10
10
|
switch (chain.id) {
|
|
11
|
-
case
|
|
12
|
-
case
|
|
13
|
-
case
|
|
14
|
-
case
|
|
15
|
-
case
|
|
16
|
-
case
|
|
17
|
-
case
|
|
18
|
-
case
|
|
19
|
-
case
|
|
20
|
-
case
|
|
21
|
-
case
|
|
22
|
-
case
|
|
23
|
-
case
|
|
24
|
-
case
|
|
11
|
+
case chains_1.mainnet.id:
|
|
12
|
+
case chains_1.polygon.id:
|
|
13
|
+
case chains_1.polygonAmoy.id:
|
|
14
|
+
case chains_1.optimism.id:
|
|
15
|
+
case chains_1.optimismSepolia.id:
|
|
16
|
+
case chains_1.arbitrum.id:
|
|
17
|
+
case chains_1.arbitrumSepolia.id:
|
|
18
|
+
case chains_1.base.id:
|
|
19
|
+
case chains_1.baseGoerli.id:
|
|
20
|
+
case chains_1.baseSepolia.id:
|
|
21
|
+
case chains_1.fraxtal.id:
|
|
22
|
+
case 2523:
|
|
23
|
+
case chains_1.zora.id:
|
|
24
|
+
case chains_1.zoraSepolia.id:
|
|
25
25
|
return "0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232";
|
|
26
|
-
case
|
|
27
|
-
case
|
|
28
|
-
case
|
|
29
|
-
case
|
|
30
|
-
case
|
|
26
|
+
case chains_1.sepolia.id:
|
|
27
|
+
case chains_1.goerli.id:
|
|
28
|
+
case chains_1.polygonMumbai.id:
|
|
29
|
+
case chains_1.optimismGoerli.id:
|
|
30
|
+
case chains_1.arbitrumGoerli.id:
|
|
31
31
|
return "0x9406Cc6185a346906296840746125a0E44976454";
|
|
32
32
|
default:
|
|
33
33
|
break;
|
|
@@ -43,9 +43,9 @@ const getDefaultSimpleAccountFactoryAddress = (chain, version = index_js_2.defau
|
|
|
43
43
|
};
|
|
44
44
|
exports.getDefaultSimpleAccountFactoryAddress = getDefaultSimpleAccountFactoryAddress;
|
|
45
45
|
exports.minPriorityFeePerBidDefaults = new Map([
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
46
|
+
[chains_1.arbitrum.id, 10000000n],
|
|
47
|
+
[chains_1.arbitrumGoerli.id, 10000000n],
|
|
48
|
+
[chains_1.arbitrumSepolia.id, 10000000n],
|
|
49
49
|
]);
|
|
50
50
|
const getDefaultUserOperationFeeOptions = (chain) => {
|
|
51
51
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../src/utils/defaults.ts"],"names":[],"mappings":";;;AACA,wCAmBqB;AACrB,qDAAkE;AAElE,qDAAqE;AAW9D,MAAM,qCAAqC,GAAG,CACnD,KAAY,EACZ,UAA6B,mCAAwB,EAC5C,EAAE;IACX,QAAQ,OAA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EAAE,EAAE,SAAW,CAAC;IAChC,CAAC,wBAAe,CAAC,EAAE,EAAE,SAAW,CAAC;CAClC,CAAC,CAAC;AAEI,MAAM,iCAAiC,GAAG,CAC/C,KAAY,EACa,EAAE;IAC3B,OAAO;QACL,oBAAoB,EAAE;YACpB,GAAG,EAAE,oCAA4B,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,UAAY;YAC/D,UAAU,EAAE,IAAI;SACjB;KACF,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,iCAAiC,qCAS5C","sourcesContent":["import { type Address, type Chain } from \"viem\";\nimport {\n arbitrum,\n arbitrumGoerli,\n arbitrumSepolia,\n base,\n baseGoerli,\n baseSepolia,\n fraxtal,\n goerli,\n mainnet,\n optimism,\n optimismGoerli,\n optimismSepolia,\n polygon,\n polygonAmoy,\n polygonMumbai,\n sepolia,\n zora,\n zoraSepolia,\n} from \"viem/chains\";\nimport { defaultEntryPointVersion } from \"../entrypoint/index.js\";\nimport type { EntryPointVersion } from \"../entrypoint/types.js\";\nimport { DefaultFactoryNotDefinedError } from \"../errors/account.js\";\nimport type { UserOperationFeeOptions } from \"../types.js\";\n\n/**\n * Utility method returning the default simple account factory address given a {@link Chain} object\n *\n * @param chain - a {@link Chain} object\n * @param version - {@link EntryPointVersion} value that defaults to `defaultEntryPointVersion`\n * @returns a {@link abi.Address} for the given chain\n * @throws if the chain doesn't have an address currently deployed\n */\nexport const getDefaultSimpleAccountFactoryAddress = (\n chain: Chain,\n version: EntryPointVersion = defaultEntryPointVersion\n): Address => {\n switch (version) {\n case \"0.6.0\":\n switch (chain.id) {\n case mainnet.id:\n case polygon.id:\n case polygonAmoy.id:\n case optimism.id:\n case optimismSepolia.id:\n case arbitrum.id:\n case arbitrumSepolia.id:\n case base.id:\n case baseGoerli.id:\n case baseSepolia.id:\n case fraxtal.id:\n case 2523:\n case zora.id:\n case zoraSepolia.id:\n return \"0x15Ba39375ee2Ab563E8873C8390be6f2E2F50232\";\n case sepolia.id:\n case goerli.id:\n case polygonMumbai.id:\n case optimismGoerli.id:\n case arbitrumGoerli.id:\n return \"0x9406Cc6185a346906296840746125a0E44976454\";\n default:\n break;\n }\n break;\n case \"0.7.0\":\n switch (chain.id) {\n default:\n return \"0x91E60e0613810449d098b0b5Ec8b51A0FE8c8985\";\n }\n }\n\n throw new DefaultFactoryNotDefinedError(\"SimpleAccount\", chain, version);\n};\n\nexport const minPriorityFeePerBidDefaults = new Map<number, bigint>([\n [arbitrum.id, 10_000_000n],\n [arbitrumGoerli.id, 10_000_000n],\n [arbitrumSepolia.id, 10_000_000n],\n]);\n\nexport const getDefaultUserOperationFeeOptions = (\n chain: Chain\n): UserOperationFeeOptions => {\n return {\n maxPriorityFeePerGas: {\n min: minPriorityFeePerBidDefaults.get(chain.id) ?? 100_000_000n,\n multiplier: 1.33,\n },\n };\n};\n"]}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type { Chain } from "viem";
|
|
2
1
|
import type { PromiseOrValue } from "../types.js";
|
|
3
2
|
import type { RecordableKeys } from "./types.js";
|
|
4
|
-
export declare const AlchemyChainMap: Map<number, Chain>;
|
|
5
|
-
export declare const getChain: (chainId: number) => Chain;
|
|
6
3
|
export declare const asyncPipe: <S, O, F>(...fns: ((s: S, o?: O | undefined, f?: F | undefined) => Promise<S>)[]) => (s: S, o?: O | undefined, f?: F | undefined) => Promise<S>;
|
|
7
4
|
export type Deferrable<T> = {
|
|
8
5
|
[K in keyof T]: PromiseOrValue<T[K]>;
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -10,36 +10,12 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
15
|
};
|
|
28
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.toRecord = exports.conditionalReturn = exports.allEqual = exports.pick = exports.filterUndefined = exports.deepHexlify = exports.resolveProperties = exports.asyncPipe =
|
|
17
|
+
exports.toRecord = exports.conditionalReturn = exports.allEqual = exports.pick = exports.filterUndefined = exports.deepHexlify = exports.resolveProperties = exports.asyncPipe = void 0;
|
|
30
18
|
const viem_1 = require("viem");
|
|
31
|
-
const chains = __importStar(require("viem/chains"));
|
|
32
|
-
const alchemyChains = __importStar(require("../chains/index.js"));
|
|
33
|
-
exports.AlchemyChainMap = new Map(Object.values(alchemyChains).map((c) => [c.id, c]));
|
|
34
|
-
const getChain = (chainId) => {
|
|
35
|
-
for (const chain of Object.values(chains)) {
|
|
36
|
-
if (chain.id === chainId) {
|
|
37
|
-
return exports.AlchemyChainMap.get(chain.id) ?? chain;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
throw new Error("could not find chain");
|
|
41
|
-
};
|
|
42
|
-
exports.getChain = getChain;
|
|
43
19
|
const asyncPipe = (...fns) => async (s, o, f) => {
|
|
44
20
|
let result = s;
|
|
45
21
|
for (const fn of fns) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"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QAAQ,YAKnB;AASK,MAAM,iBAAiB,GAAG,CAC/B,SAA2B,EAC3B,KAAuB,EACC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAHjE,QAAA,iBAAiB,qBAGgD;AAsBvE,MAAM,QAAQ,GAAG,CAKtB,KAAU,EACV,QAAW,EACX,EAAkB,EACD,EAAE,CACnB,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IACzB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAqB,CAAC,CAAC;AAZf,QAAA,QAAQ,YAYO;AAE5B,8CAA4B;AAC5B,6CAA2B;AAC3B,gDAA8B;AAC9B,8CAA4B;AAE5B,8CAA4B","sourcesContent":["import type { Chain } from \"viem\";\nimport { toHex } from \"viem\";\nimport * as chains from \"viem/chains\";\nimport * as alchemyChains from \"../chains/index.js\";\nimport type { PromiseOrValue } from \"../types.js\";\nimport type { RecordableKeys } from \"./types.js\";\n\nexport const AlchemyChainMap = new Map<number, Chain>(\n Object.values(alchemyChains).map((c) => [c.id, c])\n);\n\n/**\n * Utility method for converting a chainId to a {@link Chain} object\n *\n * @param chainId - the chainId to convert\n * @returns a {@link Chain} object for the given chainId\n * @throws if the chainId is not found\n */\nexport const getChain = (chainId: number): Chain => {\n for (const chain of Object.values(chains)) {\n if (chain.id === chainId) {\n return AlchemyChainMap.get(chain.id) ?? chain;\n }\n }\n throw new Error(\"could not find chain\");\n};\n\n/**\n * Utility function that allows for piping a series of async functions together\n *\n * @param fns - functions to pipe\n * @returns result of the pipe\n */\nexport const asyncPipe =\n <S, O, F>(...fns: ((s: S, o?: O, f?: F) => Promise<S>)[]) =>\n async (s: S, o?: O, f?: F) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, o, f);\n }\n return result;\n };\n\n// based on @ethersproject/properties, but pulled in here to minize the dependency on ethers\nexport type Deferrable<T> = {\n [K in keyof T]: PromiseOrValue<T[K]>;\n};\n\n/**\n * Await all of the properties of a {@link Deferrable} object\n *\n * @param object - a {@link Deferrable} object\n * @returns the object with its properties resolved\n */\nexport async function resolveProperties<T>(object: Deferrable<T>): Promise<T> {\n const promises = Object.keys(object).map((key) => {\n const value = object[key as keyof Deferrable<T>];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n\n const results = await Promise.all(promises);\n\n return filterUndefined<T>(\n results.reduce((accum, curr) => {\n accum[curr.key as keyof T] = curr.value;\n return accum;\n }, {} as T)\n );\n}\n\n/**\n * Recursively converts all values in an object to hex strings\n *\n * @param obj - obj to deep hexlify\n * @returns object with all of its values hexlified\n */\nexport function deepHexlify(obj: any): any {\n if (typeof obj === \"function\") {\n return undefined;\n }\n if (obj == null || typeof obj === \"string\" || typeof obj === \"boolean\") {\n return obj;\n } else if (typeof obj === \"bigint\") {\n return toHex(obj);\n } else if (obj._isBigNumber != null || typeof obj !== \"object\") {\n return toHex(obj).replace(/^0x0/, \"0x\");\n }\n if (Array.isArray(obj)) {\n return obj.map((member) => deepHexlify(member));\n }\n return Object.keys(obj).reduce(\n (set, key) => ({\n ...set,\n [key]: deepHexlify(obj[key]),\n }),\n {}\n );\n}\n\n/**\n * Filters out properties with undefined or null values from the provided object.\n *\n * @example\n * ```ts\n * import { filterUndefined } from \"@aa-sdk/core\";\n *\n * const result = filterUndefined({\n * foo: undefined,\n * bar: null,\n * baz: \"baz\",\n * }); // { baz: \"baz\" }\n * ```\n *\n * @param {T} obj the object from which to remove properties with undefined or null values\n * @returns {T} the object with undefined or null properties removed\n */\nexport function filterUndefined<T>(obj: T): T {\n for (const key in obj) {\n if (obj[key] == null) {\n delete obj[key];\n }\n }\n return obj as T;\n}\n\n/**\n * Picks the specified keys from an object and returns a new object containing only those key-value pairs.\n *\n * @example\n * ```ts\n * import { pick } from \"@aa-sdk/core\";\n *\n * const picked = pick({\n * foo: \"foo\",\n * bar: \"bar\",\n * }, [\"foo\"]); // { foo: \"foo\" }\n * ```\n *\n * @param {Record<string, unknown>} obj The object from which to pick keys\n * @param {string|string[]} keys A single key or an array of keys to pick from the object\n * @returns {Record<string, unknown>} A new object containing only the picked key-value pairs\n */\nexport function pick(obj: Record<string, unknown>, keys: string | string[]) {\n return Object.keys(obj)\n .filter((k) => keys.includes(k))\n .reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});\n}\n\n/**\n * Utility method for checking if the passed in values are all equal (strictly)\n *\n * @param params - values to check\n * @returns a boolean indicating if all values are the same\n * @throws if no values are passed in\n */\nexport const allEqual = (...params: any[]): boolean => {\n if (params.length === 0) {\n throw new Error(\"no values passed in\");\n }\n return params.every((v) => v === params[0]);\n};\n\n/**\n * Utility method for checking the condition and return the value if condition holds true, undefined if not.\n *\n * @param condition - condition to check\n * @param value - value to return when condition holds true\n * @returns the value if condition holds true, undefined if not\n */\nexport const conditionalReturn = <T>(\n condition: Promise<boolean>,\n value: () => Promise<T>\n): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));\n\n/**\n * Converts an array of objects into a record (object) where each key is determined by the specified selector and the value is determined by the provided function.\n *\n * @example\n * ```ts\n * import { toRecord } from \"@aa-sdk/core\";\n * import { sepolia, mainnet } from \"viem/chains\";\n *\n * const addressesByChain = toRecord(\n * [sepolia, mainnet],\n * \"id\",\n * () => \"0x...\"\n * ); // { [sepolia.id]: \"0x...\", [mainnet.id]: \"0x...\" }\n * ```\n *\n * @param {T[]} array The array of objects to convert to a record\n * @param {K} selector The key used to select the property that will become the record's key\n * @param {(item: T) => V} fn The function that transforms each item in the array into the record's value\n * @returns {Record<T[K], V>} The resulting record object\n */\nexport const toRecord = <\n T extends { [K in RecordableKeys<T>]: string | number | symbol },\n K extends RecordableKeys<T>,\n V\n>(\n array: T[],\n selector: K,\n fn: (item: T) => V\n): Record<T[K], V> =>\n array.reduce((acc, item) => {\n acc[item[selector]] = fn(item);\n return acc;\n }, {} as Record<T[K], V>);\n\nexport * from \"./bigint.js\";\nexport * from \"./bytes.js\";\nexport * from \"./defaults.js\";\nexport * from \"./schema.js\";\nexport type * from \"./types.js\";\nexport * from \"./userop.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAA6B;AAUtB,MAAM,SAAS,GACpB,CAAU,GAAG,GAA2C,EAAE,EAAE,CAC5D,KAAK,EAAE,CAAI,EAAE,CAAK,EAAE,CAAK,EAAE,EAAE;IAC3B,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;QACrB,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARS,QAAA,SAAS,aAQlB;AAaG,KAAK,UAAU,iBAAiB,CAAI,MAAqB;IAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,GAA0B,CAAC,CAAC;QACjD,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAE5C,OAAO,eAAe,CACpB,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK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B,EACD,EAAE,CACnB,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;IACzB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC,EAAE,EAAqB,CAAC,CAAC;AAZf,QAAA,QAAQ,YAYO;AAE5B,8CAA4B;AAC5B,6CAA2B;AAC3B,gDAA8B;AAC9B,8CAA4B;AAE5B,8CAA4B","sourcesContent":["import { toHex } from \"viem\";\nimport type { PromiseOrValue } from \"../types.js\";\nimport type { RecordableKeys } from \"./types.js\";\n\n/**\n * Utility function that allows for piping a series of async functions together\n *\n * @param fns - functions to pipe\n * @returns result of the pipe\n */\nexport const asyncPipe =\n <S, O, F>(...fns: ((s: S, o?: O, f?: F) => Promise<S>)[]) =>\n async (s: S, o?: O, f?: F) => {\n let result = s;\n for (const fn of fns) {\n result = await fn(result, o, f);\n }\n return result;\n };\n\n// based on @ethersproject/properties, but pulled in here to minize the dependency on ethers\nexport type Deferrable<T> = {\n [K in keyof T]: PromiseOrValue<T[K]>;\n};\n\n/**\n * Await all of the properties of a {@link Deferrable} object\n *\n * @param object - a {@link Deferrable} object\n * @returns the object with its properties resolved\n */\nexport async function resolveProperties<T>(object: Deferrable<T>): Promise<T> {\n const promises = Object.keys(object).map((key) => {\n const value = object[key as keyof Deferrable<T>];\n return Promise.resolve(value).then((v) => ({ key: key, value: v }));\n });\n\n const results = await Promise.all(promises);\n\n return filterUndefined<T>(\n results.reduce((accum, curr) => {\n accum[curr.key as keyof T] = curr.value;\n return accum;\n }, {} as T)\n );\n}\n\n/**\n * Recursively converts all values in an object to hex strings\n *\n * @param obj - obj to deep hexlify\n * @returns object with all of its values hexlified\n */\nexport function deepHexlify(obj: any): any {\n if (typeof obj === \"function\") {\n return undefined;\n }\n if (obj == null || typeof obj === \"string\" || typeof obj === \"boolean\") {\n return obj;\n } else if (typeof obj === \"bigint\") {\n return toHex(obj);\n } else if (obj._isBigNumber != null || typeof obj !== \"object\") {\n return toHex(obj).replace(/^0x0/, \"0x\");\n }\n if (Array.isArray(obj)) {\n return obj.map((member) => deepHexlify(member));\n }\n return Object.keys(obj).reduce(\n (set, key) => ({\n ...set,\n [key]: deepHexlify(obj[key]),\n }),\n {}\n );\n}\n\n/**\n * Filters out properties with undefined or null values from the provided object.\n *\n * @example\n * ```ts\n * import { filterUndefined } from \"@aa-sdk/core\";\n *\n * const result = filterUndefined({\n * foo: undefined,\n * bar: null,\n * baz: \"baz\",\n * }); // { baz: \"baz\" }\n * ```\n *\n * @param {T} obj the object from which to remove properties with undefined or null values\n * @returns {T} the object with undefined or null properties removed\n */\nexport function filterUndefined<T>(obj: T): T {\n for (const key in obj) {\n if (obj[key] == null) {\n delete obj[key];\n }\n }\n return obj as T;\n}\n\n/**\n * Picks the specified keys from an object and returns a new object containing only those key-value pairs.\n *\n * @example\n * ```ts\n * import { pick } from \"@aa-sdk/core\";\n *\n * const picked = pick({\n * foo: \"foo\",\n * bar: \"bar\",\n * }, [\"foo\"]); // { foo: \"foo\" }\n * ```\n *\n * @param {Record<string, unknown>} obj The object from which to pick keys\n * @param {string|string[]} keys A single key or an array of keys to pick from the object\n * @returns {Record<string, unknown>} A new object containing only the picked key-value pairs\n */\nexport function pick(obj: Record<string, unknown>, keys: string | string[]) {\n return Object.keys(obj)\n .filter((k) => keys.includes(k))\n .reduce((res, k) => Object.assign(res, { [k]: obj[k] }), {});\n}\n\n/**\n * Utility method for checking if the passed in values are all equal (strictly)\n *\n * @param params - values to check\n * @returns a boolean indicating if all values are the same\n * @throws if no values are passed in\n */\nexport const allEqual = (...params: any[]): boolean => {\n if (params.length === 0) {\n throw new Error(\"no values passed in\");\n }\n return params.every((v) => v === params[0]);\n};\n\n/**\n * Utility method for checking the condition and return the value if condition holds true, undefined if not.\n *\n * @param condition - condition to check\n * @param value - value to return when condition holds true\n * @returns the value if condition holds true, undefined if not\n */\nexport const conditionalReturn = <T>(\n condition: Promise<boolean>,\n value: () => Promise<T>\n): Promise<T | undefined> => condition.then((t) => (t ? value() : undefined));\n\n/**\n * Converts an array of objects into a record (object) where each key is determined by the specified selector and the value is determined by the provided function.\n *\n * @example\n * ```ts\n * import { toRecord } from \"@aa-sdk/core\";\n * import { sepolia, mainnet } from \"viem/chains\";\n *\n * const addressesByChain = toRecord(\n * [sepolia, mainnet],\n * \"id\",\n * () => \"0x...\"\n * ); // { [sepolia.id]: \"0x...\", [mainnet.id]: \"0x...\" }\n * ```\n *\n * @param {T[]} array The array of objects to convert to a record\n * @param {K} selector The key used to select the property that will become the record's key\n * @param {(item: T) => V} fn The function that transforms each item in the array into the record's value\n * @returns {Record<T[K], V>} The resulting record object\n */\nexport const toRecord = <\n T extends { [K in RecordableKeys<T>]: string | number | symbol },\n K extends RecordableKeys<T>,\n V\n>(\n array: T[],\n selector: K,\n fn: (item: T) => V\n): Record<T[K], V> =>\n array.reduce((acc, item) => {\n acc[item[selector]] = fn(item);\n return acc;\n }, {} as Record<T[K], V>);\n\nexport * from \"./bigint.js\";\nexport * from \"./bytes.js\";\nexport * from \"./defaults.js\";\nexport * from \"./schema.js\";\nexport type * from \"./types.js\";\nexport * from \"./userop.js\";\n"]}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.0-alpha.
|
|
1
|
+
export declare const VERSION = "4.0.0-alpha.3";
|
package/dist/cjs/version.js
CHANGED
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-alpha.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";;;AAEa,QAAA,OAAO,GAAG,eAAe,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.0.0-alpha.3\";\n"]}
|
package/dist/esm/ens/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Chain } from "viem/chains";
|
|
2
1
|
import * as chains from "viem/chains";
|
|
2
|
+
import { type Chain } from "viem/chains";
|
|
3
3
|
export declare const ChainsById: Map<number, chains.Chain>;
|
|
4
4
|
export declare const convertChainIdToCoinType: (chainId: number) => number;
|
|
5
5
|
export declare const convertCoinTypeToChainId: (coinType: number) => number;
|
package/dist/esm/ens/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as chains from "viem/chains";
|
|
2
|
-
import { mainnet } from "
|
|
2
|
+
import { mainnet } from "viem/chains";
|
|
3
3
|
export const ChainsById = new Map(Object.values(chains).map((x) => [x.id, x]));
|
|
4
4
|
export const convertChainIdToCoinType = (chainId) => {
|
|
5
5
|
if (chainId === mainnet.id) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/ens/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAc,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,UAAU,GAA8B,IAAI,GAAG,CAC1D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAC5C,CAAC;AAgBF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,OAAe,EAAU,EAAE;IAClE,IAAI,OAAO,KAAK,OAAO,CAAC,EAAE,EAAE,CAAC;QAE3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAGD,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AAiBF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAU,EAAE;IACnE,IAAI,QAAQ,KAAK,EAAE,EAAE,CAAC;QAEpB,OAAO,OAAO,CAAC,EAAE,CAAC;IACpB,CAAC;IAGD,OAAO,CAAC,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAkBF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,QAAgB,EAAS,EAAE;IAChE,MAAM,OAAO,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import * as chains from \"viem/chains\";\nimport { mainnet, type Chain } from \"viem/chains\";\n\nexport const ChainsById: Map<number, chains.Chain> = new Map(\n Object.values(chains).map((x) => [x.id, x])\n);\n\n/**\n * Converts a given chain ID to a coin type, following specific standards for mainnet and non-mainnet chains.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * ```\n *\n * @param {number} chainId the blockchain chain ID that you want to convert to a coin type\n * @returns {number} the corresponding coin type for the given chain ID\n */\nexport const convertChainIdToCoinType = (chainId: number): number => {\n if (chainId === mainnet.id) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return 60;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x80000000 | chainId) >>> 0;\n};\n\n/**\n * Converts a coin type to a chain ID based on predefined mappings. This function follows ENSIP-9 for coin type 60 and ENSIP-11 for other coin types.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChainId } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chainId = convertCoinTypeToChainId(coinType);\n * ```\n *\n * @param {number} coinType the coin type to be converted to a chain ID\n * @returns {number} the corresponding chain ID\n */\nexport const convertCoinTypeToChainId = (coinType: number): number => {\n if (coinType === 60) {\n // this comes from [ensip-9](https://docs.ens.domains/ens-improvement-proposals/ensip-9-multichain-address-resolution)\n return mainnet.id;\n }\n\n // this is using [ENSIP-11](https://docs.ens.domains/ens-improvement-proposals/ensip-11-evmchain-address-resolution) and assumes this is how mappings are stored for non mainnet chains\n return (0x7fffffff & coinType) >> 0;\n};\n\n/**\n * Converts a coin type to its corresponding blockchain chain based on a predefined mapping.\n *\n * @example\n * ```ts\n * import { convertChainIdToCoinType, convertCoinTypeToChain } from \"@aa-sdk/core\";\n * import { sepolia } from \"viem/chains\";\n *\n * const coinType = convertChainIdToCoinType(sepolia.id);\n * const chain = convertCoinTypeToChain(coinType);\n * ```\n *\n * @param {number} coinType The numerical identifier for the coin type\n * @returns {Chain} The corresponding blockchain chain\n * @throws {Error} If the coin type does not map to a supported chain\n */\nexport const convertCoinTypeToChain = (coinType: number): Chain => {\n const chainId = convertCoinTypeToChainId(coinType);\n const chain = ChainsById.get(chainId);\n if (!chain) {\n throw new Error(\"CoinType does not map to a supported chain\");\n }\n\n return chain;\n};\n"]}
|