permissionless 0.0.11 → 0.0.13
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/CHANGELOG.md +16 -0
- package/_cjs/accounts/index.js +14 -0
- package/_cjs/accounts/index.js.map +1 -0
- package/_cjs/accounts/privateKeyToSafeSmartAccount.js +24 -0
- package/_cjs/accounts/privateKeyToSafeSmartAccount.js.map +1 -0
- package/_cjs/accounts/privateKeyToSimpleSmartAccount.js +16 -0
- package/_cjs/accounts/privateKeyToSimpleSmartAccount.js.map +1 -0
- package/_cjs/accounts/signerToSafeSmartAccount.js +492 -0
- package/_cjs/accounts/signerToSafeSmartAccount.js.map +1 -0
- package/_cjs/accounts/signerToSimpleSmartAccount.js +190 -0
- package/_cjs/accounts/signerToSimpleSmartAccount.js.map +1 -0
- package/_cjs/accounts/types.js +23 -0
- package/_cjs/accounts/types.js.map +1 -0
- package/_cjs/actions/bundler/chainId.js.map +1 -1
- package/_cjs/actions/bundler/estimateUserOperationGas.js +4 -1
- package/_cjs/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_cjs/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/_cjs/actions/bundler/sendUserOperation.js +4 -1
- package/_cjs/actions/bundler/sendUserOperation.js.map +1 -1
- package/_cjs/actions/bundler/supportedEntryPoints.js.map +1 -1
- package/_cjs/actions/bundler/waitForUserOperationReceipt.js +7 -2
- package/_cjs/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
- package/_cjs/actions/index.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_cjs/actions/pimlico/getUserOperationStatus.js.map +1 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js +4 -1
- package/_cjs/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_cjs/actions/pimlico.js.map +1 -1
- package/_cjs/actions/public/getAccountNonce.js +4 -2
- package/_cjs/actions/public/getAccountNonce.js.map +1 -1
- package/_cjs/actions/public/getSenderAddress.js +7 -3
- package/_cjs/actions/public/getSenderAddress.js.map +1 -1
- package/_cjs/actions/smartAccount/deployContract.js +38 -0
- package/_cjs/actions/smartAccount/deployContract.js.map +1 -0
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js +73 -0
- package/_cjs/actions/smartAccount/prepareUserOperationRequest.js.map +1 -0
- package/_cjs/actions/smartAccount/sendTransaction.js +44 -0
- package/_cjs/actions/smartAccount/sendTransaction.js.map +1 -0
- package/_cjs/actions/smartAccount/sendTransactions.js +46 -0
- package/_cjs/actions/smartAccount/sendTransactions.js.map +1 -0
- package/_cjs/actions/smartAccount/sendUserOperation.js +22 -0
- package/_cjs/actions/smartAccount/sendUserOperation.js.map +1 -0
- package/_cjs/actions/smartAccount/signMessage.js +16 -0
- package/_cjs/actions/smartAccount/signMessage.js.map +1 -0
- package/_cjs/actions/smartAccount/signTypedData.js +34 -0
- package/_cjs/actions/smartAccount/signTypedData.js.map +1 -0
- package/_cjs/actions/smartAccount/writeContract.js +21 -0
- package/_cjs/actions/smartAccount/writeContract.js.map +1 -0
- package/_cjs/actions/smartAccount.js +18 -0
- package/_cjs/actions/smartAccount.js.map +1 -0
- package/_cjs/actions/stackup/sponsorUserOperation.js +5 -1
- package/_cjs/actions/stackup/sponsorUserOperation.js.map +1 -1
- package/_cjs/clients/{bundler.js → createBundlerClient.js} +1 -1
- package/_cjs/clients/createBundlerClient.js.map +1 -0
- package/_cjs/clients/createSmartAccountClient.js +20 -0
- package/_cjs/clients/createSmartAccountClient.js.map +1 -0
- package/_cjs/clients/decorators/bundler.js.map +1 -1
- package/_cjs/clients/decorators/pimlico.js.map +1 -1
- package/_cjs/clients/decorators/smartAccount.js +33 -0
- package/_cjs/clients/decorators/smartAccount.js.map +1 -0
- package/_cjs/clients/decorators/stackup.js.map +1 -1
- package/_cjs/clients/pimlico.js.map +1 -1
- package/_cjs/clients/stackup.js.map +1 -1
- package/_cjs/index.js +9 -5
- package/_cjs/index.js.map +1 -1
- package/_cjs/utils/deepHexlify.js +4 -4
- package/_cjs/utils/deepHexlify.js.map +1 -1
- package/_cjs/utils/getAction.js +8 -0
- package/_cjs/utils/getAction.js.map +1 -0
- package/_cjs/utils/getUserOperationHash.js.map +1 -1
- package/_cjs/utils/index.js +7 -1
- package/_cjs/utils/index.js.map +1 -1
- package/_cjs/utils/observe.js +7 -2
- package/_cjs/utils/observe.js.map +1 -1
- package/_cjs/utils/signUserOperationHashWithECDSA.js +7 -7
- package/_cjs/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_esm/accounts/index.js +7 -0
- package/_esm/accounts/index.js.map +1 -0
- package/_esm/accounts/privateKeyToSafeSmartAccount.js +26 -0
- package/_esm/accounts/privateKeyToSafeSmartAccount.js.map +1 -0
- package/_esm/accounts/privateKeyToSimpleSmartAccount.js +18 -0
- package/_esm/accounts/privateKeyToSimpleSmartAccount.js.map +1 -0
- package/_esm/accounts/signerToSafeSmartAccount.js +499 -0
- package/_esm/accounts/signerToSafeSmartAccount.js.map +1 -0
- package/_esm/accounts/signerToSimpleSmartAccount.js +191 -0
- package/_esm/accounts/signerToSimpleSmartAccount.js.map +1 -0
- package/_esm/accounts/types.js +20 -0
- package/_esm/accounts/types.js.map +1 -0
- package/_esm/actions/bundler/chainId.js.map +1 -1
- package/_esm/actions/bundler/estimateUserOperationGas.js +4 -1
- package/_esm/actions/bundler/estimateUserOperationGas.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationByHash.js.map +1 -1
- package/_esm/actions/bundler/getUserOperationReceipt.js.map +1 -1
- package/_esm/actions/bundler/sendUserOperation.js +4 -3
- package/_esm/actions/bundler/sendUserOperation.js.map +1 -1
- package/_esm/actions/bundler/supportedEntryPoints.js.map +1 -1
- package/_esm/actions/bundler/waitForUserOperationReceipt.js +7 -2
- package/_esm/actions/bundler/waitForUserOperationReceipt.js.map +1 -1
- package/_esm/actions/index.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationGasPrice.js +2 -2
- package/_esm/actions/pimlico/getUserOperationGasPrice.js.map +1 -1
- package/_esm/actions/pimlico/getUserOperationStatus.js +1 -1
- package/_esm/actions/pimlico/getUserOperationStatus.js.map +1 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js +4 -1
- package/_esm/actions/pimlico/sponsorUserOperation.js.map +1 -1
- package/_esm/actions/pimlico.js.map +1 -1
- package/_esm/actions/public/getAccountNonce.js +7 -5
- package/_esm/actions/public/getAccountNonce.js.map +1 -1
- package/_esm/actions/public/getSenderAddress.js +8 -5
- package/_esm/actions/public/getSenderAddress.js.map +1 -1
- package/_esm/actions/smartAccount/deployContract.js +64 -0
- package/_esm/actions/smartAccount/deployContract.js.map +1 -0
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js +69 -0
- package/_esm/actions/smartAccount/prepareUserOperationRequest.js.map +1 -0
- package/_esm/actions/smartAccount/sendTransaction.js +88 -0
- package/_esm/actions/smartAccount/sendTransaction.js.map +1 -0
- package/_esm/actions/smartAccount/sendTransactions.js +90 -0
- package/_esm/actions/smartAccount/sendTransactions.js.map +1 -0
- package/_esm/actions/smartAccount/sendUserOperation.js +18 -0
- package/_esm/actions/smartAccount/sendUserOperation.js.map +1 -0
- package/_esm/actions/smartAccount/signMessage.js +59 -0
- package/_esm/actions/smartAccount/signMessage.js.map +1 -0
- package/_esm/actions/smartAccount/signTypedData.js +129 -0
- package/_esm/actions/smartAccount/signTypedData.js.map +1 -0
- package/_esm/actions/smartAccount/writeContract.js +19 -0
- package/_esm/actions/smartAccount/writeContract.js.map +1 -0
- package/_esm/actions/smartAccount.js +9 -0
- package/_esm/actions/smartAccount.js.map +1 -0
- package/_esm/actions/stackup/accounts.js +1 -1
- package/_esm/actions/stackup/sponsorUserOperation.js +6 -2
- package/_esm/actions/stackup/sponsorUserOperation.js.map +1 -1
- package/_esm/clients/{bundler.js → createBundlerClient.js} +1 -1
- package/_esm/clients/createBundlerClient.js.map +1 -0
- package/_esm/clients/createSmartAccountClient.js +38 -0
- package/_esm/clients/createSmartAccountClient.js.map +1 -0
- package/_esm/clients/decorators/bundler.js.map +1 -1
- package/_esm/clients/decorators/pimlico.js +1 -1
- package/_esm/clients/decorators/pimlico.js.map +1 -1
- package/_esm/clients/decorators/smartAccount.js +29 -0
- package/_esm/clients/decorators/smartAccount.js.map +1 -0
- package/_esm/clients/decorators/stackup.js.map +1 -1
- package/_esm/clients/pimlico.js +1 -1
- package/_esm/clients/pimlico.js.map +1 -1
- package/_esm/clients/stackup.js +1 -1
- package/_esm/clients/stackup.js.map +1 -1
- package/_esm/index.js +5 -2
- package/_esm/index.js.map +1 -1
- package/_esm/utils/deepHexlify.js +6 -4
- package/_esm/utils/deepHexlify.js.map +1 -1
- package/_esm/utils/getAction.js +6 -0
- package/_esm/utils/getAction.js.map +1 -0
- package/_esm/utils/getUserOperationHash.js.map +1 -1
- package/_esm/utils/index.js +5 -0
- package/_esm/utils/index.js.map +1 -1
- package/_esm/utils/observe.js +7 -2
- package/_esm/utils/observe.js.map +1 -1
- package/_esm/utils/signUserOperationHashWithECDSA.js +7 -6
- package/_esm/utils/signUserOperationHashWithECDSA.js.map +1 -1
- package/_types/accounts/index.d.ts +7 -0
- package/_types/accounts/index.d.ts.map +1 -0
- package/_types/accounts/privateKeyToSafeSmartAccount.d.ts +26 -0
- package/_types/accounts/privateKeyToSafeSmartAccount.d.ts.map +1 -0
- package/_types/accounts/privateKeyToSimpleSmartAccount.d.ts +14 -0
- package/_types/accounts/privateKeyToSimpleSmartAccount.d.ts.map +1 -0
- package/_types/accounts/signerToSafeSmartAccount.d.ts +28 -0
- package/_types/accounts/signerToSafeSmartAccount.d.ts.map +1 -0
- package/_types/accounts/signerToSimpleSmartAccount.d.ts +15 -0
- package/_types/accounts/signerToSimpleSmartAccount.d.ts.map +1 -0
- package/_types/accounts/types.d.ts +32 -0
- package/_types/accounts/types.d.ts.map +1 -0
- package/_types/actions/bundler/chainId.d.ts +3 -2
- package/_types/actions/bundler/chainId.d.ts.map +1 -1
- package/_types/actions/bundler/estimateUserOperationGas.d.ts +3 -3
- package/_types/actions/bundler/estimateUserOperationGas.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationByHash.d.ts +3 -3
- package/_types/actions/bundler/getUserOperationByHash.d.ts.map +1 -1
- package/_types/actions/bundler/getUserOperationReceipt.d.ts +3 -3
- package/_types/actions/bundler/getUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/bundler/sendUserOperation.d.ts +3 -5
- package/_types/actions/bundler/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/bundler/supportedEntryPoints.d.ts +3 -3
- package/_types/actions/bundler/supportedEntryPoints.d.ts.map +1 -1
- package/_types/actions/bundler/waitForUserOperationReceipt.d.ts +2 -3
- package/_types/actions/bundler/waitForUserOperationReceipt.d.ts.map +1 -1
- package/_types/actions/index.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts +5 -4
- package/_types/actions/pimlico/getUserOperationGasPrice.d.ts.map +1 -1
- package/_types/actions/pimlico/getUserOperationStatus.d.ts +4 -5
- package/_types/actions/pimlico/getUserOperationStatus.d.ts.map +1 -1
- package/_types/actions/pimlico/sponsorUserOperation.d.ts +3 -3
- package/_types/actions/pimlico/sponsorUserOperation.d.ts.map +1 -1
- package/_types/actions/pimlico.d.ts.map +1 -1
- package/_types/actions/public/getAccountNonce.d.ts +5 -5
- package/_types/actions/public/getAccountNonce.d.ts.map +1 -1
- package/_types/actions/public/getSenderAddress.d.ts +3 -4
- package/_types/actions/public/getSenderAddress.d.ts.map +1 -1
- package/_types/actions/smartAccount/deployContract.d.ts +34 -0
- package/_types/actions/smartAccount/deployContract.d.ts.map +1 -0
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts +20 -0
- package/_types/actions/smartAccount/prepareUserOperationRequest.d.ts.map +1 -0
- package/_types/actions/smartAccount/sendTransaction.d.ts +52 -0
- package/_types/actions/smartAccount/sendTransaction.d.ts.map +1 -0
- package/_types/actions/smartAccount/sendTransactions.d.ts +63 -0
- package/_types/actions/smartAccount/sendTransactions.d.ts.map +1 -0
- package/_types/actions/smartAccount/sendUserOperation.d.ts +10 -0
- package/_types/actions/smartAccount/sendUserOperation.d.ts.map +1 -0
- package/_types/actions/smartAccount/signMessage.d.ts +50 -0
- package/_types/actions/smartAccount/signMessage.d.ts.map +1 -0
- package/_types/actions/smartAccount/signTypedData.d.ts +104 -0
- package/_types/actions/smartAccount/signTypedData.d.ts.map +1 -0
- package/_types/actions/smartAccount/writeContract.d.ts +57 -0
- package/_types/actions/smartAccount/writeContract.d.ts.map +1 -0
- package/_types/actions/smartAccount.d.ts +9 -0
- package/_types/actions/smartAccount.d.ts.map +1 -0
- package/_types/actions/stackup/accounts.d.ts +1 -1
- package/_types/actions/stackup/sponsorUserOperation.d.ts +1 -1
- package/_types/actions/stackup/sponsorUserOperation.d.ts.map +1 -1
- package/_types/clients/{bundler.d.ts → createBundlerClient.d.ts} +1 -1
- package/_types/clients/createBundlerClient.d.ts.map +1 -0
- package/_types/clients/createSmartAccountClient.d.ts +282 -0
- package/_types/clients/createSmartAccountClient.d.ts.map +1 -0
- package/_types/clients/decorators/bundler.d.ts +1 -1
- package/_types/clients/decorators/bundler.d.ts.map +1 -1
- package/_types/clients/decorators/pimlico.d.ts +3 -3
- package/_types/clients/decorators/pimlico.d.ts.map +1 -1
- package/_types/clients/decorators/smartAccount.d.ts +327 -0
- package/_types/clients/decorators/smartAccount.d.ts.map +1 -0
- package/_types/clients/decorators/stackup.d.ts.map +1 -1
- package/_types/clients/pimlico.d.ts +1 -1
- package/_types/clients/pimlico.d.ts.map +1 -1
- package/_types/clients/stackup.d.ts +1 -1
- package/_types/clients/stackup.d.ts.map +1 -1
- package/_types/index.d.ts +6 -3
- package/_types/index.d.ts.map +1 -1
- package/_types/types/bundler.d.ts +4 -1
- package/_types/types/bundler.d.ts.map +1 -1
- package/_types/types/index.d.ts +20 -0
- package/_types/types/index.d.ts.map +1 -1
- package/_types/types/pimlico.d.ts.map +1 -1
- package/_types/types/stackup.d.ts.map +1 -1
- package/_types/utils/deepHexlify.d.ts.map +1 -1
- package/_types/utils/getAction.d.ts +3 -0
- package/_types/utils/getAction.d.ts.map +1 -0
- package/_types/utils/getUserOperationHash.d.ts.map +1 -1
- package/_types/utils/index.d.ts +2 -0
- package/_types/utils/index.d.ts.map +1 -1
- package/_types/utils/observe.d.ts.map +1 -1
- package/_types/utils/signUserOperationHashWithECDSA.d.ts +3 -11
- package/_types/utils/signUserOperationHashWithECDSA.d.ts.map +1 -1
- package/accounts/index.ts +33 -0
- package/accounts/privateKeyToSafeSmartAccount.ts +73 -0
- package/accounts/privateKeyToSimpleSmartAccount.ts +44 -0
- package/accounts/signerToSafeSmartAccount.ts +775 -0
- package/accounts/signerToSimpleSmartAccount.ts +267 -0
- package/accounts/types.ts +64 -0
- package/actions/bundler/chainId.ts +10 -2
- package/actions/bundler/estimateUserOperationGas.ts +17 -6
- package/actions/bundler/getUserOperationByHash.ts +16 -5
- package/actions/bundler/getUserOperationReceipt.ts +17 -4
- package/actions/bundler/sendUserOperation.ts +19 -7
- package/actions/bundler/supportedEntryPoints.ts +10 -3
- package/actions/bundler/waitForUserOperationReceipt.ts +64 -26
- package/actions/index.ts +4 -1
- package/actions/pimlico/getUserOperationGasPrice.ts +13 -6
- package/actions/pimlico/getUserOperationStatus.ts +12 -5
- package/actions/pimlico/sponsorUserOperation.ts +20 -7
- package/actions/pimlico.ts +8 -2
- package/actions/public/getAccountNonce.ts +20 -8
- package/actions/public/getSenderAddress.ts +25 -8
- package/actions/smartAccount/deployContract.ts +110 -0
- package/actions/smartAccount/prepareUserOperationRequest.ts +140 -0
- package/actions/smartAccount/sendTransaction.ts +138 -0
- package/actions/smartAccount/sendTransactions.ts +141 -0
- package/actions/smartAccount/sendUserOperation.ts +70 -0
- package/actions/smartAccount/signMessage.ts +79 -0
- package/actions/smartAccount/signTypedData.ts +161 -0
- package/actions/smartAccount/writeContract.ts +126 -0
- package/actions/smartAccount.ts +49 -0
- package/actions/stackup/accounts.ts +1 -1
- package/actions/stackup/sponsorUserOperation.ts +14 -4
- package/clients/{bundler.ts → createBundlerClient.ts} +14 -3
- package/clients/createSmartAccountClient.ts +95 -0
- package/clients/decorators/bundler.ts +20 -10
- package/clients/decorators/pimlico.ts +21 -9
- package/clients/decorators/smartAccount.ts +451 -0
- package/clients/decorators/stackup.ts +12 -4
- package/clients/pimlico.ts +20 -5
- package/clients/stackup.ts +17 -4
- package/index.ts +20 -3
- package/package.json +12 -2
- package/types/bundler.ts +4 -1
- package/types/index.ts +29 -0
- package/types/pimlico.ts +12 -2
- package/types/stackup.ts +4 -1
- package/utils/deepHexlify.test.ts +13 -7
- package/utils/deepHexlify.ts +5 -4
- package/utils/getAction.ts +15 -0
- package/utils/getUserOperationHash.ts +10 -2
- package/utils/index.ts +15 -2
- package/utils/observe.ts +18 -5
- package/utils/signUserOperationHashWithECDSA.ts +17 -20
- package/_cjs/clients/bundler.js.map +0 -1
- package/_esm/clients/bundler.js.map +0 -1
- package/_types/clients/bundler.d.ts.map +0 -1
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kCAAkC,EAClC,kCAAkC,EACrC,MAAM,uCAAuC,CAAA;AAC9C,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAA;AAC3F,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAA;AAC3F,OAAO,KAAK,EACR,iCAAiC,EACjC,iCAAiC,EACpC,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAEjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../actions/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,kCAAkC,EAClC,kCAAkC,EACrC,MAAM,uCAAuC,CAAA;AAC9C,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAA;AAC3F,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAA;AAC3F,OAAO,KAAK,EACR,iCAAiC,EACjC,iCAAiC,EACpC,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,gCAAgC,CAAA;AAEjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EACnB,MAAM,8BAA8B,CAAA;AAErC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAA;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAA;AACxE,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAA;AACtF,OAAO,EACH,KAAK,qCAAqC,EAC1C,uCAAuC,EAC1C,MAAM,0CAA0C,CAAA;AACjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D,YAAY,EACR,2BAA2B,EAC3B,kCAAkC,EAClC,kCAAkC,EAClC,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,EACjC,iCAAiC,EACjC,sBAAsB,EACtB,qBAAqB,EACrB,qCAAqC,EACxC,CAAA;AAED,OAAO,EACH,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,OAAO,EACP,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACtB,2BAA2B,EAC3B,uCAAuC,EAC1C,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Account, Chain, Client, Transport } from "viem";
|
|
2
|
+
import type { PimlicoBundlerRpcSchema } from "../../types/pimlico.js";
|
|
2
3
|
export type GetUserOperationGasPriceReturnType = {
|
|
3
4
|
slow: {
|
|
4
5
|
maxFeePerGas: bigint;
|
|
@@ -18,7 +19,7 @@ export type GetUserOperationGasPriceReturnType = {
|
|
|
18
19
|
*
|
|
19
20
|
* - Docs: https://docs.pimlico.io/permissionless/reference/pimlico-bundler-actions/getUserOperationGasPrice
|
|
20
21
|
*
|
|
21
|
-
* @param client
|
|
22
|
+
* @param client that you created using viem's createClient whose transport url is pointing to the Pimlico's bundler.
|
|
22
23
|
* @returns slow, standard & fast values for maxFeePerGas & maxPriorityFeePerGas
|
|
23
24
|
*
|
|
24
25
|
*
|
|
@@ -28,11 +29,11 @@ export type GetUserOperationGasPriceReturnType = {
|
|
|
28
29
|
*
|
|
29
30
|
* const bundlerClient = createClient({
|
|
30
31
|
* chain: goerli,
|
|
31
|
-
* transport: http("https://api.pimlico.io/
|
|
32
|
+
* transport: http("https://api.pimlico.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE")
|
|
32
33
|
* })
|
|
33
34
|
*
|
|
34
35
|
* await getUserOperationGasPrice(bundlerClient)
|
|
35
36
|
*
|
|
36
37
|
*/
|
|
37
|
-
export declare const getUserOperationGasPrice: (client:
|
|
38
|
+
export declare const getUserOperationGasPrice: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>(client: Client<TTransport, TChain, TAccount, PimlicoBundlerRpcSchema>) => Promise<GetUserOperationGasPriceReturnType>;
|
|
38
39
|
//# sourceMappingURL=getUserOperationGasPrice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserOperationGasPrice.d.ts","sourceRoot":"","sources":["../../../actions/pimlico/getUserOperationGasPrice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"getUserOperationGasPrice.d.ts","sourceRoot":"","sources":["../../../actions/pimlico/getUserOperationGasPrice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAC7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAErE,MAAM,MAAM,kCAAkC,GAAG;IAC7C,IAAI,EAAE;QACF,YAAY,EAAE,MAAM,CAAA;QACpB,oBAAoB,EAAE,MAAM,CAAA;KAC/B,CAAA;IACD,QAAQ,EAAE;QACN,YAAY,EAAE,MAAM,CAAA;QACpB,oBAAoB,EAAE,MAAM,CAAA;KAC/B,CAAA;IACD,IAAI,EAAE;QACF,YAAY,EAAE,MAAM,CAAA;QACpB,oBAAoB,EAAE,MAAM,CAAA;KAC/B,CAAA;CACJ,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,wBAAwB,yOAMlC,QAAQ,kCAAkC,CAsB5C,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Hash } from "viem";
|
|
2
|
-
import type {
|
|
3
|
-
import type { PimlicoUserOperationStatus } from "../../types/pimlico.js";
|
|
1
|
+
import type { Account, Chain, Client, Hash, Transport } from "viem";
|
|
2
|
+
import type { PimlicoBundlerRpcSchema, PimlicoUserOperationStatus } from "../../types/pimlico.js";
|
|
4
3
|
export type GetUserOperationStatusParameters = {
|
|
5
4
|
hash: Hash;
|
|
6
5
|
};
|
|
@@ -21,11 +20,11 @@ export type GetUserOperationStatusReturnType = PimlicoUserOperationStatus;
|
|
|
21
20
|
*
|
|
22
21
|
* const bundlerClient = createClient({
|
|
23
22
|
* chain: goerli,
|
|
24
|
-
* transport: http("https://api.pimlico.io/
|
|
23
|
+
* transport: http("https://api.pimlico.io/v2/goerli/rpc?apikey=YOUR_API_KEY_HERE")
|
|
25
24
|
* })
|
|
26
25
|
*
|
|
27
26
|
* await getUserOperationStatus(bundlerClient, { hash: userOpHash })
|
|
28
27
|
*
|
|
29
28
|
*/
|
|
30
|
-
export declare const getUserOperationStatus: (client:
|
|
29
|
+
export declare const getUserOperationStatus: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>(client: Client<TTransport, TChain, TAccount, PimlicoBundlerRpcSchema>, { hash }: GetUserOperationStatusParameters) => Promise<GetUserOperationStatusReturnType>;
|
|
31
30
|
//# sourceMappingURL=getUserOperationStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserOperationStatus.d.ts","sourceRoot":"","sources":["../../../actions/pimlico/getUserOperationStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"getUserOperationStatus.d.ts","sourceRoot":"","sources":["../../../actions/pimlico/getUserOperationStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAEnE,OAAO,KAAK,EACR,uBAAuB,EACvB,0BAA0B,EAC7B,MAAM,wBAAwB,CAAA;AAE/B,MAAM,MAAM,gCAAgC,GAAG;IAC3C,IAAI,EAAE,IAAI,CAAA;CACb,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,CAAA;AAEzE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,sBAAsB,gPAMrB,gCAAgC,KAC3C,QAAQ,gCAAgC,CAK1C,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Address, Hex } from "viem";
|
|
1
|
+
import type { Account, Address, Chain, Client, Hex, Transport } from "viem";
|
|
2
2
|
import type { PartialBy } from "viem/types/utils";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PimlicoPaymasterRpcSchema } from "../../types/pimlico.js";
|
|
4
4
|
import type { UserOperation } from "../../types/userOperation.js";
|
|
5
5
|
export type SponsorUserOperationParameters = {
|
|
6
6
|
userOperation: PartialBy<UserOperation, "callGasLimit" | "preVerificationGas" | "verificationGasLimit" | "paymasterAndData">;
|
|
@@ -37,5 +37,5 @@ export type SponsorUserOperationReturnType = {
|
|
|
37
37
|
* }})
|
|
38
38
|
*
|
|
39
39
|
*/
|
|
40
|
-
export declare const sponsorUserOperation: (client:
|
|
40
|
+
export declare const sponsorUserOperation: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends Account | undefined = Account | undefined>(client: Client<TTransport, TChain, TAccount, PimlicoPaymasterRpcSchema>, args: SponsorUserOperationParameters) => Promise<SponsorUserOperationReturnType>;
|
|
41
41
|
//# sourceMappingURL=sponsorUserOperation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sponsorUserOperation.d.ts","sourceRoot":"","sources":["../../../actions/pimlico/sponsorUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"sponsorUserOperation.d.ts","sourceRoot":"","sources":["../../../actions/pimlico/sponsorUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AACvE,OAAO,KAAK,EACR,aAAa,EAEhB,MAAM,8BAA8B,CAAA;AAGrC,MAAM,MAAM,8BAA8B,GAAG;IACzC,aAAa,EAAE,SAAS,CACpB,aAAa,EACX,cAAc,GACd,oBAAoB,GACpB,sBAAsB,GACtB,kBAAkB,CACvB,CAAA;IACD,UAAU,EAAE,OAAO,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IACzC,gBAAgB,EAAE,GAAG,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,oBAAoB,EAAE,MAAM,CAAA;IAC5B,YAAY,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,oBAAoB,8OAMvB,8BAA8B,KACrC,QAAQ,8BAA8B,CAexC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../actions/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,kCAAkC,EACvC,wBAAwB,EAC3B,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,EACrC,sBAAsB,EACzB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,oBAAoB,EACvB,MAAM,mCAAmC,CAAA;AAE1C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pimlico.d.ts","sourceRoot":"","sources":["../../actions/pimlico.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,kCAAkC,EACvC,wBAAwB,EAC3B,MAAM,uCAAuC,CAAA;AAC9C,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,gCAAgC,EACrC,sBAAsB,EACzB,MAAM,qCAAqC,CAAA;AAC5C,OAAO,EACH,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACnC,oBAAoB,EACvB,MAAM,mCAAmC,CAAA;AAE1C,OAAO,KAAK,EACR,qBAAqB,EACrB,6BAA6B,EAChC,MAAM,kCAAkC,CAAA;AACzC,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EAC1B,MAAM,kCAAkC,CAAA;AAEzC,YAAY,EACR,kCAAkC,EAClC,gCAAgC,EAChC,gCAAgC,EAChC,8BAA8B,EAC9B,8BAA8B,EAC9B,qBAAqB,EACrB,6BAA6B,EAChC,CAAA;AAED,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EAC1B,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Address,
|
|
1
|
+
import type { Address, Chain, Client, Transport } from "viem";
|
|
2
2
|
export type GetAccountNonceParams = {
|
|
3
3
|
sender: Address;
|
|
4
4
|
entryPoint: Address;
|
|
@@ -9,7 +9,7 @@ export type GetAccountNonceParams = {
|
|
|
9
9
|
*
|
|
10
10
|
* - Docs: https://docs.pimlico.io/permissionless/reference/public-actions/getAccountNonce
|
|
11
11
|
*
|
|
12
|
-
* @param
|
|
12
|
+
* @param client {@link client} that you created using viem's createPublicClient.
|
|
13
13
|
* @param args {@link GetAccountNonceParams} address, entryPoint & key
|
|
14
14
|
* @returns bigint nonce
|
|
15
15
|
*
|
|
@@ -17,12 +17,12 @@ export type GetAccountNonceParams = {
|
|
|
17
17
|
* import { createPublicClient } from "viem"
|
|
18
18
|
* import { getAccountNonce } from "permissionless/actions"
|
|
19
19
|
*
|
|
20
|
-
* const
|
|
20
|
+
* const client = createPublicClient({
|
|
21
21
|
* chain: goerli,
|
|
22
22
|
* transport: http("https://goerli.infura.io/v3/your-infura-key")
|
|
23
23
|
* })
|
|
24
24
|
*
|
|
25
|
-
* const nonce = await getAccountNonce(
|
|
25
|
+
* const nonce = await getAccountNonce(client, {
|
|
26
26
|
* address,
|
|
27
27
|
* entryPoint,
|
|
28
28
|
* key
|
|
@@ -30,5 +30,5 @@ export type GetAccountNonceParams = {
|
|
|
30
30
|
*
|
|
31
31
|
* // Return 0n
|
|
32
32
|
*/
|
|
33
|
-
export declare const getAccountNonce: (
|
|
33
|
+
export declare const getAccountNonce: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined>(client: Client<TTransport, TChain>, { sender, entryPoint, key }: GetAccountNonceParams) => Promise<bigint>;
|
|
34
34
|
//# sourceMappingURL=getAccountNonce.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getAccountNonce.d.ts","sourceRoot":"","sources":["../../../actions/public/getAccountNonce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getAccountNonce.d.ts","sourceRoot":"","sources":["../../../actions/public/getAccountNonce.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAI7D,MAAM,MAAM,qBAAqB,GAAG;IAChC,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,OAAO,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,eAAe,oKAKiB,qBAAqB,KAC/D,QAAQ,MAAM,CAgChB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Address, BaseError, type Hex, type
|
|
1
|
+
import { type Address, BaseError, type Chain, type Client, type Hex, type Transport } from "viem";
|
|
2
2
|
export type GetSenderAddressParams = {
|
|
3
3
|
initCode: Hex;
|
|
4
4
|
entryPoint: Address;
|
|
@@ -15,8 +15,7 @@ export declare class InvalidEntryPointError extends BaseError {
|
|
|
15
15
|
*
|
|
16
16
|
* - Docs: https://docs.pimlico.io/permissionless/reference/public-actions/getSenderAddress
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
* @param publicClient {@link PublicClient} that you created using viem's createPublicClient.
|
|
18
|
+
* @param client {@link Client} that you created using viem's createPublicClient.
|
|
20
19
|
* @param args {@link GetSenderAddressParams} initCode & entryPoint
|
|
21
20
|
* @returns Sender's Address
|
|
22
21
|
*
|
|
@@ -36,5 +35,5 @@ export declare class InvalidEntryPointError extends BaseError {
|
|
|
36
35
|
*
|
|
37
36
|
* // Return '0x7a88a206ba40b37a8c07a2b5688cf8b287318b63'
|
|
38
37
|
*/
|
|
39
|
-
export declare const getSenderAddress: (
|
|
38
|
+
export declare const getSenderAddress: <TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined>(client: Client<TTransport, TChain>, { initCode, entryPoint }: GetSenderAddressParams) => Promise<Address>;
|
|
40
39
|
//# sourceMappingURL=getSenderAddress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSenderAddress.d.ts","sourceRoot":"","sources":["../../../actions/public/getSenderAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,SAAS,
|
|
1
|
+
{"version":3,"file":"getSenderAddress.d.ts","sourceRoot":"","sources":["../../../actions/public/getSenderAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,OAAO,EACZ,SAAS,EACT,KAAK,KAAK,EACV,KAAK,MAAM,EAGX,KAAK,GAAG,EACR,KAAK,SAAS,EACjB,MAAM,MAAM,CAAA;AAKb,MAAM,MAAM,sBAAsB,GAAG;IAAE,QAAQ,EAAE,GAAG,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAA;AAE3E,qBAAa,sBAAuB,SAAQ,SAAS;IACxC,IAAI,SAA2B;gBAE5B,EACR,KAAK,EACL,UAAU,EACb,GAAE;QAAE,KAAK,CAAC,EAAE,SAAS,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAO;CAUtD;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,gBAAgB,iKAKC,sBAAsB,KACjD,QAAQ,OAAO,CAuDjB,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type Abi, type Chain, type Client, type DeployContractParameters, type DeployContractReturnType, type Transport } from "viem";
|
|
2
|
+
import type { SmartAccount } from "../../accounts/types.js";
|
|
3
|
+
import { type SponsorUserOperationMiddleware } from "./prepareUserOperationRequest.js";
|
|
4
|
+
export type DeployContractParametersWithPaymaster<TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[], TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartAccount | undefined = SmartAccount | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = DeployContractParameters<TAbi, TChain, TAccount, TChainOverride> & SponsorUserOperationMiddleware;
|
|
5
|
+
/**
|
|
6
|
+
* Deploys a contract to the network, given bytecode and constructor arguments.
|
|
7
|
+
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
8
|
+
*
|
|
9
|
+
* - Docs: https://viem.sh/docs/contract/deployContract.html
|
|
10
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/deploying-contracts
|
|
11
|
+
*
|
|
12
|
+
* @param client - Client to use
|
|
13
|
+
* @param parameters - {@link DeployContractParameters}
|
|
14
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link DeployContractReturnType}
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* import { createWalletClient, http } from 'viem'
|
|
18
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
19
|
+
* import { mainnet } from 'viem/chains'
|
|
20
|
+
* import { deployContract } from 'viem/contract'
|
|
21
|
+
*
|
|
22
|
+
* const client = createWalletClient({
|
|
23
|
+
* account: privateKeyToAccount('0x…'),
|
|
24
|
+
* chain: mainnet,
|
|
25
|
+
* transport: http(),
|
|
26
|
+
* })
|
|
27
|
+
* const hash = await deployContract(client, {
|
|
28
|
+
* abi: [],
|
|
29
|
+
* account: '0x…,
|
|
30
|
+
* bytecode: '0x608060405260405161083e38038061083e833981016040819052610...',
|
|
31
|
+
* })
|
|
32
|
+
*/
|
|
33
|
+
export declare function deployContract<const TAbi extends Abi | readonly unknown[], TChain extends Chain | undefined, TAccount extends SmartAccount | undefined, TChainOverride extends Chain | undefined>(client: Client<Transport, TChain, TAccount>, { abi, args, bytecode, sponsorUserOperation, ...request }: DeployContractParametersWithPaymaster): Promise<DeployContractReturnType>;
|
|
34
|
+
//# sourceMappingURL=deployContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployContract.d.ts","sourceRoot":"","sources":["../../../actions/smartAccount/deployContract.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,GAAG,EACR,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACjB,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAK3D,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAGtF,MAAM,MAAM,qCAAqC,CAC7C,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,GAAG,SAAS,OAAO,EAAE,EAChE,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,EACpE,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAC5D,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,GAChE,8BAA8B,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,cAAc,CAChC,KAAK,CAAC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EAC3C,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,YAAY,GAAG,SAAS,EACzC,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,EACI,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,oBAAoB,EACpB,GAAG,OAAO,EACb,EAAE,qCAAqC,GACzC,OAAO,CAAC,wBAAwB,CAAC,CA2CnC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Address, Chain, Client, Hex, Transport } from "viem";
|
|
2
|
+
import type { SmartAccount } from "../../accounts/types.js";
|
|
3
|
+
import type { GetAccountParameter, PartialBy, UserOperation } from "../../types/index.js";
|
|
4
|
+
export type SponsorUserOperationMiddleware = {
|
|
5
|
+
sponsorUserOperation?: (args: {
|
|
6
|
+
userOperation: UserOperation;
|
|
7
|
+
entryPoint: Address;
|
|
8
|
+
}) => Promise<{
|
|
9
|
+
paymasterAndData: Hex;
|
|
10
|
+
preVerificationGas: bigint;
|
|
11
|
+
verificationGasLimit: bigint;
|
|
12
|
+
callGasLimit: bigint;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
export type PrepareUserOperationRequestParameters<TAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
16
|
+
userOperation: PartialBy<UserOperation, "nonce" | "sender" | "initCode" | "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "maxFeePerGas" | "maxPriorityFeePerGas" | "paymasterAndData" | "signature">;
|
|
17
|
+
} & GetAccountParameter<TAccount> & SponsorUserOperationMiddleware;
|
|
18
|
+
export type PrepareUserOperationRequestReturnType = UserOperation;
|
|
19
|
+
export declare function prepareUserOperationRequest<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartAccount | undefined = SmartAccount | undefined>(client: Client<TTransport, TChain, TAccount>, args: PrepareUserOperationRequestParameters<TAccount>): Promise<PrepareUserOperationRequestReturnType>;
|
|
20
|
+
//# sourceMappingURL=prepareUserOperationRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepareUserOperationRequest.d.ts","sourceRoot":"","sources":["../../../actions/smartAccount/prepareUserOperationRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AAElE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EACR,mBAAmB,EACnB,SAAS,EACT,aAAa,EAChB,MAAM,sBAAsB,CAAA;AAQ7B,MAAM,MAAM,8BAA8B,GAAG;IACzC,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE;QAC1B,aAAa,EAAE,aAAa,CAAA;QAC5B,UAAU,EAAE,OAAO,CAAA;KACtB,KAAK,OAAO,CAAC;QACV,gBAAgB,EAAE,GAAG,CAAA;QACrB,kBAAkB,EAAE,MAAM,CAAA;QAC1B,oBAAoB,EAAE,MAAM,CAAA;QAC5B,YAAY,EAAE,MAAM,CAAA;KACvB,CAAC,CAAA;CACL,CAAA;AAED,MAAM,MAAM,qCAAqC,CAC7C,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,IACpE;IACA,aAAa,EAAE,SAAS,CACpB,aAAa,EACX,OAAO,GACP,QAAQ,GACR,UAAU,GACV,cAAc,GACd,sBAAsB,GACtB,oBAAoB,GACpB,cAAc,GACd,sBAAsB,GACtB,kBAAkB,GAClB,WAAW,CAChB,CAAA;CACJ,GAAG,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,8BAA8B,CAAA;AAElC,MAAM,MAAM,qCAAqC,GAAG,aAAa,CAAA;AAEjE,wBAAsB,2BAA2B,CAC7C,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,EAEpE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC5C,IAAI,EAAE,qCAAqC,CAAC,QAAQ,CAAC,GACtD,OAAO,CAAC,qCAAqC,CAAC,CAoFhD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Chain, Client, SendTransactionParameters, SendTransactionReturnType, Transport } from "viem";
|
|
2
|
+
import { type SmartAccount } from "../../accounts/types.js";
|
|
3
|
+
import { type SponsorUserOperationMiddleware } from "./prepareUserOperationRequest.js";
|
|
4
|
+
export type SendTransactionWithPaymasterParameters<TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartAccount | undefined = SmartAccount | undefined, TChainOverride extends Chain | undefined = Chain | undefined> = SendTransactionParameters<TChain, TAccount, TChainOverride> & SponsorUserOperationMiddleware;
|
|
5
|
+
/**
|
|
6
|
+
* Creates, signs, and sends a new transaction to the network.
|
|
7
|
+
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
8
|
+
*
|
|
9
|
+
* - Docs: https://viem.sh/docs/actions/wallet/sendTransaction.html
|
|
10
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/transactions/sending-transactions
|
|
11
|
+
* - JSON-RPC Methods:
|
|
12
|
+
* - JSON-RPC Accounts: [`eth_sendTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendtransaction)
|
|
13
|
+
* - Local Accounts: [`eth_sendRawTransaction`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction)
|
|
14
|
+
*
|
|
15
|
+
* @param client - Client to use
|
|
16
|
+
* @param parameters - {@link SendTransactionParameters}
|
|
17
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* import { createWalletClient, custom } from 'viem'
|
|
21
|
+
* import { mainnet } from 'viem/chains'
|
|
22
|
+
* import { sendTransaction } from 'viem/wallet'
|
|
23
|
+
*
|
|
24
|
+
* const client = createWalletClient({
|
|
25
|
+
* chain: mainnet,
|
|
26
|
+
* transport: custom(window.ethereum),
|
|
27
|
+
* })
|
|
28
|
+
* const hash = await sendTransaction(client, {
|
|
29
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
|
30
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
31
|
+
* value: 1000000000000000000n,
|
|
32
|
+
* })
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Account Hoisting
|
|
36
|
+
* import { createWalletClient, http } from 'viem'
|
|
37
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
38
|
+
* import { mainnet } from 'viem/chains'
|
|
39
|
+
* import { sendTransaction } from 'viem/wallet'
|
|
40
|
+
*
|
|
41
|
+
* const client = createWalletClient({
|
|
42
|
+
* account: privateKeyToAccount('0x…'),
|
|
43
|
+
* chain: mainnet,
|
|
44
|
+
* transport: http(),
|
|
45
|
+
* })
|
|
46
|
+
* const hash = await sendTransaction(client, {
|
|
47
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
48
|
+
* value: 1000000000000000000n,
|
|
49
|
+
* })
|
|
50
|
+
*/
|
|
51
|
+
export declare function sendTransaction<TChain extends Chain | undefined, TAccount extends SmartAccount | undefined, TChainOverride extends Chain | undefined>(client: Client<Transport, TChain, TAccount>, args: SendTransactionWithPaymasterParameters<TChain, TAccount, TChainOverride>): Promise<SendTransactionReturnType>;
|
|
52
|
+
//# sourceMappingURL=sendTransaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendTransaction.d.ts","sourceRoot":"","sources":["../../../actions/smartAccount/sendTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,KAAK,EACL,MAAM,EACN,yBAAyB,EACzB,yBAAyB,EACzB,SAAS,EACZ,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAO3D,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAGtF,MAAM,MAAM,sCAAsC,CAC9C,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,EACpE,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,IAC5D,yBAAyB,CAAC,MAAM,EAAE,QAAQ,EAAE,cAAc,CAAC,GAC3D,8BAA8B,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,eAAe,CACjC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,YAAY,GAAG,SAAS,EACzC,cAAc,SAAS,KAAK,GAAG,SAAS,EAExC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,IAAI,EAAE,sCAAsC,CACxC,MAAM,EACN,QAAQ,EACR,cAAc,CACjB,GACF,OAAO,CAAC,yBAAyB,CAAC,CAwDpC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Address, Chain, Client, Hex, SendTransactionReturnType, Transport } from "viem";
|
|
2
|
+
import { type SmartAccount } from "../../accounts/types.js";
|
|
3
|
+
import type { GetAccountParameter } from "../../types/index.js";
|
|
4
|
+
import { type SponsorUserOperationMiddleware } from "./prepareUserOperationRequest.js";
|
|
5
|
+
export type SendTransactionsWithPaymasterParameters<TAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
6
|
+
transactions: {
|
|
7
|
+
to: Address;
|
|
8
|
+
value: bigint;
|
|
9
|
+
data: Hex;
|
|
10
|
+
}[];
|
|
11
|
+
} & GetAccountParameter<TAccount> & SponsorUserOperationMiddleware & {
|
|
12
|
+
maxFeePerGas?: bigint;
|
|
13
|
+
maxPriorityFeePerGas?: bigint;
|
|
14
|
+
nonce?: bigint;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Creates, signs, and sends a new transactions to the network.
|
|
18
|
+
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
19
|
+
*
|
|
20
|
+
* @param client - Client to use
|
|
21
|
+
* @param parameters - {@link SendTransactionParameters}
|
|
22
|
+
* @returns The [Transaction](https://viem.sh/docs/glossary/terms.html#transaction) hash. {@link SendTransactionReturnType}
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* import { createWalletClient, custom } from 'viem'
|
|
26
|
+
* import { mainnet } from 'viem/chains'
|
|
27
|
+
* import { sendTransaction } from 'viem/wallet'
|
|
28
|
+
*
|
|
29
|
+
* const client = createWalletClient({
|
|
30
|
+
* chain: mainnet,
|
|
31
|
+
* transport: custom(window.ethereum),
|
|
32
|
+
* })
|
|
33
|
+
* const hash = await sendTransaction(client, [{
|
|
34
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
|
35
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
36
|
+
* value: 1000000000000000000n,
|
|
37
|
+
* }, {
|
|
38
|
+
* to: '0x61897970c51812dc3a010c7d01b50e0d17dc1234',
|
|
39
|
+
* value: 10000000000000000n,
|
|
40
|
+
* }])
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* // Account Hoisting
|
|
44
|
+
* import { createWalletClient, http } from 'viem'
|
|
45
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
46
|
+
* import { mainnet } from 'viem/chains'
|
|
47
|
+
* import { sendTransaction } from 'viem/wallet'
|
|
48
|
+
*
|
|
49
|
+
* const client = createWalletClient({
|
|
50
|
+
* account: privateKeyToAccount('0x…'),
|
|
51
|
+
* chain: mainnet,
|
|
52
|
+
* transport: http(),
|
|
53
|
+
* })
|
|
54
|
+
* const hash = await sendTransactions(client, [{
|
|
55
|
+
* to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
|
|
56
|
+
* value: 1000000000000000000n,
|
|
57
|
+
* }, {
|
|
58
|
+
* to: '0x61897970c51812dc3a010c7d01b50e0d17dc1234',
|
|
59
|
+
* value: 10000000000000000n,
|
|
60
|
+
* }])
|
|
61
|
+
*/
|
|
62
|
+
export declare function sendTransactions<TChain extends Chain | undefined, TAccount extends SmartAccount | undefined>(client: Client<Transport, TChain, TAccount>, args: SendTransactionsWithPaymasterParameters<TAccount>): Promise<SendTransactionReturnType>;
|
|
63
|
+
//# sourceMappingURL=sendTransactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendTransactions.d.ts","sourceRoot":"","sources":["../../../actions/smartAccount/sendTransactions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,OAAO,EACP,KAAK,EACL,MAAM,EACN,GAAG,EAEH,yBAAyB,EACzB,SAAS,EACZ,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAO/D,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAGtF,MAAM,MAAM,uCAAuC,CAC/C,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,IACpE;IACA,YAAY,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,EAAE,CAAA;CAC5D,GAAG,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,8BAA8B,GAAG;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAEL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,gBAAgB,CAClC,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,YAAY,GAAG,SAAS,EAEzC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,IAAI,EAAE,uCAAuC,CAAC,QAAQ,CAAC,GACxD,OAAO,CAAC,yBAAyB,CAAC,CAyDpC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Chain, Client, Hex, Transport } from "viem";
|
|
2
|
+
import type { SmartAccount } from "../../accounts/types.js";
|
|
3
|
+
import type { GetAccountParameter, PartialBy, UserOperation } from "../../types/index.js";
|
|
4
|
+
import { type SponsorUserOperationMiddleware } from "./prepareUserOperationRequest.js";
|
|
5
|
+
export type SendUserOperationParameters<TAccount extends SmartAccount | undefined = SmartAccount | undefined> = {
|
|
6
|
+
userOperation: PartialBy<UserOperation, "nonce" | "sender" | "initCode" | "signature" | "callGasLimit" | "maxFeePerGas" | "maxPriorityFeePerGas" | "preVerificationGas" | "verificationGasLimit" | "paymasterAndData">;
|
|
7
|
+
} & GetAccountParameter<TAccount> & SponsorUserOperationMiddleware;
|
|
8
|
+
export type SendUserOperationReturnType = Hex;
|
|
9
|
+
export declare function sendUserOperation<TTransport extends Transport = Transport, TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartAccount | undefined = SmartAccount | undefined>(client: Client<TTransport, TChain, TAccount>, args: SendUserOperationParameters<TAccount>): Promise<SendUserOperationReturnType>;
|
|
10
|
+
//# sourceMappingURL=sendUserOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sendUserOperation.d.ts","sourceRoot":"","sources":["../../../actions/smartAccount/sendUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,MAAM,CAAA;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EACR,mBAAmB,EACnB,SAAS,EACT,aAAa,EAChB,MAAM,sBAAsB,CAAA;AAO7B,OAAO,EACH,KAAK,8BAA8B,EAEtC,MAAM,kCAAkC,CAAA;AAEzC,MAAM,MAAM,2BAA2B,CACnC,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,IACpE;IACA,aAAa,EAAE,SAAS,CACpB,aAAa,EACX,OAAO,GACP,QAAQ,GACR,UAAU,GACV,WAAW,GACX,cAAc,GACd,cAAc,GACd,sBAAsB,GACtB,oBAAoB,GACpB,sBAAsB,GACtB,kBAAkB,CACvB,CAAA;CACJ,GAAG,mBAAmB,CAAC,QAAQ,CAAC,GAC7B,8BAA8B,CAAA;AAElC,MAAM,MAAM,2BAA2B,GAAG,GAAG,CAAA;AAE7C,wBAAsB,iBAAiB,CACnC,UAAU,SAAS,SAAS,GAAG,SAAS,EACxC,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,EAEpE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC5C,IAAI,EAAE,2BAA2B,CAAC,QAAQ,CAAC,GAC5C,OAAO,CAAC,2BAA2B,CAAC,CAuBtC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Chain, Client, SignMessageParameters, SignMessageReturnType, Transport } from "viem";
|
|
2
|
+
import { type SmartAccount } from "../../accounts/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
|
|
5
|
+
*
|
|
6
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signMessage.html
|
|
7
|
+
* - JSON-RPC Methods:
|
|
8
|
+
* - JSON-RPC Accounts: [`personal_sign`](https://docs.metamask.io/guide/signing-data.html#personal-sign)
|
|
9
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
|
10
|
+
*
|
|
11
|
+
* With the calculated signature, you can:
|
|
12
|
+
* - use [`verifyMessage`](https://viem.sh/docs/utilities/verifyMessage.html) to verify the signature,
|
|
13
|
+
* - use [`recoverMessageAddress`](https://viem.sh/docs/utilities/recoverMessageAddress.html) to recover the signing address from a signature.
|
|
14
|
+
*
|
|
15
|
+
* @param client - Client to use
|
|
16
|
+
* @param parameters - {@link SignMessageParameters}
|
|
17
|
+
* @returns The signed message. {@link SignMessageReturnType}
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* import { createWalletClient, custom } from 'viem'
|
|
21
|
+
* import { mainnet } from 'viem/chains'
|
|
22
|
+
* import { signMessage } from 'viem/wallet'
|
|
23
|
+
*
|
|
24
|
+
* const client = createWalletClient({
|
|
25
|
+
* chain: mainnet,
|
|
26
|
+
* transport: custom(window.ethereum),
|
|
27
|
+
* })
|
|
28
|
+
* const signature = await signMessage(client, {
|
|
29
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
|
30
|
+
* message: 'hello world',
|
|
31
|
+
* })
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Account Hoisting
|
|
35
|
+
* import { createWalletClient, custom } from 'viem'
|
|
36
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
37
|
+
* import { mainnet } from 'viem/chains'
|
|
38
|
+
* import { signMessage } from 'viem/wallet'
|
|
39
|
+
*
|
|
40
|
+
* const client = createWalletClient({
|
|
41
|
+
* account: privateKeyToAccount('0x…'),
|
|
42
|
+
* chain: mainnet,
|
|
43
|
+
* transport: custom(window.ethereum),
|
|
44
|
+
* })
|
|
45
|
+
* const signature = await signMessage(client, {
|
|
46
|
+
* message: 'hello world',
|
|
47
|
+
* })
|
|
48
|
+
*/
|
|
49
|
+
export declare function signMessage<TChain extends Chain | undefined, TAccount extends SmartAccount | undefined>(client: Client<Transport, TChain, TAccount>, { account: account_, message }: SignMessageParameters<TAccount>): Promise<SignMessageReturnType>;
|
|
50
|
+
//# sourceMappingURL=signMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signMessage.d.ts","sourceRoot":"","sources":["../../../actions/smartAccount/signMessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,KAAK,EACL,MAAM,EACN,qBAAqB,EACrB,qBAAqB,EACrB,SAAS,EACZ,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAM3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,WAAW,CAC7B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,YAAY,GAAG,SAAS,EAEzC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,EACI,OAAO,EAAE,QAAyB,EAClC,OAAO,EACV,EAAE,qBAAqB,CAAC,QAAQ,CAAC,GACnC,OAAO,CAAC,qBAAqB,CAAC,CAUhC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { type Chain, type Client, type SignTypedDataParameters, type SignTypedDataReturnType, type Transport, type TypedData } from "viem";
|
|
2
|
+
import { type SmartAccount } from "../../accounts/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))`
|
|
5
|
+
*
|
|
6
|
+
* - Docs: https://viem.sh/docs/actions/wallet/signTypedData.html
|
|
7
|
+
* - JSON-RPC Methods:
|
|
8
|
+
* - JSON-RPC Accounts: [`eth_signTypedData_v4`](https://docs.metamask.io/guide/signing-data.html#signtypeddata-v4)
|
|
9
|
+
* - Local Accounts: Signs locally. No JSON-RPC request.
|
|
10
|
+
*
|
|
11
|
+
* @param client - Client to use
|
|
12
|
+
* @param parameters - {@link SignTypedDataParameters}
|
|
13
|
+
* @returns The signed data. {@link SignTypedDataReturnType}
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* import { createWalletClient, custom } from 'viem'
|
|
17
|
+
* import { mainnet } from 'viem/chains'
|
|
18
|
+
* import { signTypedData } from 'viem/wallet'
|
|
19
|
+
*
|
|
20
|
+
* const client = createWalletClient({
|
|
21
|
+
* chain: mainnet,
|
|
22
|
+
* transport: custom(window.ethereum),
|
|
23
|
+
* })
|
|
24
|
+
* const signature = await signTypedData(client, {
|
|
25
|
+
* account: '0xA0Cf798816D4b9b9866b5330EEa46a18382f251e',
|
|
26
|
+
* domain: {
|
|
27
|
+
* name: 'Ether Mail',
|
|
28
|
+
* version: '1',
|
|
29
|
+
* chainId: 1,
|
|
30
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
31
|
+
* },
|
|
32
|
+
* types: {
|
|
33
|
+
* Person: [
|
|
34
|
+
* { name: 'name', type: 'string' },
|
|
35
|
+
* { name: 'wallet', type: 'address' },
|
|
36
|
+
* ],
|
|
37
|
+
* Mail: [
|
|
38
|
+
* { name: 'from', type: 'Person' },
|
|
39
|
+
* { name: 'to', type: 'Person' },
|
|
40
|
+
* { name: 'contents', type: 'string' },
|
|
41
|
+
* ],
|
|
42
|
+
* },
|
|
43
|
+
* primaryType: 'Mail',
|
|
44
|
+
* message: {
|
|
45
|
+
* from: {
|
|
46
|
+
* name: 'Cow',
|
|
47
|
+
* wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
|
48
|
+
* },
|
|
49
|
+
* to: {
|
|
50
|
+
* name: 'Bob',
|
|
51
|
+
* wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
|
52
|
+
* },
|
|
53
|
+
* contents: 'Hello, Bob!',
|
|
54
|
+
* },
|
|
55
|
+
* })
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Account Hoisting
|
|
59
|
+
* import { createWalletClient, http } from 'viem'
|
|
60
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
|
61
|
+
* import { mainnet } from 'viem/chains'
|
|
62
|
+
* import { signTypedData } from 'viem/wallet'
|
|
63
|
+
*
|
|
64
|
+
* const client = createWalletClient({
|
|
65
|
+
* account: privateKeyToAccount('0x…'),
|
|
66
|
+
* chain: mainnet,
|
|
67
|
+
* transport: http(),
|
|
68
|
+
* })
|
|
69
|
+
* const signature = await signTypedData(client, {
|
|
70
|
+
* domain: {
|
|
71
|
+
* name: 'Ether Mail',
|
|
72
|
+
* version: '1',
|
|
73
|
+
* chainId: 1,
|
|
74
|
+
* verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
|
|
75
|
+
* },
|
|
76
|
+
* types: {
|
|
77
|
+
* Person: [
|
|
78
|
+
* { name: 'name', type: 'string' },
|
|
79
|
+
* { name: 'wallet', type: 'address' },
|
|
80
|
+
* ],
|
|
81
|
+
* Mail: [
|
|
82
|
+
* { name: 'from', type: 'Person' },
|
|
83
|
+
* { name: 'to', type: 'Person' },
|
|
84
|
+
* { name: 'contents', type: 'string' },
|
|
85
|
+
* ],
|
|
86
|
+
* },
|
|
87
|
+
* primaryType: 'Mail',
|
|
88
|
+
* message: {
|
|
89
|
+
* from: {
|
|
90
|
+
* name: 'Cow',
|
|
91
|
+
* wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826',
|
|
92
|
+
* },
|
|
93
|
+
* to: {
|
|
94
|
+
* name: 'Bob',
|
|
95
|
+
* wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB',
|
|
96
|
+
* },
|
|
97
|
+
* contents: 'Hello, Bob!',
|
|
98
|
+
* },
|
|
99
|
+
* })
|
|
100
|
+
*/
|
|
101
|
+
export declare function signTypedData<const TTypedData extends TypedData | {
|
|
102
|
+
[key: string]: unknown;
|
|
103
|
+
}, TPrimaryType extends string, TChain extends Chain | undefined, TAccount extends SmartAccount | undefined>(client: Client<Transport, TChain, TAccount>, { account: account_, domain, message, primaryType, types: types_ }: SignTypedDataParameters<TTypedData, TPrimaryType, TAccount>): Promise<SignTypedDataReturnType>;
|
|
104
|
+
//# sourceMappingURL=signTypedData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signTypedData.d.ts","sourceRoot":"","sources":["../../../actions/smartAccount/signTypedData.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,KAAK,EACV,KAAK,MAAM,EACX,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,SAAS,EAIjB,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAM3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiGG;AACH,wBAAsB,aAAa,CAC/B,KAAK,CAAC,UAAU,SAAS,SAAS,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAC/D,YAAY,SAAS,MAAM,EAC3B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,YAAY,GAAG,SAAS,EAEzC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,EACI,OAAO,EAAE,QAAyB,EAClC,MAAM,EACN,OAAO,EACP,WAAW,EACX,KAAK,EAAE,MAAM,EAChB,EAAE,uBAAuB,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,CAAC,GAC/D,OAAO,CAAC,uBAAuB,CAAC,CA+BlC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type Abi, type Chain, type Client, type Transport, type WriteContractParameters, type WriteContractReturnType } from "viem";
|
|
2
|
+
import { type SmartAccount } from "../../accounts/types.js";
|
|
3
|
+
import { type SponsorUserOperationMiddleware } from "./prepareUserOperationRequest.js";
|
|
4
|
+
/**
|
|
5
|
+
* Executes a write function on a contract.
|
|
6
|
+
* This function also allows you to sponsor this transaction if sender is a smartAccount
|
|
7
|
+
*
|
|
8
|
+
* - Docs: https://viem.sh/docs/contract/writeContract.html
|
|
9
|
+
* - Examples: https://stackblitz.com/github/wagmi-dev/viem/tree/main/examples/contracts/writing-to-contracts
|
|
10
|
+
*
|
|
11
|
+
* A "write" function on a Solidity contract modifies the state of the blockchain. These types of functions require gas to be executed, and hence a [Transaction](https://viem.sh/docs/glossary/terms.html) is needed to be broadcast in order to change the state.
|
|
12
|
+
*
|
|
13
|
+
* Internally, uses a [Wallet Client](https://viem.sh/docs/clients/wallet.html) to call the [`sendTransaction` action](https://viem.sh/docs/actions/wallet/sendTransaction.html) with [ABI-encoded `data`](https://viem.sh/docs/contract/encodeFunctionData.html).
|
|
14
|
+
*
|
|
15
|
+
* __Warning: The `write` internally sends a transaction – it does not validate if the contract write will succeed (the contract may throw an error). It is highly recommended to [simulate the contract write with `contract.simulate`](https://viem.sh/docs/contract/writeContract.html#usage) before you execute it.__
|
|
16
|
+
*
|
|
17
|
+
* @param client - Client to use
|
|
18
|
+
* @param parameters - {@link WriteContractParameters}
|
|
19
|
+
* @returns A [Transaction Hash](https://viem.sh/docs/glossary/terms.html#hash). {@link WriteContractReturnType}
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import { createWalletClient, custom, parseAbi } from 'viem'
|
|
23
|
+
* import { mainnet } from 'viem/chains'
|
|
24
|
+
* import { writeContract } from 'viem/contract'
|
|
25
|
+
*
|
|
26
|
+
* const client = createWalletClient({
|
|
27
|
+
* chain: mainnet,
|
|
28
|
+
* transport: custom(window.ethereum),
|
|
29
|
+
* })
|
|
30
|
+
* const hash = await writeContract(client, {
|
|
31
|
+
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
|
32
|
+
* abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
|
|
33
|
+
* functionName: 'mint',
|
|
34
|
+
* args: [69420],
|
|
35
|
+
* })
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* // With Validation
|
|
39
|
+
* import { createWalletClient, http, parseAbi } from 'viem'
|
|
40
|
+
* import { mainnet } from 'viem/chains'
|
|
41
|
+
* import { simulateContract, writeContract } from 'viem/contract'
|
|
42
|
+
*
|
|
43
|
+
* const client = createWalletClient({
|
|
44
|
+
* chain: mainnet,
|
|
45
|
+
* transport: http(),
|
|
46
|
+
* })
|
|
47
|
+
* const { request } = await simulateContract(client, {
|
|
48
|
+
* address: '0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2',
|
|
49
|
+
* abi: parseAbi(['function mint(uint32 tokenId) nonpayable']),
|
|
50
|
+
* functionName: 'mint',
|
|
51
|
+
* args: [69420],
|
|
52
|
+
* }
|
|
53
|
+
* const hash = await writeContract(client, request)
|
|
54
|
+
*/
|
|
55
|
+
export type WriteContractWithPaymasterParameters<TChain extends Chain | undefined = Chain | undefined, TAccount extends SmartAccount | undefined = SmartAccount | undefined, TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[], TFunctionName extends string = string, TChainOverride extends Chain | undefined = undefined> = WriteContractParameters<TAbi, TFunctionName, TChain, TAccount, TChainOverride> & SponsorUserOperationMiddleware;
|
|
56
|
+
export declare function writeContract<TChain extends Chain | undefined, TAccount extends SmartAccount | undefined, const TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain | undefined = undefined>(client: Client<Transport, TChain, TAccount>, { abi, address, args, dataSuffix, functionName, ...request }: WriteContractWithPaymasterParameters<TChain, TAccount, TAbi, TFunctionName, TChainOverride>): Promise<WriteContractReturnType>;
|
|
57
|
+
//# sourceMappingURL=writeContract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeContract.d.ts","sourceRoot":"","sources":["../../../actions/smartAccount/writeContract.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,GAAG,EACR,KAAK,KAAK,EACV,KAAK,MAAM,EAEX,KAAK,SAAS,EACd,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAE/B,MAAM,MAAM,CAAA;AACb,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,OAAO,EAAE,KAAK,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAMtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,MAAM,oCAAoC,CAC5C,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,EACpE,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,GAAG,GAAG,GAAG,SAAS,OAAO,EAAE,EAChE,aAAa,SAAS,MAAM,GAAG,MAAM,EACrC,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,IACpD,uBAAuB,CACvB,IAAI,EACJ,aAAa,EACb,MAAM,EACN,QAAQ,EACR,cAAc,CACjB,GACG,8BAA8B,CAAA;AAElC,wBAAsB,aAAa,CAC/B,MAAM,SAAS,KAAK,GAAG,SAAS,EAChC,QAAQ,SAAS,YAAY,GAAG,SAAS,EACzC,KAAK,CAAC,IAAI,SAAS,GAAG,GAAG,SAAS,OAAO,EAAE,EAC3C,aAAa,SAAS,MAAM,EAC5B,cAAc,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EAEpD,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAC3C,EACI,GAAG,EACH,OAAO,EACP,IAAI,EACJ,UAAU,EACV,YAAY,EACZ,GAAG,OAAO,EACb,EAAE,oCAAoC,CACnC,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,aAAa,EACb,cAAc,CACjB,GACF,OAAO,CAAC,uBAAuB,CAAC,CAmBlC"}
|