@latticexyz/common 2.2.15-entrykit-d928bffbd5581fdc643915df1e5faad2eaafa210 → 2.2.15-f9de085862ac62ce15fe3b7743916cfd631592ea
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/actions.js +1 -1
- package/dist/actions.js.map +1 -1
- package/dist/chains.d.ts +2 -20
- package/dist/chains.js +1 -1
- package/dist/chains.js.map +1 -1
- package/dist/chunk-RCAJ6T6T.js +2 -0
- package/dist/chunk-RCAJ6T6T.js.map +1 -0
- package/dist/chunk-WSHEKFYD.js +2 -0
- package/dist/chunk-WSHEKFYD.js.map +1 -0
- package/dist/chunk-Y4MH6TRP.js +2 -0
- package/dist/chunk-Y4MH6TRP.js.map +1 -0
- package/dist/index.d.ts +2 -14
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +36 -0
- package/dist/internal.js +13 -0
- package/dist/internal.js.map +1 -0
- package/dist/kms.js.map +1 -1
- package/dist/utils.d.ts +1 -11
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/package.json +6 -4
- package/dist/accounts.d.ts +0 -654
- package/dist/accounts.js +0 -2
- package/dist/accounts.js.map +0 -1
- package/dist/chunk-KYWXD3AM.js +0 -2
- package/dist/chunk-KYWXD3AM.js.map +0 -1
package/dist/accounts.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function F(t){return t!=null&&"__isCoinbaseSmartAccount"in t&&t.__isCoinbaseSmartAccount===!0}import{pad as D,encodeFunctionData as w,hashMessage as P,hashTypedData as M,encodeAbiParameters as S,stringToHex as T,size as L,encodePacked as H,parseSignature as N,BaseError as W}from"viem";import{entryPoint07Abi as B,entryPoint07Address as G,getUserOperationHash as U,toSmartAccount as _}from"viem/account-abstraction";import{readContract as v}from"viem/actions";import{parseSignature as E}from"webauthn-p256";var c=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"owner",type:"bytes"}],name:"AlreadyOwner",type:"error"},{inputs:[],name:"Initialized",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidEthereumAddressOwner",type:"error"},{inputs:[{name:"key",type:"uint256"}],name:"InvalidNonceKey",type:"error"},{inputs:[{name:"owner",type:"bytes"}],name:"InvalidOwnerBytesLength",type:"error"},{inputs:[],name:"LastOwner",type:"error"},{inputs:[{name:"index",type:"uint256"}],name:"NoOwnerAtIndex",type:"error"},{inputs:[{name:"ownersRemaining",type:"uint256"}],name:"NotLastOwner",type:"error"},{inputs:[{name:"selector",type:"bytes4"}],name:"SelectorNotAllowed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"UnauthorizedCallContext",type:"error"},{inputs:[],name:"UpgradeFailed",type:"error"},{inputs:[{name:"index",type:"uint256"},{name:"expectedOwner",type:"bytes"},{name:"actualOwner",type:"bytes"}],name:"WrongOwnerAtIndex",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"AddOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"index",type:"uint256"},{indexed:!1,name:"owner",type:"bytes"}],name:"RemoveOwner",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[],name:"REPLAYABLE_NONCE_KEY",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"addOwnerAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"addOwnerPublicKey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"functionSelector",type:"bytes4"}],name:"canSkipChainIdValidation",outputs:[{name:"",type:"bool"}],stateMutability:"pure",type:"function"},{inputs:[],name:"domainSeparator",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"entryPoint",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"calls",type:"bytes[]"}],name:"executeWithoutChainIdValidation",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHashWithoutChainId",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"$",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"owners",type:"bytes[]"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"isOwnerAddress",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"bytes"}],name:"isOwnerBytes",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"x",type:"bytes32"},{name:"y",type:"bytes32"}],name:"isOwnerPublicKey",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"result",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"nextOwnerIndex",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"}],name:"ownerAtIndex",outputs:[{name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ownerCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeLastOwner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"index",type:"uint256"},{name:"owner",type:"bytes"}],name:"removeOwnerAtIndex",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"removedOwnersCount",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"hash",type:"bytes32"}],name:"replaySafeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{name:"newImplementation",type:"address"},{name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{name:"validationData",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];var O=[{inputs:[{name:"implementation_",type:"address"}],stateMutability:"payable",type:"constructor"},{inputs:[],name:"OwnerRequired",type:"error"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"createAccount",outputs:[{name:"account",type:"address"}],stateMutability:"payable",type:"function"},{inputs:[{name:"owners",type:"bytes[]"},{name:"nonce",type:"uint256"}],name:"getAddress",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"initCodeHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"}];async function ce(t){let{client:n,owners:i,nonce:s=0n}=t,x=t.address,f={abi:B,address:G,version:"0.7"},d={abi:O,address:"0x356336adA1619BeC1Ae4E6D94Dd9c0490DA414a8"};if(!i.length)throw new Error("`owners` must have at least one account.");function l(e){return e.type==="webAuthn"?e.publicKey:D(e.address)}let o=t.signer??i[0],p=i.indexOf(o);if(p===-1)throw new Error("`signer` must be one of `owners`.");let A=0n;return _({client:n,entryPoint:f,extend:{__isCoinbaseSmartAccount:!0,abi:c,factory:d,signer:o},async encodeCalls(e){if(e.length===1){let a=e[0];return w({abi:c,functionName:"execute",args:[a.to,a.value??0n,a.data??"0x"]})}return w({abi:c,functionName:"executeBatch",args:[e.map(a=>({data:a.data??"0x",target:a.to,value:a.value??0n}))]})},async getAddress(){return x??=await v(n,{...d,functionName:"getAddress",args:[i.map(l),s]}),x},async getNonce(){let e=8n;return A=(A+1n)%(1n<<e),(BigInt(Date.now())<<e)+A<<64n},async getFactoryArgs(){let e=w({abi:d.abi,functionName:"createAccount",args:[i.map(l),s]});return{factory:d.address,factoryData:e}},async getStubSignature(){return o.type==="webAuthn"?"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000":m({signature:"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",ownerIndex:p})},async sign(e){let a=await this.getAddress(),r=h({address:a,chainId:n.chain.id,hash:e.hash}),u=await b({hash:r,owner:o});return m({signature:u,ownerIndex:p})},async signMessage(e){let{message:a}=e,r=await this.getAddress(),u=h({address:r,chainId:n.chain.id,hash:P(a)}),y=await b({hash:u,owner:o});return m({signature:y,ownerIndex:p})},async signTypedData(e){let{domain:a,types:r,primaryType:u,message:y}=e,g=await this.getAddress(),I=h({address:g,chainId:n.chain.id,hash:M({domain:a,message:y,primaryType:u,types:r})}),C=await b({hash:I,owner:o});return m({signature:C,ownerIndex:p})},async signUserOperation(e){let{chainId:a=n.chain.id,...r}=e,u=await this.getAddress(),y=U({chainId:a,entryPointAddress:f.address,entryPointVersion:f.version,userOperation:{...r,sender:u}}),g=await b({hash:y,owner:o});return m({signature:g,ownerIndex:p})},userOperation:{async estimateGas(e){if(o.type==="webAuthn")return{verificationGasLimit:BigInt(Math.max(Number(e.verificationGasLimit??0n),8e5))}}},async isOwner(e){return await v(n,{abi:c,address:await this.getAddress(),functionName:"isOwnerBytes",args:[l(e)]})}})}async function b({hash:t,owner:n}){if(n.type==="webAuthn"){let{signature:i,webauthn:s}=await n.sign({hash:t});return R({signature:i,webauthn:s})}if(n.sign)return n.sign({hash:t});throw new W("`owner` does not support raw sign.")}function h({address:t,chainId:n,hash:i}){return M({domain:{chainId:n,name:"Coinbase Smart Wallet",verifyingContract:t,version:"1"},types:{CoinbaseSmartWalletMessage:[{name:"hash",type:"bytes32"}]},primaryType:"CoinbaseSmartWalletMessage",message:{hash:i}})}function R({webauthn:t,signature:n}){let{r:i,s}=E(n);return S([{components:[{name:"authenticatorData",type:"bytes"},{name:"clientDataJSON",type:"bytes"},{name:"challengeIndex",type:"uint256"},{name:"typeIndex",type:"uint256"},{name:"r",type:"uint256"},{name:"s",type:"uint256"}],type:"tuple"}],[{authenticatorData:t.authenticatorData,clientDataJSON:T(t.clientDataJSON),challengeIndex:BigInt(t.challengeIndex),typeIndex:BigInt(t.typeIndex),r:i,s}])}function m(t){let{ownerIndex:n}=t,i=(()=>{if(L(t.signature)!==65)return t.signature;let s=N(t.signature);return H(["bytes32","bytes32","uint8"],[s.r,s.s,s.yParity===0?27:28])})();return S([{components:[{name:"ownerIndex",type:"uint8"},{name:"signatureData",type:"bytes"}],type:"tuple"}],[{ownerIndex:n,signatureData:i}])}export{F as isCoinbaseSmartAccount,b as sign,ce as toCoinbaseSmartAccount,h as toReplaySafeHash,R as toWebAuthnSignature,m as wrapSignature};
|
|
2
|
-
//# sourceMappingURL=accounts.js.map
|
package/dist/accounts.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/accounts/coinbase-smart-account/isCoinbaseSmartAccount.ts","../src/accounts/coinbase-smart-account/toCoinbaseSmartAccount.ts","../src/accounts/coinbase-smart-account/abi.ts","../src/accounts/coinbase-smart-account/factoryAbi.ts"],"sourcesContent":["import { Account } from \"viem\";\nimport { ToCoinbaseSmartAccountReturnType } from \"./toCoinbaseSmartAccount\";\n\nexport function isCoinbaseSmartAccount(account: Account | undefined): account is ToCoinbaseSmartAccountReturnType {\n return account != null && \"__isCoinbaseSmartAccount\" in account && account.__isCoinbaseSmartAccount === true;\n}\n","// Forked from https://github.com/wevm/viem/blob/main/src/account-abstraction/accounts/implementations/toCoinbaseSmartAccount.ts\n// to match our forked contracts (upgrade to v0.7 entrypoint)\nimport {\n Client,\n OneOf,\n LocalAccount,\n Prettify,\n Assign,\n pad,\n encodeFunctionData,\n hashMessage,\n TypedDataDefinition,\n hashTypedData,\n Hash,\n encodeAbiParameters,\n stringToHex,\n size,\n encodePacked,\n parseSignature,\n Address,\n TypedData,\n BaseError,\n} from \"viem\";\nimport {\n WebAuthnAccount,\n SmartAccount,\n SmartAccountImplementation,\n entryPoint07Abi,\n entryPoint07Address,\n getUserOperationHash,\n UserOperation,\n toSmartAccount,\n} from \"viem/account-abstraction\";\nimport { readContract } from \"viem/actions\";\nimport { type WebAuthnData, parseSignature as parseP256Signature, Hex } from \"webauthn-p256\";\nimport { abi } from \"./abi\";\nimport { factoryAbi } from \"./factoryAbi\";\n\nexport type ToCoinbaseSmartAccountParameters = {\n address?: Address | undefined;\n client: Client;\n owners: readonly OneOf<LocalAccount | WebAuthnAccount>[];\n nonce?: bigint | undefined;\n signer?: OneOf<LocalAccount | WebAuthnAccount>;\n};\n\nexport type ToCoinbaseSmartAccountReturnType = Prettify<SmartAccount<CoinbaseSmartAccountImplementation>>;\n\nexport type CoinbaseSmartAccountImplementation = Assign<\n SmartAccountImplementation<\n typeof entryPoint07Abi,\n \"0.7\",\n {\n __isCoinbaseSmartAccount: true;\n abi: abi;\n factory: { abi: factoryAbi; address: Address };\n signer: OneOf<LocalAccount | WebAuthnAccount>;\n }\n >,\n {\n sign: NonNullable<SmartAccountImplementation[\"sign\"]>;\n // TODO: should this be inside `extend` of `SmartAccountImplementation`?\n isOwner: (account: LocalAccount | WebAuthnAccount) => Promise<boolean>;\n }\n>;\n\n/**\n * @description Create a Coinbase Smart Account.\n *\n * @param parameters - {@link ToCoinbaseSmartAccountParameters}\n * @returns Coinbase Smart Account. {@link ToCoinbaseSmartAccountReturnType}\n *\n * @example\n * import { toCoinbaseSmartAccount } from 'viem/account-abstraction'\n * import { privateKeyToAccount } from 'viem/accounts'\n * import { client } from './client.js'\n *\n * const account = toCoinbaseSmartAccount({\n * client,\n * owners: [privateKeyToAccount('0x...')],\n * })\n */\nexport async function toCoinbaseSmartAccount(\n parameters: ToCoinbaseSmartAccountParameters,\n): Promise<ToCoinbaseSmartAccountReturnType> {\n const { client, owners, nonce = 0n } = parameters;\n\n let address = parameters.address;\n\n const entryPoint = {\n abi: entryPoint07Abi,\n address: entryPoint07Address,\n version: \"0.7\",\n } as const;\n const factory = {\n abi: factoryAbi,\n // TODO: make configurable?\n address: \"0x356336adA1619BeC1Ae4E6D94Dd9c0490DA414a8\",\n } as const;\n\n if (!owners.length) {\n throw new Error(\"`owners` must have at least one account.\");\n }\n\n function accountToBytes(account: LocalAccount | WebAuthnAccount): Hex {\n return account.type === \"webAuthn\" ? account.publicKey : pad(account.address);\n }\n\n const owner = parameters.signer ?? owners[0]!;\n const ownerIndex = owners.indexOf(owner);\n if (ownerIndex === -1) {\n throw new Error(\"`signer` must be one of `owners`.\");\n }\n\n let counter = 0n;\n\n return toSmartAccount({\n client,\n entryPoint,\n\n extend: {\n __isCoinbaseSmartAccount: true as const,\n abi,\n factory,\n signer: owner,\n },\n\n async encodeCalls(calls) {\n if (calls.length === 1) {\n const call = calls[0]!;\n return encodeFunctionData({\n abi,\n functionName: \"execute\",\n args: [call.to, call.value ?? 0n, call.data ?? \"0x\"],\n });\n }\n\n return encodeFunctionData({\n abi,\n functionName: \"executeBatch\",\n args: [\n calls.map((call) => ({\n data: call.data ?? \"0x\",\n target: call.to,\n value: call.value ?? 0n,\n })),\n ],\n });\n },\n\n async getAddress() {\n address ??= await readContract(client, {\n ...factory,\n functionName: \"getAddress\",\n args: [owners.map(accountToBytes), nonce],\n });\n return address;\n },\n\n async getNonce() {\n // allows for 256 nonces per ms\n const counterBits = 8n;\n counter = (counter + 1n) % (1n << counterBits);\n\n const timestamp = BigInt(Date.now());\n const nonce = ((timestamp << counterBits) + counter) << 64n;\n\n return nonce;\n },\n\n async getFactoryArgs() {\n const factoryData = encodeFunctionData({\n abi: factory.abi,\n functionName: \"createAccount\",\n args: [owners.map(accountToBytes), nonce],\n });\n return { factory: factory.address, factoryData };\n },\n\n async getStubSignature() {\n if (owner.type === \"webAuthn\")\n // eslint-disable-next-line max-len\n return \"0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001949fc7c88032b9fcb5f6efc7a7b8c63668eae9871b765e23123bb473ff57aa831a7c0d9276168ebcc29f2875a0239cffdf2a9cd1c2007c5c77c071db9264df1d000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97630500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008a7b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2273496a396e6164474850596759334b7156384f7a4a666c726275504b474f716d59576f4d57516869467773222c226f726967696e223a2268747470733a2f2f7369676e2e636f696e626173652e636f6d222c2263726f73734f726967696e223a66616c73657d00000000000000000000000000000000000000000000\";\n return wrapSignature({\n signature:\n \"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c\",\n ownerIndex,\n });\n },\n\n async sign(parameters) {\n const address = await this.getAddress();\n\n const hash = toReplaySafeHash({\n address,\n chainId: client.chain!.id,\n hash: parameters.hash,\n });\n\n const signature = await sign({ hash, owner });\n\n return wrapSignature({ signature, ownerIndex });\n },\n\n async signMessage(parameters) {\n const { message } = parameters;\n const address = await this.getAddress();\n\n const hash = toReplaySafeHash({\n address,\n chainId: client.chain!.id,\n hash: hashMessage(message),\n });\n\n const signature = await sign({ hash, owner });\n\n return wrapSignature({ signature, ownerIndex });\n },\n\n async signTypedData(parameters) {\n const { domain, types, primaryType, message } = parameters as TypedDataDefinition<TypedData, string>;\n const address = await this.getAddress();\n\n const hash = toReplaySafeHash({\n address,\n chainId: client.chain!.id,\n hash: hashTypedData({\n domain,\n message,\n primaryType,\n types,\n }),\n });\n\n const signature = await sign({ hash, owner });\n\n return wrapSignature({ signature, ownerIndex });\n },\n\n async signUserOperation(parameters) {\n const { chainId = client.chain!.id, ...userOperation } = parameters;\n\n const address = await this.getAddress();\n const hash = getUserOperationHash({\n chainId,\n entryPointAddress: entryPoint.address,\n entryPointVersion: entryPoint.version,\n userOperation: {\n ...(userOperation as unknown as UserOperation),\n sender: address,\n },\n });\n\n const signature = await sign({ hash, owner });\n\n return wrapSignature({ signature, ownerIndex });\n },\n\n userOperation: {\n async estimateGas(userOperation) {\n if (owner.type !== \"webAuthn\") return;\n\n // Accounts with WebAuthn owner require a minimum verification gas limit of 800,000.\n return {\n verificationGasLimit: BigInt(Math.max(Number(userOperation.verificationGasLimit ?? 0n), 800_000)),\n };\n },\n },\n\n async isOwner(account: LocalAccount | WebAuthnAccount) {\n return await readContract(client, {\n abi,\n address: await this.getAddress(),\n functionName: \"isOwnerBytes\",\n args: [accountToBytes(account)],\n });\n },\n });\n}\n\n/////////////////////////////////////////////////////////////////////////////////////////////\n// Utilities\n/////////////////////////////////////////////////////////////////////////////////////////////\n\n/** @internal */\nexport async function sign({\n hash,\n owner,\n}: {\n hash: Hash;\n owner: OneOf<LocalAccount | WebAuthnAccount>;\n}): Promise<Hex> {\n // WebAuthn Account (Passkey)\n if (owner.type === \"webAuthn\") {\n const { signature, webauthn } = await owner.sign({\n hash,\n });\n return toWebAuthnSignature({ signature, webauthn });\n }\n\n if (owner.sign) return owner.sign({ hash });\n\n throw new BaseError(\"`owner` does not support raw sign.\");\n}\n\n/** @internal */\nexport function toReplaySafeHash({ address, chainId, hash }: { address: Address; chainId: number; hash: Hash }): Hex {\n return hashTypedData({\n domain: {\n chainId,\n name: \"Coinbase Smart Wallet\",\n verifyingContract: address,\n version: \"1\",\n },\n types: {\n CoinbaseSmartWalletMessage: [\n {\n name: \"hash\",\n type: \"bytes32\",\n },\n ],\n },\n primaryType: \"CoinbaseSmartWalletMessage\",\n message: {\n hash,\n },\n });\n}\n\n/** @internal */\nexport function toWebAuthnSignature({ webauthn, signature }: { webauthn: WebAuthnData; signature: Hex }): Hex {\n const { r, s } = parseP256Signature(signature);\n return encodeAbiParameters(\n [\n {\n components: [\n {\n name: \"authenticatorData\",\n type: \"bytes\",\n },\n { name: \"clientDataJSON\", type: \"bytes\" },\n { name: \"challengeIndex\", type: \"uint256\" },\n { name: \"typeIndex\", type: \"uint256\" },\n {\n name: \"r\",\n type: \"uint256\",\n },\n {\n name: \"s\",\n type: \"uint256\",\n },\n ],\n type: \"tuple\",\n },\n ],\n [\n {\n authenticatorData: webauthn.authenticatorData,\n clientDataJSON: stringToHex(webauthn.clientDataJSON),\n challengeIndex: BigInt(webauthn.challengeIndex),\n typeIndex: BigInt(webauthn.typeIndex),\n r,\n s,\n },\n ],\n );\n}\n\n/** @internal */\nexport function wrapSignature(parameters: { ownerIndex: number; signature: Hex }): Hex {\n const { ownerIndex } = parameters;\n const signatureData = ((): Hex => {\n if (size(parameters.signature) !== 65) return parameters.signature;\n const signature = parseSignature(parameters.signature);\n return encodePacked([\"bytes32\", \"bytes32\", \"uint8\"], [signature.r, signature.s, signature.yParity === 0 ? 27 : 28]);\n })();\n return encodeAbiParameters(\n [\n {\n components: [\n {\n name: \"ownerIndex\",\n type: \"uint8\",\n },\n {\n name: \"signatureData\",\n type: \"bytes\",\n },\n ],\n type: \"tuple\",\n },\n ],\n [\n {\n ownerIndex,\n signatureData,\n },\n ],\n );\n}\n","export const abi = [\n { inputs: [], stateMutability: \"nonpayable\", type: \"constructor\" },\n {\n inputs: [{ name: \"owner\", type: \"bytes\" }],\n name: \"AlreadyOwner\",\n type: \"error\",\n },\n { inputs: [], name: \"Initialized\", type: \"error\" },\n {\n inputs: [{ name: \"owner\", type: \"bytes\" }],\n name: \"InvalidEthereumAddressOwner\",\n type: \"error\",\n },\n {\n inputs: [{ name: \"key\", type: \"uint256\" }],\n name: \"InvalidNonceKey\",\n type: \"error\",\n },\n {\n inputs: [{ name: \"owner\", type: \"bytes\" }],\n name: \"InvalidOwnerBytesLength\",\n type: \"error\",\n },\n { inputs: [], name: \"LastOwner\", type: \"error\" },\n {\n inputs: [{ name: \"index\", type: \"uint256\" }],\n name: \"NoOwnerAtIndex\",\n type: \"error\",\n },\n {\n inputs: [{ name: \"ownersRemaining\", type: \"uint256\" }],\n name: \"NotLastOwner\",\n type: \"error\",\n },\n {\n inputs: [{ name: \"selector\", type: \"bytes4\" }],\n name: \"SelectorNotAllowed\",\n type: \"error\",\n },\n { inputs: [], name: \"Unauthorized\", type: \"error\" },\n { inputs: [], name: \"UnauthorizedCallContext\", type: \"error\" },\n { inputs: [], name: \"UpgradeFailed\", type: \"error\" },\n {\n inputs: [\n { name: \"index\", type: \"uint256\" },\n { name: \"expectedOwner\", type: \"bytes\" },\n { name: \"actualOwner\", type: \"bytes\" },\n ],\n name: \"WrongOwnerAtIndex\",\n type: \"error\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n\n name: \"index\",\n type: \"uint256\",\n },\n { indexed: false, name: \"owner\", type: \"bytes\" },\n ],\n name: \"AddOwner\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n\n name: \"index\",\n type: \"uint256\",\n },\n { indexed: false, name: \"owner\", type: \"bytes\" },\n ],\n name: \"RemoveOwner\",\n type: \"event\",\n },\n {\n anonymous: false,\n inputs: [\n {\n indexed: true,\n\n name: \"implementation\",\n type: \"address\",\n },\n ],\n name: \"Upgraded\",\n type: \"event\",\n },\n { stateMutability: \"payable\", type: \"fallback\" },\n {\n inputs: [],\n name: \"REPLAYABLE_NONCE_KEY\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"owner\", type: \"address\" }],\n name: \"addOwnerAddress\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"x\", type: \"bytes32\" },\n { name: \"y\", type: \"bytes32\" },\n ],\n name: \"addOwnerPublicKey\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"functionSelector\", type: \"bytes4\" }],\n name: \"canSkipChainIdValidation\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"pure\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"domainSeparator\",\n outputs: [{ name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"eip712Domain\",\n outputs: [\n { name: \"fields\", type: \"bytes1\" },\n { name: \"name\", type: \"string\" },\n { name: \"version\", type: \"string\" },\n { name: \"chainId\", type: \"uint256\" },\n { name: \"verifyingContract\", type: \"address\" },\n { name: \"salt\", type: \"bytes32\" },\n { name: \"extensions\", type: \"uint256[]\" },\n ],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"entryPoint\",\n outputs: [{ name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"target\", type: \"address\" },\n { name: \"value\", type: \"uint256\" },\n { name: \"data\", type: \"bytes\" },\n ],\n name: \"execute\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { name: \"target\", type: \"address\" },\n { name: \"value\", type: \"uint256\" },\n { name: \"data\", type: \"bytes\" },\n ],\n\n name: \"calls\",\n type: \"tuple[]\",\n },\n ],\n name: \"executeBatch\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"calls\", type: \"bytes[]\" }],\n name: \"executeWithoutChainIdValidation\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { name: \"sender\", type: \"address\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"initCode\", type: \"bytes\" },\n { name: \"callData\", type: \"bytes\" },\n { name: \"callGasLimit\", type: \"uint256\" },\n {\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n { name: \"maxFeePerGas\", type: \"uint256\" },\n {\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n { name: \"paymasterAndData\", type: \"bytes\" },\n { name: \"signature\", type: \"bytes\" },\n ],\n\n name: \"userOp\",\n type: \"tuple\",\n },\n ],\n name: \"getUserOpHashWithoutChainId\",\n outputs: [{ name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"implementation\",\n outputs: [{ name: \"$\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"owners\", type: \"bytes[]\" }],\n name: \"initialize\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"account\", type: \"address\" }],\n name: \"isOwnerAddress\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"account\", type: \"bytes\" }],\n name: \"isOwnerBytes\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"x\", type: \"bytes32\" },\n { name: \"y\", type: \"bytes32\" },\n ],\n name: \"isOwnerPublicKey\",\n outputs: [{ name: \"\", type: \"bool\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"hash\", type: \"bytes32\" },\n { name: \"signature\", type: \"bytes\" },\n ],\n name: \"isValidSignature\",\n outputs: [{ name: \"result\", type: \"bytes4\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"nextOwnerIndex\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"index\", type: \"uint256\" }],\n name: \"ownerAtIndex\",\n outputs: [{ name: \"\", type: \"bytes\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"ownerCount\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"proxiableUUID\",\n outputs: [{ name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"index\", type: \"uint256\" },\n { name: \"owner\", type: \"bytes\" },\n ],\n name: \"removeLastOwner\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"index\", type: \"uint256\" },\n { name: \"owner\", type: \"bytes\" },\n ],\n name: \"removeOwnerAtIndex\",\n outputs: [],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"removedOwnersCount\",\n outputs: [{ name: \"\", type: \"uint256\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [{ name: \"hash\", type: \"bytes32\" }],\n name: \"replaySafeHash\",\n outputs: [{ name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"newImplementation\", type: \"address\" },\n { name: \"data\", type: \"bytes\" },\n ],\n name: \"upgradeToAndCall\",\n outputs: [],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n {\n components: [\n { name: \"sender\", type: \"address\" },\n { name: \"nonce\", type: \"uint256\" },\n { name: \"initCode\", type: \"bytes\" },\n { name: \"callData\", type: \"bytes\" },\n { name: \"callGasLimit\", type: \"uint256\" },\n {\n name: \"verificationGasLimit\",\n type: \"uint256\",\n },\n {\n name: \"preVerificationGas\",\n type: \"uint256\",\n },\n { name: \"maxFeePerGas\", type: \"uint256\" },\n {\n name: \"maxPriorityFeePerGas\",\n type: \"uint256\",\n },\n { name: \"paymasterAndData\", type: \"bytes\" },\n { name: \"signature\", type: \"bytes\" },\n ],\n\n name: \"userOp\",\n type: \"tuple\",\n },\n { name: \"userOpHash\", type: \"bytes32\" },\n { name: \"missingAccountFunds\", type: \"uint256\" },\n ],\n name: \"validateUserOp\",\n outputs: [{ name: \"validationData\", type: \"uint256\" }],\n stateMutability: \"nonpayable\",\n type: \"function\",\n },\n { stateMutability: \"payable\", type: \"receive\" },\n] as const;\n\nexport type abi = typeof abi;\n","export const factoryAbi = [\n {\n inputs: [{ name: \"implementation_\", type: \"address\" }],\n stateMutability: \"payable\",\n type: \"constructor\",\n },\n { inputs: [], name: \"OwnerRequired\", type: \"error\" },\n {\n inputs: [\n { name: \"owners\", type: \"bytes[]\" },\n { name: \"nonce\", type: \"uint256\" },\n ],\n name: \"createAccount\",\n outputs: [\n {\n name: \"account\",\n type: \"address\",\n },\n ],\n stateMutability: \"payable\",\n type: \"function\",\n },\n {\n inputs: [\n { name: \"owners\", type: \"bytes[]\" },\n { name: \"nonce\", type: \"uint256\" },\n ],\n name: \"getAddress\",\n outputs: [{ name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"implementation\",\n outputs: [{ name: \"\", type: \"address\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n {\n inputs: [],\n name: \"initCodeHash\",\n outputs: [{ name: \"\", type: \"bytes32\" }],\n stateMutability: \"view\",\n type: \"function\",\n },\n] as const;\n\nexport type factoryAbi = typeof factoryAbi;\n"],"mappings":"AAGO,SAASA,EAAuBC,EAA2E,CAChH,OAAOA,GAAW,MAAQ,6BAA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ACE,CACE,kBAAmBL,EAAS,kBAC5B,eAAgBM,EAAYN,EAAS,cAAc,EACnD,eAAgB,OAAOA,EAAS,cAAc,EAC9C,UAAW,OAAOA,EAAS,SAAS,EACpC,EAAAG,EACA,CACF,CACF,CACF,CACF,CAGO,SAASjB,EAAcxB,EAAyD,CACrF,GAAM,CAAE,WAAAc,CAAW,EAAId,EACjB6C,GAAiB,IAAW,CAChC,GAAIC,EAAK9C,EAAW,SAAS,IAAM,GAAI,OAAOA,EAAW,UACzD,IAAM2B,EAAYoB,EAAe/C,EAAW,SAAS,EACrD,OAAOgD,EAAa,CAAC,UAAW,UAAW,OAAO,EAAG,CAACrB,EAAU,EAAGA,EAAU,EAAGA,EAAU,UAAY,EAAI,GAAK,EAAE,CAAC,CACpH,GAAG,EACH,OAAOgB,EACL,CACE,CACE,WAAY,CACV,CACE,KAAM,aACN,KAAM,OACR,EACA,CACE,KAAM,gBACN,KAAM,OACR,CACF,EACA,KAAM,OACR,CACF,EACA,CACE,CACE,WAAA7B,EACA,cAAA+B,CACF,CACF,CACF,CACF","names":["isCoinbaseSmartAccount","account","pad","encodeFunctionData","hashMessage","hashTypedData","encodeAbiParameters","stringToHex","size","encodePacked","parseSignature","BaseError","entryPoint07Abi","entryPoint07Address","getUserOperationHash","toSmartAccount","readContract","parseP256Signature","abi","factoryAbi","toCoinbaseSmartAccount","parameters","client","owners","nonce","address","entryPoint","entryPoint07Abi","entryPoint07Address","factory","factoryAbi","accountToBytes","account","pad","owner","ownerIndex","counter","toSmartAccount","abi","calls","call","encodeFunctionData","readContract","counterBits","factoryData","wrapSignature","hash","toReplaySafeHash","signature","sign","message","hashMessage","domain","types","primaryType","hashTypedData","chainId","userOperation","getUserOperationHash","webauthn","toWebAuthnSignature","BaseError","r","parseP256Signature","encodeAbiParameters","stringToHex","signatureData","size","parseSignature","encodePacked"]}
|
package/dist/chunk-KYWXD3AM.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-TCWGPC6G.js";import{getAddress as v}from"viem";import{getChainId as O}from"viem/actions";import{getAction as A}from"viem/utils";async function p({client:e,address:r,blockTag:t}){return`mud:createNonceManager:${e.chain?.id??await A(e,O,"getChainId")({})}:${v(r)}:${t}`}import{BaseError as E,NonceTooHighError as I,NonceTooLowError as S}from"viem";import{getTransactionCount as k}from"viem/actions";import q from"p-queue";import{getAction as B}from"viem/utils";var y=m.extend("createNonceManager");function b({client:e,address:r,blockTag:t="latest",broadcastChannelName:o,queueConcurrency:i=1}){let n={nonce:-1,noncePromise:null},c=null;typeof BroadcastChannel<"u"&&(o?Promise.resolve(o):p({client:e,address:r,blockTag:t})).then(f=>{c=new BroadcastChannel(f),c.addEventListener("message",M=>{let w=JSON.parse(M.data);y("got nonce from broadcast channel",w),n.nonce=w})});function s(){return n.nonce>=0}function a(){if(!s())throw new Error("call resetNonce before using getNonce");return n.nonce}function u(){if(!s())throw new Error("call resetNonce before using nextNonce");let d=n.nonce++;return c?.postMessage(JSON.stringify(n.nonce)),d}async function R(){n.noncePromise??=(async()=>{n.nonce=await B(e,k,"getTransactionCount")({address:r,blockTag:t}),n.noncePromise=null,c?.postMessage(JSON.stringify(n.nonce)),y("reset nonce to",n.nonce)})(),await n.noncePromise}function P(d){return d instanceof E&&d.walk(f=>f instanceof S||f instanceof I)!=null}let F=new q({concurrency:i});return{hasNonce:s,getNonce:a,nextNonce:u,resetNonce:R,shouldResetNonce:P,mempoolQueue:F}}var N=new Map;async function g({client:e,address:r,blockTag:t="latest",...o}){let i=await p({client:e,address:r,blockTag:t}),n=N.get(i)??b({client:e,address:r,blockTag:t,...o});return N.has(i)||N.set(i,n),n.hasNonce()||await n.resetNonce(),n}import{getChainId as Q}from"viem/actions";import{estimateFeesPerGas as W}from"viem/actions";import{getAction as G}from"viem/utils";async function x({client:e,args:r,refreshInterval:t}){let o={fees:{},lastUpdatedTimestamp:0};async function i(){let n=await G(e,W,"estimateFeesPerGas")(r);o.fees=n,o.lastUpdatedTimestamp=Date.now()}return setInterval(i,t),await i(),o}import{getAction as H}from"viem/utils";var T=new Map;async function l(e){let r=e.args?.chain?.id??e.client.chain?.id??await H(e.client,Q,"getChainId")({}),t=T.get(r);if(t)return t;let o=await x(e);return T.set(r,o),o}import{writeContract as D}from"viem/actions";import J from"p-retry";import{parseAccount as U}from"viem/accounts";import{getAction as $}from"viem/utils";var h=m.extend("writeContract");async function Se(e,r,t={}){let o=r.account??e.account;if(!o)throw new Error("No account provided");let i=U(o),n=e.chain,c=await g({client:t.publicClient??e,address:i.address,queueConcurrency:t.queueConcurrency}),s=await l({client:t.publicClient??e,refreshInterval:1e4,args:{chain:n}});return c.mempoolQueue.add(()=>J(async()=>{let a=c.nextNonce(),u={blockTag:"pending",...s.fees,...r,nonce:a};return h("calling",u.functionName,"at",u.address,"with nonce",a),await $(e,D,"writeContract")(u)},{retries:3,onFailedAttempt:async a=>{if(h("failed, resetting nonce"),await c.resetNonce(),c.shouldResetNonce(a)){h("got nonce error, retrying",a.message);return}if(String(a).includes("transaction underpriced")){h("got transaction underpriced error, retrying",a.message);return}throw a}}),{throwOnTimeout:!0})}import{sendTransaction as L}from"viem/actions";import _ from"p-retry";import{parseAccount as j}from"viem/accounts";import{getAction as z}from"viem/utils";var C=m.extend("sendTransaction");async function Je(e,r,t={}){let o=r.account??e.account;if(!o)throw new Error("No account provided");let i=j(o),n=e.chain,c=await g({client:t.publicClient??e,address:i.address,queueConcurrency:t.queueConcurrency}),s=await l({client:t.publicClient??e,refreshInterval:1e4,args:{chain:n}});return await c.mempoolQueue.add(()=>_(async()=>{let a=c.nextNonce(),u={blockTag:"pending",...s.fees,...r,nonce:a};return C("sending tx to",r.to,"with nonce",a),await z(e,L,"sendTransaction")(u)},{retries:3,onFailedAttempt:async a=>{if(C("failed, resetting nonce"),await c.resetNonce(),c.shouldResetNonce(a)){C("got nonce error, retrying",a.message);return}if(String(a).includes("transaction underpriced")){C("got transaction underpriced error, retrying",a.message);return}throw a}}),{throwOnTimeout:!0})}export{p as a,b,g as c,l as d,Se as e,Je as f};
|
|
2
|
-
//# sourceMappingURL=chunk-KYWXD3AM.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/getNonceManagerId.ts","../src/createNonceManager.ts","../src/getNonceManager.ts","../src/getFeeRef.ts","../src/createFeeRef.ts","../src/writeContract.ts","../src/sendTransaction.ts"],"sourcesContent":["import { BlockTag, Client, Hex, getAddress } from \"viem\";\nimport { getChainId } from \"viem/actions\";\nimport { getAction } from \"viem/utils\";\n\nexport async function getNonceManagerId({\n client,\n address,\n blockTag,\n}: {\n client: Client;\n address: Hex;\n blockTag: BlockTag;\n}): Promise<string> {\n // TODO: improve this so we don't have to call getChainId every time\n const chainId = client.chain?.id ?? (await getAction(client, getChainId, \"getChainId\")({}));\n return `mud:createNonceManager:${chainId}:${getAddress(address)}:${blockTag}`;\n}\n","import { BaseError, BlockTag, Client, Hex, NonceTooHighError, NonceTooLowError } from \"viem\";\nimport { debug as parentDebug } from \"./debug\";\nimport { getNonceManagerId } from \"./getNonceManagerId\";\nimport { getTransactionCount } from \"viem/actions\";\nimport PQueue from \"p-queue\";\nimport { getAction } from \"viem/utils\";\n\nconst debug = parentDebug.extend(\"createNonceManager\");\n\nexport type CreateNonceManagerOptions = {\n client: Client;\n address: Hex;\n blockTag?: BlockTag;\n broadcastChannelName?: string;\n queueConcurrency?: number;\n};\n\nexport type CreateNonceManagerResult = {\n hasNonce: () => boolean;\n getNonce: () => number;\n nextNonce: () => number;\n resetNonce: () => Promise<void>;\n shouldResetNonce: (error: unknown) => boolean;\n mempoolQueue: PQueue;\n};\n\nexport function createNonceManager({\n client,\n address, // TODO: rename to account?\n blockTag = \"latest\",\n broadcastChannelName,\n queueConcurrency = 1,\n}: CreateNonceManagerOptions): CreateNonceManagerResult {\n const ref = { nonce: -1, noncePromise: null as Promise<void> | null };\n let channel: BroadcastChannel | null = null;\n\n if (typeof BroadcastChannel !== \"undefined\") {\n const channelName = broadcastChannelName\n ? Promise.resolve(broadcastChannelName)\n : getNonceManagerId({ client, address, blockTag });\n channelName.then((name) => {\n channel = new BroadcastChannel(name);\n // TODO: emit some sort of \"connected\" event so other channels can broadcast current nonce\n channel.addEventListener(\"message\", (event) => {\n const nonce = JSON.parse(event.data);\n debug(\"got nonce from broadcast channel\", nonce);\n ref.nonce = nonce;\n });\n });\n }\n\n function hasNonce(): boolean {\n return ref.nonce >= 0;\n }\n\n function getNonce(): number {\n if (!hasNonce()) throw new Error(\"call resetNonce before using getNonce\");\n return ref.nonce;\n }\n\n function nextNonce(): number {\n if (!hasNonce()) throw new Error(\"call resetNonce before using nextNonce\");\n const nonce = ref.nonce++;\n channel?.postMessage(JSON.stringify(ref.nonce));\n return nonce;\n }\n\n async function resetNonce(): Promise<void> {\n ref.noncePromise ??= (async (): Promise<void> => {\n ref.nonce = await getAction(client, getTransactionCount, \"getTransactionCount\")({ address, blockTag });\n ref.noncePromise = null;\n channel?.postMessage(JSON.stringify(ref.nonce));\n debug(\"reset nonce to\", ref.nonce);\n })();\n await ref.noncePromise;\n }\n\n function shouldResetNonce(error: unknown): boolean {\n return (\n error instanceof BaseError &&\n error.walk((e) => e instanceof NonceTooLowError || e instanceof NonceTooHighError) != null\n );\n }\n\n const mempoolQueue = new PQueue({ concurrency: queueConcurrency });\n\n return {\n hasNonce,\n getNonce,\n nextNonce,\n resetNonce,\n shouldResetNonce,\n mempoolQueue,\n };\n}\n","import { CreateNonceManagerOptions, CreateNonceManagerResult, createNonceManager } from \"./createNonceManager\";\nimport { getNonceManagerId } from \"./getNonceManagerId\";\n\nconst nonceManagers = new Map<string, CreateNonceManagerResult>();\n\nexport async function getNonceManager({\n client,\n address, // TODO: rename to account?\n blockTag = \"latest\",\n ...opts\n}: CreateNonceManagerOptions): Promise<CreateNonceManagerResult> {\n const id = await getNonceManagerId({ client, address, blockTag });\n\n const nonceManager = nonceManagers.get(id) ?? createNonceManager({ client, address, blockTag, ...opts });\n if (!nonceManagers.has(id)) {\n nonceManagers.set(id, nonceManager);\n }\n\n if (!nonceManager.hasNonce()) {\n await nonceManager.resetNonce();\n }\n\n return nonceManager;\n}\n","import { getChainId } from \"viem/actions\";\nimport { CreateFeeRefOptions, FeeRef, createFeeRef } from \"./createFeeRef\";\nimport { getAction } from \"viem/utils\";\n\nconst feeRefs = new Map<number, FeeRef>();\n\nexport async function getFeeRef(opts: CreateFeeRefOptions): Promise<FeeRef> {\n const chainId =\n opts.args?.chain?.id ?? opts.client.chain?.id ?? (await getAction(opts.client, getChainId, \"getChainId\")({}));\n\n const existingFeeRef = feeRefs.get(chainId);\n if (existingFeeRef) {\n return existingFeeRef;\n }\n\n const feeRef = await createFeeRef(opts);\n feeRefs.set(chainId, feeRef);\n return feeRef;\n}\n","import { EstimateFeesPerGasParameters, Client, EstimateFeesPerGasReturnType } from \"viem\";\nimport { estimateFeesPerGas } from \"viem/actions\";\nimport { getAction } from \"viem/utils\";\n\nexport type CreateFeeRefOptions = {\n client: Client;\n refreshInterval: number;\n args?: EstimateFeesPerGasParameters;\n};\n\nexport type FeeRef = {\n fees: EstimateFeesPerGasReturnType | {};\n lastUpdatedTimestamp: number;\n};\n\n/** Update fee values once every `refreshInterval` instead of right before every request */\nexport async function createFeeRef({ client, args, refreshInterval }: CreateFeeRefOptions): Promise<FeeRef> {\n const feeRef: FeeRef = { fees: {}, lastUpdatedTimestamp: 0 };\n\n async function updateFees(): Promise<void> {\n const fees = await getAction(client, estimateFeesPerGas, \"estimateFeesPerGas\")(args);\n feeRef.fees = fees;\n feeRef.lastUpdatedTimestamp = Date.now();\n }\n\n setInterval(updateFees, refreshInterval);\n await updateFees();\n\n return feeRef;\n}\n","import {\n Abi,\n Account,\n Chain,\n Client,\n Transport,\n WriteContractParameters,\n WriteContractReturnType,\n ContractFunctionName,\n ContractFunctionArgs,\n} from \"viem\";\nimport { writeContract as viem_writeContract } from \"viem/actions\";\nimport pRetry from \"p-retry\";\nimport { debug as parentDebug } from \"./debug\";\nimport { getNonceManager } from \"./getNonceManager\";\nimport { parseAccount } from \"viem/accounts\";\nimport { getFeeRef } from \"./getFeeRef\";\nimport { getAction } from \"viem/utils\";\n\nconst debug = parentDebug.extend(\"writeContract\");\n\nexport type WriteContractExtraOptions<chain extends Chain | undefined> = {\n /**\n * `publicClient` can be provided to be used in place of the extended viem client for making public action calls\n * (`getChainId`, `getTransactionCount`, `simulateContract`). This helps in cases where the extended\n * viem client is a smart account client, like in [permissionless.js](https://github.com/pimlicolabs/permissionless.js),\n * where the transport is the bundler, not an RPC.\n */\n publicClient?: Client<Transport, chain>;\n /**\n * Adjust the number of concurrent calls to the mempool. This defaults to `1` to ensure transactions are ordered\n * and nonces are handled properly. Any number greater than that is likely to see nonce errors and/or transactions\n * arriving out of order, but this may be an acceptable trade-off for some applications that can safely retry.\n * @default 1\n */\n queueConcurrency?: number;\n};\n\n/** @deprecated Use `walletClient.extend(transactionQueue())` instead. */\nexport async function writeContract<\n chain extends Chain | undefined,\n account extends Account | undefined,\n const abi extends Abi | readonly unknown[],\n functionName extends ContractFunctionName<abi, \"nonpayable\" | \"payable\">,\n args extends ContractFunctionArgs<abi, \"nonpayable\" | \"payable\", functionName>,\n chainOverride extends Chain | undefined,\n>(\n client: Client<Transport, chain, account>,\n request: WriteContractParameters<abi, functionName, args, chain, account, chainOverride>,\n opts: WriteContractExtraOptions<chain> = {},\n): Promise<WriteContractReturnType> {\n const rawAccount = request.account ?? client.account;\n if (!rawAccount) {\n // TODO: replace with viem AccountNotFoundError once its exported\n throw new Error(\"No account provided\");\n }\n const account = parseAccount(rawAccount);\n const chain = client.chain;\n\n const nonceManager = await getNonceManager({\n client: opts.publicClient ?? client,\n address: account.address,\n queueConcurrency: opts.queueConcurrency,\n });\n\n const feeRef = await getFeeRef({\n client: opts.publicClient ?? client,\n refreshInterval: 10000,\n args: { chain },\n });\n\n return nonceManager.mempoolQueue.add(\n () =>\n pRetry(\n async () => {\n const nonce = nonceManager.nextNonce();\n const params = {\n // viem_writeContract internally estimates gas, which we want to happen on the pending block\n blockTag: \"pending\",\n ...feeRef.fees,\n ...request,\n nonce,\n } as const satisfies WriteContractParameters<abi, functionName, args, chain, account, chainOverride>;\n debug(\"calling\", params.functionName, \"at\", params.address, \"with nonce\", nonce);\n return await getAction(client, viem_writeContract, \"writeContract\")(params as never);\n },\n {\n retries: 3,\n onFailedAttempt: async (error) => {\n // in case this tx failed before hitting the mempool (i.e. gas estimation error), reset nonce so we don't skip past the unused nonce\n debug(\"failed, resetting nonce\");\n await nonceManager.resetNonce();\n // retry nonce errors\n // TODO: upgrade p-retry and move this to shouldRetry\n if (nonceManager.shouldResetNonce(error)) {\n debug(\"got nonce error, retrying\", error.message);\n return;\n }\n\n if (String(error).includes(\"transaction underpriced\")) {\n debug(\"got transaction underpriced error, retrying\", error.message);\n return;\n }\n\n throw error;\n },\n },\n ),\n { throwOnTimeout: true },\n );\n}\n","import {\n Account,\n Chain,\n Client,\n SendTransactionParameters,\n Transport,\n SendTransactionReturnType,\n SendTransactionRequest,\n} from \"viem\";\nimport { sendTransaction as viem_sendTransaction } from \"viem/actions\";\nimport pRetry from \"p-retry\";\nimport { debug as parentDebug } from \"./debug\";\nimport { getNonceManager } from \"./getNonceManager\";\nimport { parseAccount } from \"viem/accounts\";\nimport { getFeeRef } from \"./getFeeRef\";\nimport { getAction } from \"viem/utils\";\n\nconst debug = parentDebug.extend(\"sendTransaction\");\n\nexport type SendTransactionExtraOptions<chain extends Chain | undefined> = {\n /**\n * `publicClient` can be provided to be used in place of the extended viem client for making public action calls\n * (`getChainId`, `getTransactionCount`, `call`). This helps in cases where the extended\n * viem client is a smart account client, like in [permissionless.js](https://github.com/pimlicolabs/permissionless.js),\n * where the transport is the bundler, not an RPC.\n */\n publicClient?: Client<Transport, chain>;\n /**\n * Adjust the number of concurrent calls to the mempool. This defaults to `1` to ensure transactions are ordered\n * and nonces are handled properly. Any number greater than that is likely to see nonce errors and/or transactions\n * arriving out of order, but this may be an acceptable trade-off for some applications that can safely retry.\n * @default 1\n */\n queueConcurrency?: number;\n};\n\n/** @deprecated Use `walletClient.extend(transactionQueue())` instead. */\nexport async function sendTransaction<\n chain extends Chain | undefined,\n account extends Account | undefined,\n const request extends SendTransactionRequest<chain, chainOverride>,\n chainOverride extends Chain | undefined = undefined,\n>(\n client: Client<Transport, chain, account>,\n request: SendTransactionParameters<chain, account, chainOverride, request>,\n opts: SendTransactionExtraOptions<chain> = {},\n): Promise<SendTransactionReturnType> {\n const rawAccount = request.account ?? client.account;\n if (!rawAccount) {\n // TODO: replace with viem AccountNotFoundError once its exported\n throw new Error(\"No account provided\");\n }\n const account = parseAccount(rawAccount);\n const chain = client.chain;\n\n const nonceManager = await getNonceManager({\n client: opts.publicClient ?? client,\n address: account.address,\n queueConcurrency: opts.queueConcurrency,\n });\n\n const feeRef = await getFeeRef({\n client: opts.publicClient ?? client,\n refreshInterval: 10000,\n args: { chain },\n });\n\n return await nonceManager.mempoolQueue.add(\n () =>\n pRetry(\n async () => {\n const nonce = nonceManager.nextNonce();\n const params = {\n // viem_sendTransaction internally estimates gas, which we want to happen on the pending block\n blockTag: \"pending\",\n ...feeRef.fees,\n ...request,\n nonce,\n } as const satisfies SendTransactionParameters<chain, account, chainOverride, request>;\n debug(\"sending tx to\", request.to, \"with nonce\", nonce);\n return await getAction(client, viem_sendTransaction, \"sendTransaction\")(params as never);\n },\n {\n retries: 3,\n onFailedAttempt: async (error) => {\n // in case this tx failed before hitting the mempool (i.e. gas estimation error), reset nonce so we don't skip past the unused nonce\n debug(\"failed, resetting nonce\");\n await nonceManager.resetNonce();\n // retry nonce errors\n // TODO: upgrade p-retry and move this to shouldRetry\n if (nonceManager.shouldResetNonce(error)) {\n debug(\"got nonce error, retrying\", error.message);\n return;\n }\n\n if (String(error).includes(\"transaction underpriced\")) {\n debug(\"got transaction underpriced error, retrying\", error.message);\n return;\n }\n\n throw error;\n },\n },\n ),\n { throwOnTimeout: true },\n );\n}\n"],"mappings":"wCAAA,OAAgC,cAAAA,MAAkB,OAClD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BM,EAAS,CAEb,SAAU,UACV,GAAGJ,EAAO,KACV,GAAGR,EACH,MAAAW,CACF,EACA,OAAAd,EAAM,gBAAiBG,EAAQ,GAAI,aAAcW,CAAK,EAC/C,MAAMf,EAAUG,EAAQc,EAAsB,iBAAiB,EAAED,CAAe,CACzF,EACA,CACE,QAAS,EACT,gBAAiB,MAAOE,GAAU,CAMhC,GAJAjB,EAAM,yBAAyB,EAC/B,MAAMS,EAAa,WAAW,EAG1BA,EAAa,iBAAiBQ,CAAK,EAAG,CACxCjB,EAAM,4BAA6BiB,EAAM,OAAO,EAChD,OAGF,GAAI,OAAOA,CAAK,EAAE,SAAS,yBAAyB,EAAG,CACrDjB,EAAM,8CAA+CiB,EAAM,OAAO,EAClE,OAGF,MAAMA,CACR,CACF,CACF,EACF,CAAE,eAAgB,EAAK,CACzB,CACF","names":["getAddress","getChainId","getAction","getNonceManagerId","client","address","blockTag","BaseError","NonceTooHighError","NonceTooLowError","getTransactionCount","PQueue","getAction","debug","createNonceManager","client","address","blockTag","broadcastChannelName","queueConcurrency","ref","channel","getNonceManagerId","name","event","nonce","hasNonce","getNonce","nextNonce","resetNonce","shouldResetNonce","error","BaseError","e","NonceTooLowError","NonceTooHighError","mempoolQueue","nonceManagers","getNonceManager","client","address","blockTag","opts","id","getNonceManagerId","nonceManager","createNonceManager","getChainId","estimateFeesPerGas","getAction","createFeeRef","client","args","refreshInterval","feeRef","updateFees","fees","getAction","feeRefs","getFeeRef","opts","chainId","getChainId","existingFeeRef","feeRef","createFeeRef","viem_writeContract","pRetry","parseAccount","getAction","debug","writeContract","client","request","opts","rawAccount","account","parseAccount","chain","nonceManager","getNonceManager","feeRef","getFeeRef","pRetry","nonce","params","viem_writeContract","error","viem_sendTransaction","pRetry","parseAccount","getAction","debug","sendTransaction","client","request","opts","rawAccount","account","parseAccount","chain","nonceManager","getNonceManager","feeRef","getFeeRef","pRetry","nonce","params","viem_sendTransaction","error"]}
|