@metamask/smart-accounts-kit 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -1
- package/dist/actions/index.cjs +4 -4
- package/dist/actions/index.d.cts +2 -2
- package/dist/actions/index.d.ts +2 -2
- package/dist/actions/index.mjs +3 -3
- package/dist/{caveats-CQbtzOKm.d.ts → caveats-BhjGBVHX.d.ts} +1 -1
- package/dist/{caveats-Cey0wm33.d.cts → caveats-CeHBbmt_.d.cts} +1 -1
- package/dist/{chunk-T4IAMAB2.cjs → chunk-6CEOFJY5.cjs} +173 -61
- package/dist/chunk-6CEOFJY5.cjs.map +1 -0
- package/dist/{chunk-VJXM3LWA.mjs → chunk-DVJX76J3.mjs} +2 -2
- package/dist/{chunk-ZA2XYCVX.mjs → chunk-EEIIVBNV.mjs} +22 -18
- package/dist/chunk-EEIIVBNV.mjs.map +1 -0
- package/dist/{chunk-G7VZ7E6W.mjs → chunk-FG2CQGSE.mjs} +3 -3
- package/dist/{chunk-L5DLMBDC.mjs → chunk-HQHXGWNJ.mjs} +4 -4
- package/dist/{chunk-UB2FLPP3.cjs → chunk-MVBU3LRV.cjs} +10 -10
- package/dist/{chunk-UB2FLPP3.cjs.map → chunk-MVBU3LRV.cjs.map} +1 -1
- package/dist/{chunk-734MOPHR.mjs → chunk-R2WT54GZ.mjs} +121 -9
- package/dist/chunk-R2WT54GZ.mjs.map +1 -0
- package/dist/{chunk-HFRQNSZE.cjs → chunk-RR2AMG4A.cjs} +102 -102
- package/dist/{chunk-HFRQNSZE.cjs.map → chunk-RR2AMG4A.cjs.map} +1 -1
- package/dist/{chunk-UZO5OYCD.cjs → chunk-SO5JAXGD.cjs} +11 -11
- package/dist/{chunk-UZO5OYCD.cjs.map → chunk-SO5JAXGD.cjs.map} +1 -1
- package/dist/{chunk-7BEEGBA2.cjs → chunk-TMO23YRP.cjs} +19 -15
- package/dist/chunk-TMO23YRP.cjs.map +1 -0
- package/dist/{chunk-3SHZ7PV2.cjs → chunk-XZ7UMCG3.cjs} +12 -12
- package/dist/{chunk-3SHZ7PV2.cjs.map → chunk-XZ7UMCG3.cjs.map} +1 -1
- package/dist/{chunk-YTNCEXUX.mjs → chunk-ZGBFPD4O.mjs} +2 -2
- package/dist/contracts/index.cjs +5 -5
- package/dist/contracts/index.d.cts +2 -2
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.mjs +4 -4
- package/dist/{delegation-Bx4FEAIU.d.ts → delegation-CR99q1-n.d.ts} +2 -6
- package/dist/{delegation-KbWHzRxV.d.cts → delegation-DoVULGYE.d.cts} +2 -6
- package/dist/experimental/index.cjs +7 -7
- package/dist/experimental/index.mjs +1 -1
- package/dist/{index-Uj_xXVko.d.cts → index-BToRQKyJ.d.cts} +27 -5
- package/dist/{index-D7fBuNV-.d.ts → index-Cg-JakqA.d.ts} +27 -5
- package/dist/{index-D2THBlfm.d.ts → index-DRKgDSZW.d.ts} +1 -1
- package/dist/{index-DE87r5KY.d.cts → index-DzL9ccjU.d.cts} +1 -1
- package/dist/index.cjs +22 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +9 -7
- package/dist/index.mjs.map +1 -1
- package/dist/utils/index.cjs +4 -4
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.mjs +3 -3
- package/package.json +4 -4
- package/dist/chunk-734MOPHR.mjs.map +0 -1
- package/dist/chunk-7BEEGBA2.cjs.map +0 -1
- package/dist/chunk-T4IAMAB2.cjs.map +0 -1
- package/dist/chunk-ZA2XYCVX.mjs.map +0 -1
- /package/dist/{chunk-VJXM3LWA.mjs.map → chunk-DVJX76J3.mjs.map} +0 -0
- /package/dist/{chunk-G7VZ7E6W.mjs.map → chunk-FG2CQGSE.mjs.map} +0 -0
- /package/dist/{chunk-L5DLMBDC.mjs.map → chunk-HQHXGWNJ.mjs.map} +0 -0
- /package/dist/{chunk-YTNCEXUX.mjs.map → chunk-ZGBFPD4O.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-3SHZ7PV2.cjs","../src/DelegationFramework/ERC20PeriodTransferEnforcer/index.ts","../src/DelegationFramework/ERC20PeriodTransferEnforcer/read.ts","../src/DelegationFramework/ERC20PeriodTransferEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/ERC20StreamingEnforcer/index.ts","../src/DelegationFramework/ERC20StreamingEnforcer/read.ts","../src/DelegationFramework/ERC20StreamingEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/index.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/read.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/index.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/read.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/index.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/read.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/methods/getAvailableAmount.ts"],"names":["read_exports","read","readContract","availableAmount","getBlock","getAvailableAmount"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,IAAA,oCAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,mCAAA,EAAA;AAAA,EAAA,IAAA,EAAA,CAAA,EAAA,GAAA;AAAA,CAAA,CAAA;ADSA;AACA;AEVA,IAAA,aAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,YAAA,EAAA;AAAA,EAAA,kBAAA,EAAA,CAAA,EAAA,GAAA;AAAA,CAAA,CAAA;AFeA;AACA;AGhBA,2DAA4C;AAE5C,uC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f,SAAA,EAAW,gBAAA;AAAA,IACX,eAAA,EAAiB,sBAAA;AAAA,IACjB,SAAA,EAAW,gBAAA;AAAA,IACX,KAAA,EAAO,EAAA;AAAA,IACP;AAAA,EACF,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL;AAAA,EACF,CAAA;AACF,CAAA;AAcA,SAASA,mBAAAA,CAAmB,SAAA,EAOjB;AAET,EAAA,GAAA,CAAI,SAAA,CAAU,iBAAA,EAAmB,SAAA,CAAU,SAAA,EAAW;AACpD,IAAA,OAAO,EAAA;AAAA,EACT;AAGA,EAAA,MAAM,QAAA,EAAU,SAAA,CAAU,iBAAA,EAAmB,SAAA,CAAU,SAAA;AAGvD,EAAA,IAAI,SAAA,EAAW,SAAA,CAAU,cAAA,EAAgB,SAAA,CAAU,gBAAA,EAAkB,OAAA;AAGrE,EAAA,GAAA,CAAI,SAAA,EAAW,SAAA,CAAU,SAAA,EAAW;AAClC,IAAA,SAAA,EAAW,SAAA,CAAU,SAAA;AAAA,EACvB;AAGA,EAAA,GAAA,CAAI,SAAA,CAAU,MAAA,GAAS,QAAA,EAAU;AAC/B,IAAA,OAAO,EAAA;AAAA,EACT;AAGA,EAAA,OAAO,SAAA,EAAW,SAAA,CAAU,KAAA;AAC9B;AfiKA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6lBAAC","file":"/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-3SHZ7PV2.cjs","sourcesContent":[null,"import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { ERC20PeriodTransferEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: ERC20PeriodTransferEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { ERC20StreamingEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract, getBlock } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n // Get current block timestamp from blockchain\n const currentBlock = await getBlock(client);\n const currentTimestamp = currentBlock.timestamp;\n\n // First, get the current state from the contract\n const allowanceState = await readContract(client, {\n address: contractAddress,\n abi: ERC20StreamingEnforcer,\n functionName: 'streamingAllowances',\n args: [delegationManager, delegationHash],\n });\n\n const [initialAmount, maxAmount, amountPerSecond, startTime, spent] =\n allowanceState;\n\n // Check if state exists (startTime != 0)\n if (startTime !== 0n) {\n // State exists, calculate available amount using the stored state\n const availableAmount = getAvailableAmount({\n initialAmount,\n maxAmount,\n amountPerSecond,\n startTime,\n spent,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n }\n\n // State doesn't exist, decode terms and simulate with spent = 0\n const decodedTerms = await readContract(client, {\n address: contractAddress,\n abi: ERC20StreamingEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n const [\n ,\n decodedInitialAmount,\n decodedMaxAmount,\n decodedAmountPerSecond,\n decodedStartTime,\n ] = decodedTerms;\n\n // Simulate using decoded terms with spent = 0\n const availableAmount = getAvailableAmount({\n initialAmount: decodedInitialAmount,\n maxAmount: decodedMaxAmount,\n amountPerSecond: decodedAmountPerSecond,\n startTime: decodedStartTime,\n spent: 0n,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n};\n\n/**\n * Replicates the internal _getAvailableAmount logic from the smart contract.\n *\n * @param allowance - The allowance object containing all parameters.\n * @param allowance.initialAmount - The initial amount available.\n * @param allowance.maxAmount - The maximum amount allowed.\n * @param allowance.amountPerSecond - The amount streamed per second.\n * @param allowance.startTime - The start time of the streaming.\n * @param allowance.spent - The amount already spent.\n * @param allowance.currentTimestamp - The current timestamp.\n * @returns The available amount that can be spent.\n */\nfunction getAvailableAmount(allowance: {\n initialAmount: bigint;\n maxAmount: bigint;\n amountPerSecond: bigint;\n startTime: bigint;\n spent: bigint;\n currentTimestamp: bigint;\n}): bigint {\n // If current time is before start time, nothing is available\n if (allowance.currentTimestamp < allowance.startTime) {\n return 0n;\n }\n\n // Calculate elapsed time since start\n const elapsed = allowance.currentTimestamp - allowance.startTime;\n\n // Calculate total unlocked amount\n let unlocked = allowance.initialAmount + allowance.amountPerSecond * elapsed;\n\n // Cap by max amount\n if (unlocked > allowance.maxAmount) {\n unlocked = allowance.maxAmount;\n }\n\n // If spent >= unlocked, nothing available\n if (allowance.spent >= unlocked) {\n return 0n;\n }\n\n // Return available amount\n return unlocked - allowance.spent;\n}\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { MultiTokenPeriodEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n args: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n args,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: MultiTokenPeriodEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms, args],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { NativeTokenPeriodTransferEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: NativeTokenPeriodTransferEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { NativeTokenStreamingEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract, getBlock } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n // Get current block timestamp from blockchain\n const currentBlock = await getBlock(client);\n const currentTimestamp = currentBlock.timestamp;\n\n // First, get the current state from the contract\n const allowanceState = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenStreamingEnforcer,\n functionName: 'streamingAllowances',\n args: [delegationManager, delegationHash],\n });\n\n const [initialAmount, maxAmount, amountPerSecond, startTime, spent] =\n allowanceState;\n\n // Check if state exists (startTime != 0)\n if (startTime !== 0n) {\n // State exists, calculate available amount using the stored state\n const availableAmount = getAvailableAmount({\n initialAmount,\n maxAmount,\n amountPerSecond,\n startTime,\n spent,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n }\n\n // State doesn't exist, decode terms and simulate with spent = 0\n const decodedTerms = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenStreamingEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n const [\n decodedInitialAmount,\n decodedMaxAmount,\n decodedAmountPerSecond,\n decodedStartTime,\n ] = decodedTerms;\n\n // Simulate using decoded terms with spent = 0\n const availableAmount = getAvailableAmount({\n initialAmount: decodedInitialAmount,\n maxAmount: decodedMaxAmount,\n amountPerSecond: decodedAmountPerSecond,\n startTime: decodedStartTime,\n spent: 0n,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n};\n\n/**\n * Replicates the internal _getAvailableAmount logic from the smart contract.\n *\n * @param allowance - The allowance object containing all parameters.\n * @param allowance.initialAmount - The initial amount available.\n * @param allowance.maxAmount - The maximum amount allowed.\n * @param allowance.amountPerSecond - The amount streamed per second.\n * @param allowance.startTime - The start time of the streaming.\n * @param allowance.spent - The amount already spent.\n * @param allowance.currentTimestamp - The current timestamp.\n * @returns The available amount that can be spent.\n */\nfunction getAvailableAmount(allowance: {\n initialAmount: bigint;\n maxAmount: bigint;\n amountPerSecond: bigint;\n startTime: bigint;\n spent: bigint;\n currentTimestamp: bigint;\n}): bigint {\n // If current time is before start time, nothing is available\n if (allowance.currentTimestamp < allowance.startTime) {\n return 0n;\n }\n\n // Calculate elapsed time since start\n const elapsed = allowance.currentTimestamp - allowance.startTime;\n\n // Calculate total unlocked amount\n let unlocked = allowance.initialAmount + allowance.amountPerSecond * elapsed;\n\n // Cap by max amount\n if (unlocked > allowance.maxAmount) {\n unlocked = allowance.maxAmount;\n }\n\n // If spent >= unlocked, nothing available\n if (allowance.spent >= unlocked) {\n return 0n;\n }\n\n // Return available amount\n return unlocked - allowance.spent;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-XZ7UMCG3.cjs","../src/DelegationFramework/ERC20PeriodTransferEnforcer/index.ts","../src/DelegationFramework/ERC20PeriodTransferEnforcer/read.ts","../src/DelegationFramework/ERC20PeriodTransferEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/ERC20StreamingEnforcer/index.ts","../src/DelegationFramework/ERC20StreamingEnforcer/read.ts","../src/DelegationFramework/ERC20StreamingEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/index.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/read.ts","../src/DelegationFramework/MultiTokenPeriodEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/index.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/read.ts","../src/DelegationFramework/NativeTokenPeriodTransferEnforcer/methods/getAvailableAmount.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/index.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/read.ts","../src/DelegationFramework/NativeTokenStreamingEnforcer/methods/getAvailableAmount.ts"],"names":["read_exports","read","readContract","availableAmount","getBlock","getAvailableAmount"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACJA,IAAA,oCAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,mCAAA,EAAA;AAAA,EAAA,IAAA,EAAA,CAAA,EAAA,GAAA;AAAA,CAAA,CAAA;ADSA;AACA;AEVA,IAAA,aAAA,EAAA,CAAA,CAAA;AAAA,wCAAA,YAAA,EAAA;AAAA,EAAA,kBAAA,EAAA,CAAA,EAAA,GAAA;AAAA,CAAA,CAAA;AFeA;AACA;AGhBA,2DAA4C;AAE5C,uCAA6B;AAUtB,IAAM,KAAA,EAA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ACX,eAAA,EAAiB,sBAAA;AAAA,IACjB,SAAA,EAAW,gBAAA;AAAA,IACX,KAAA,EAAO,EAAA;AAAA,IACP;AAAA,EACF,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACL;AAAA,EACF,CAAA;AACF,CAAA;AAcA,SAASA,mBAAAA,CAAmB,SAAA,EAOjB;AAET,EAAA,GAAA,CAAI,SAAA,CAAU,iBAAA,EAAmB,SAAA,CAAU,SAAA,EAAW;AACpD,IAAA,OAAO,EAAA;AAAA,EACT;AAGA,EAAA,MAAM,QAAA,EAAU,SAAA,CAAU,iBAAA,EAAmB,SAAA,CAAU,SAAA;AAGvD,EAAA,IAAI,SAAA,EAAW,SAAA,CAAU,cAAA,EAAgB,SAAA,CAAU,gBAAA,EAAkB,OAAA;AAGrE,EAAA,GAAA,CAAI,SAAA,EAAW,SAAA,CAAU,SAAA,EAAW;AAClC,IAAA,SAAA,EAAW,SAAA,CAAU,SAAA;AAAA,EACvB;AAGA,EAAA,GAAA,CAAI,SAAA,CAAU,MAAA,GAAS,QAAA,EAAU;AAC/B,IAAA,OAAO,EAAA;AAAA,EACT;AAGA,EAAA,OAAO,SAAA,EAAW,SAAA,CAAU,KAAA;AAC9B;AfiKA;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,6lBAAC","file":"/home/runner/work/smart-accounts-kit/smart-accounts-kit/packages/smart-accounts-kit/dist/chunk-XZ7UMCG3.cjs","sourcesContent":[null,"import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { ERC20PeriodTransferEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: ERC20PeriodTransferEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { ERC20StreamingEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract, getBlock } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n // Get current block timestamp from blockchain\n const currentBlock = await getBlock(client);\n const currentTimestamp = currentBlock.timestamp;\n\n // First, get the current state from the contract\n const allowanceState = await readContract(client, {\n address: contractAddress,\n abi: ERC20StreamingEnforcer,\n functionName: 'streamingAllowances',\n args: [delegationManager, delegationHash],\n });\n\n const [initialAmount, maxAmount, amountPerSecond, startTime, spent] =\n allowanceState;\n\n // Check if state exists (startTime != 0)\n if (startTime !== 0n) {\n // State exists, calculate available amount using the stored state\n const availableAmount = getAvailableAmount({\n initialAmount,\n maxAmount,\n amountPerSecond,\n startTime,\n spent,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n }\n\n // State doesn't exist, decode terms and simulate with spent = 0\n const decodedTerms = await readContract(client, {\n address: contractAddress,\n abi: ERC20StreamingEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n const [\n ,\n decodedInitialAmount,\n decodedMaxAmount,\n decodedAmountPerSecond,\n decodedStartTime,\n ] = decodedTerms;\n\n // Simulate using decoded terms with spent = 0\n const availableAmount = getAvailableAmount({\n initialAmount: decodedInitialAmount,\n maxAmount: decodedMaxAmount,\n amountPerSecond: decodedAmountPerSecond,\n startTime: decodedStartTime,\n spent: 0n,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n};\n\n/**\n * Replicates the internal _getAvailableAmount logic from the smart contract.\n *\n * @param allowance - The allowance object containing all parameters.\n * @param allowance.initialAmount - The initial amount available.\n * @param allowance.maxAmount - The maximum amount allowed.\n * @param allowance.amountPerSecond - The amount streamed per second.\n * @param allowance.startTime - The start time of the streaming.\n * @param allowance.spent - The amount already spent.\n * @param allowance.currentTimestamp - The current timestamp.\n * @returns The available amount that can be spent.\n */\nfunction getAvailableAmount(allowance: {\n initialAmount: bigint;\n maxAmount: bigint;\n amountPerSecond: bigint;\n startTime: bigint;\n spent: bigint;\n currentTimestamp: bigint;\n}): bigint {\n // If current time is before start time, nothing is available\n if (allowance.currentTimestamp < allowance.startTime) {\n return 0n;\n }\n\n // Calculate elapsed time since start\n const elapsed = allowance.currentTimestamp - allowance.startTime;\n\n // Calculate total unlocked amount\n let unlocked = allowance.initialAmount + allowance.amountPerSecond * elapsed;\n\n // Cap by max amount\n if (unlocked > allowance.maxAmount) {\n unlocked = allowance.maxAmount;\n }\n\n // If spent >= unlocked, nothing available\n if (allowance.spent >= unlocked) {\n return 0n;\n }\n\n // Return available amount\n return unlocked - allowance.spent;\n}\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { MultiTokenPeriodEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n args: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n args,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: MultiTokenPeriodEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms, args],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { NativeTokenPeriodTransferEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationHash: Hex;\n delegationManager: Address;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationHash,\n delegationManager,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n const [availableAmount, isNewPeriod, currentPeriod] = await readContract(\n client,\n {\n address: contractAddress,\n abi: NativeTokenPeriodTransferEnforcer,\n functionName: 'getAvailableAmount',\n args: [delegationHash, delegationManager, terms],\n },\n );\n\n return {\n availableAmount,\n isNewPeriod,\n currentPeriod,\n };\n};\n","import * as read from './read';\n\nexport { read };\n","import { read as getAvailableAmount } from './methods/getAvailableAmount';\n\nexport { getAvailableAmount };\n","import { NativeTokenStreamingEnforcer } from '@metamask/delegation-abis';\nimport type { Address, Client, Hex } from 'viem';\nimport { readContract, getBlock } from 'viem/actions';\n\nexport type ReadGetAvailableAmountParameters = {\n client: Client;\n contractAddress: Address;\n delegationManager: Address;\n delegationHash: Hex;\n terms: Hex;\n};\n\nexport const read = async ({\n client,\n contractAddress,\n delegationManager,\n delegationHash,\n terms,\n}: ReadGetAvailableAmountParameters) => {\n // Get current block timestamp from blockchain\n const currentBlock = await getBlock(client);\n const currentTimestamp = currentBlock.timestamp;\n\n // First, get the current state from the contract\n const allowanceState = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenStreamingEnforcer,\n functionName: 'streamingAllowances',\n args: [delegationManager, delegationHash],\n });\n\n const [initialAmount, maxAmount, amountPerSecond, startTime, spent] =\n allowanceState;\n\n // Check if state exists (startTime != 0)\n if (startTime !== 0n) {\n // State exists, calculate available amount using the stored state\n const availableAmount = getAvailableAmount({\n initialAmount,\n maxAmount,\n amountPerSecond,\n startTime,\n spent,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n }\n\n // State doesn't exist, decode terms and simulate with spent = 0\n const decodedTerms = await readContract(client, {\n address: contractAddress,\n abi: NativeTokenStreamingEnforcer,\n functionName: 'getTermsInfo',\n args: [terms],\n });\n\n const [\n decodedInitialAmount,\n decodedMaxAmount,\n decodedAmountPerSecond,\n decodedStartTime,\n ] = decodedTerms;\n\n // Simulate using decoded terms with spent = 0\n const availableAmount = getAvailableAmount({\n initialAmount: decodedInitialAmount,\n maxAmount: decodedMaxAmount,\n amountPerSecond: decodedAmountPerSecond,\n startTime: decodedStartTime,\n spent: 0n,\n currentTimestamp,\n });\n\n return {\n availableAmount,\n };\n};\n\n/**\n * Replicates the internal _getAvailableAmount logic from the smart contract.\n *\n * @param allowance - The allowance object containing all parameters.\n * @param allowance.initialAmount - The initial amount available.\n * @param allowance.maxAmount - The maximum amount allowed.\n * @param allowance.amountPerSecond - The amount streamed per second.\n * @param allowance.startTime - The start time of the streaming.\n * @param allowance.spent - The amount already spent.\n * @param allowance.currentTimestamp - The current timestamp.\n * @returns The available amount that can be spent.\n */\nfunction getAvailableAmount(allowance: {\n initialAmount: bigint;\n maxAmount: bigint;\n amountPerSecond: bigint;\n startTime: bigint;\n spent: bigint;\n currentTimestamp: bigint;\n}): bigint {\n // If current time is before start time, nothing is available\n if (allowance.currentTimestamp < allowance.startTime) {\n return 0n;\n }\n\n // Calculate elapsed time since start\n const elapsed = allowance.currentTimestamp - allowance.startTime;\n\n // Calculate total unlocked amount\n let unlocked = allowance.initialAmount + allowance.amountPerSecond * elapsed;\n\n // Cap by max amount\n if (unlocked > allowance.maxAmount) {\n unlocked = allowance.maxAmount;\n }\n\n // If spent >= unlocked, nothing available\n if (allowance.spent >= unlocked) {\n return 0n;\n }\n\n // Return available amount\n return unlocked - allowance.spent;\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
__export,
|
|
6
6
|
toDelegationStruct
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-EEIIVBNV.mjs";
|
|
8
8
|
|
|
9
9
|
// src/DelegationFramework/utils.ts
|
|
10
10
|
import { ERC1967Proxy } from "@metamask/delegation-abis";
|
|
@@ -827,4 +827,4 @@ export {
|
|
|
827
827
|
execute6,
|
|
828
828
|
encode_exports4
|
|
829
829
|
};
|
|
830
|
-
//# sourceMappingURL=chunk-
|
|
830
|
+
//# sourceMappingURL=chunk-ZGBFPD4O.mjs.map
|
package/dist/contracts/index.cjs
CHANGED
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkRR2AMG4Acjs = require('../chunk-RR2AMG4A.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkXZ7UMCG3cjs = require('../chunk-XZ7UMCG3.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkSO5JAXGDcjs = require('../chunk-SO5JAXGD.cjs');
|
|
30
30
|
require('../chunk-MOHCTPYQ.cjs');
|
|
31
|
-
require('../chunk-
|
|
31
|
+
require('../chunk-TMO23YRP.cjs');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -53,5 +53,5 @@ require('../chunk-7BEEGBA2.cjs');
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
|
|
56
|
-
exports.DeleGatorCore =
|
|
56
|
+
exports.DeleGatorCore = _chunkRR2AMG4Acjs.DeleGatorCore_exports; exports.DelegationManager = _chunkRR2AMG4Acjs.DelegationManager_exports; exports.EIP712 = _chunkRR2AMG4Acjs.EIP712_exports; exports.ERC20PeriodTransferEnforcer = _chunkXZ7UMCG3cjs.ERC20PeriodTransferEnforcer_exports; exports.ERC20StreamingEnforcer = _chunkXZ7UMCG3cjs.ERC20StreamingEnforcer_exports; exports.ERC20TransferAmountEnforcer = _chunkRR2AMG4Acjs.ERC20TransferAmountEnforcer_exports; exports.EntryPoint = _chunkRR2AMG4Acjs.EntryPoint_exports; exports.HybridDeleGator = _chunkRR2AMG4Acjs.HybridDeleGator_exports; exports.IdEnforcer = _chunkRR2AMG4Acjs.IdEnforcer_exports; exports.LimitedCallsEnforcer = _chunkRR2AMG4Acjs.LimitedCallsEnforcer_exports; exports.MultiSigDeleGator = _chunkRR2AMG4Acjs.MultiSigDeleGator_exports; exports.MultiTokenPeriodEnforcer = _chunkXZ7UMCG3cjs.MultiTokenPeriodEnforcer_exports; exports.NativeTokenPeriodTransferEnforcer = _chunkXZ7UMCG3cjs.NativeTokenPeriodTransferEnforcer_exports; exports.NativeTokenStreamingEnforcer = _chunkXZ7UMCG3cjs.NativeTokenStreamingEnforcer_exports; exports.NativeTokenTransferAmountEnforcer = _chunkRR2AMG4Acjs.NativeTokenTransferAmountEnforcer_exports; exports.NonceEnforcer = _chunkRR2AMG4Acjs.NonceEnforcer_exports; exports.Ownable2Step = _chunkRR2AMG4Acjs.Ownable2Step_exports; exports.Pausable = _chunkRR2AMG4Acjs.Pausable_exports; exports.SimpleFactory = _chunkRR2AMG4Acjs.SimpleFactory_exports; exports.SpecificActionERC20TransferBatchEnforcer = _chunkRR2AMG4Acjs.SpecificActionERC20TransferBatchEnforcer_exports; exports.encodeProxyCreationCode = _chunkSO5JAXGDcjs.encodeProxyCreationCode; exports.isContractDeployed = _chunkSO5JAXGDcjs.isContractDeployed; exports.isImplementationExpected = _chunkSO5JAXGDcjs.isImplementationExpected;
|
|
57
57
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { a as DeleGatorCore, b as DelegationManager, c as EIP712, d as ERC20PeriodTransferEnforcer, e as ERC20StreamingEnforcer, f as ERC20TransferAmountEnforcer, g as EntryPoint, h as HybridDeleGator, j as IdEnforcer, I as InitializedClient, k as LimitedCallsEnforcer, l as MultiSigDeleGator, m as MultiTokenPeriodEnforcer, n as NativeTokenPeriodTransferEnforcer, o as NativeTokenStreamingEnforcer, p as NativeTokenTransferAmountEnforcer, q as NonceEnforcer, r as Ownable2Step, P as P256Owner, s as Pausable, t as SimpleFactory, u as SpecificActionERC20TransferBatchEnforcer, v as encodeProxyCreationCode, w as isContractDeployed, x as isImplementationExpected } from '../index-
|
|
1
|
+
export { a as DeleGatorCore, b as DelegationManager, c as EIP712, d as ERC20PeriodTransferEnforcer, e as ERC20StreamingEnforcer, f as ERC20TransferAmountEnforcer, g as EntryPoint, h as HybridDeleGator, j as IdEnforcer, I as InitializedClient, k as LimitedCallsEnforcer, l as MultiSigDeleGator, m as MultiTokenPeriodEnforcer, n as NativeTokenPeriodTransferEnforcer, o as NativeTokenStreamingEnforcer, p as NativeTokenTransferAmountEnforcer, q as NonceEnforcer, r as Ownable2Step, P as P256Owner, s as Pausable, t as SimpleFactory, u as SpecificActionERC20TransferBatchEnforcer, v as encodeProxyCreationCode, w as isContractDeployed, x as isImplementationExpected } from '../index-DzL9ccjU.cjs';
|
|
2
2
|
import '@metamask/delegation-core';
|
|
3
3
|
import 'viem';
|
|
4
|
-
import '../delegation-
|
|
4
|
+
import '../delegation-DoVULGYE.cjs';
|
|
5
5
|
import '../types-BWaH4KH1.cjs';
|
|
6
6
|
import '@metamask/delegation-abis';
|
|
7
7
|
import 'viem/account-abstraction';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { a as DeleGatorCore, b as DelegationManager, c as EIP712, d as ERC20PeriodTransferEnforcer, e as ERC20StreamingEnforcer, f as ERC20TransferAmountEnforcer, g as EntryPoint, h as HybridDeleGator, j as IdEnforcer, I as InitializedClient, k as LimitedCallsEnforcer, l as MultiSigDeleGator, m as MultiTokenPeriodEnforcer, n as NativeTokenPeriodTransferEnforcer, o as NativeTokenStreamingEnforcer, p as NativeTokenTransferAmountEnforcer, q as NonceEnforcer, r as Ownable2Step, P as P256Owner, s as Pausable, t as SimpleFactory, u as SpecificActionERC20TransferBatchEnforcer, v as encodeProxyCreationCode, w as isContractDeployed, x as isImplementationExpected } from '../index-
|
|
1
|
+
export { a as DeleGatorCore, b as DelegationManager, c as EIP712, d as ERC20PeriodTransferEnforcer, e as ERC20StreamingEnforcer, f as ERC20TransferAmountEnforcer, g as EntryPoint, h as HybridDeleGator, j as IdEnforcer, I as InitializedClient, k as LimitedCallsEnforcer, l as MultiSigDeleGator, m as MultiTokenPeriodEnforcer, n as NativeTokenPeriodTransferEnforcer, o as NativeTokenStreamingEnforcer, p as NativeTokenTransferAmountEnforcer, q as NonceEnforcer, r as Ownable2Step, P as P256Owner, s as Pausable, t as SimpleFactory, u as SpecificActionERC20TransferBatchEnforcer, v as encodeProxyCreationCode, w as isContractDeployed, x as isImplementationExpected } from '../index-DRKgDSZW.js';
|
|
2
2
|
import '@metamask/delegation-core';
|
|
3
3
|
import 'viem';
|
|
4
|
-
import '../delegation-
|
|
4
|
+
import '../delegation-CR99q1-n.js';
|
|
5
5
|
import '../types-BWaH4KH1.js';
|
|
6
6
|
import '@metamask/delegation-abis';
|
|
7
7
|
import 'viem/account-abstraction';
|
package/dist/contracts/index.mjs
CHANGED
|
@@ -14,21 +14,21 @@ import {
|
|
|
14
14
|
Pausable_exports,
|
|
15
15
|
SimpleFactory_exports,
|
|
16
16
|
SpecificActionERC20TransferBatchEnforcer_exports
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-HQHXGWNJ.mjs";
|
|
18
18
|
import {
|
|
19
19
|
ERC20PeriodTransferEnforcer_exports,
|
|
20
20
|
ERC20StreamingEnforcer_exports,
|
|
21
21
|
MultiTokenPeriodEnforcer_exports,
|
|
22
22
|
NativeTokenPeriodTransferEnforcer_exports,
|
|
23
23
|
NativeTokenStreamingEnforcer_exports
|
|
24
|
-
} from "../chunk-
|
|
24
|
+
} from "../chunk-DVJX76J3.mjs";
|
|
25
25
|
import {
|
|
26
26
|
encodeProxyCreationCode,
|
|
27
27
|
isContractDeployed,
|
|
28
28
|
isImplementationExpected
|
|
29
|
-
} from "../chunk-
|
|
29
|
+
} from "../chunk-ZGBFPD4O.mjs";
|
|
30
30
|
import "../chunk-4QXIOE7F.mjs";
|
|
31
|
-
import "../chunk-
|
|
31
|
+
import "../chunk-EEIIVBNV.mjs";
|
|
32
32
|
export {
|
|
33
33
|
DeleGatorCore_exports as DeleGatorCore,
|
|
34
34
|
DelegationManager_exports as DelegationManager,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Hex, AbiFunction, Address, AbiParameter, TypedData } from 'viem';
|
|
2
2
|
import { S as SmartAccountsEnvironment, C as Caveat, b as CaveatType, g as ScopeType, D as Delegation, P as PermissionContext } from './types-BWaH4KH1.js';
|
|
3
|
+
import { BalanceChangeType } from '@metamask/delegation-core';
|
|
3
4
|
|
|
4
5
|
type AllowedCalldataBuilderConfig = {
|
|
5
6
|
startIndex: number;
|
|
@@ -54,11 +55,6 @@ type DeployedBuilderConfig = {
|
|
|
54
55
|
};
|
|
55
56
|
declare const deployedBuilder: (environment: SmartAccountsEnvironment, config: DeployedBuilderConfig) => Caveat;
|
|
56
57
|
|
|
57
|
-
declare enum BalanceChangeType {
|
|
58
|
-
Increase = 0,
|
|
59
|
-
Decrease = 1
|
|
60
|
-
}
|
|
61
|
-
|
|
62
58
|
type Erc1155BalanceChangeBuilderConfig = {
|
|
63
59
|
tokenAddress: Address;
|
|
64
60
|
recipient: Address;
|
|
@@ -399,4 +395,4 @@ declare const signDelegation: ({ privateKey, delegation, delegationManager, chai
|
|
|
399
395
|
allowInsecureUnrestrictedDelegation?: boolean;
|
|
400
396
|
}) => Promise<`0x${string}`>;
|
|
401
397
|
|
|
402
|
-
export { type CoreCaveatConfiguration as A,
|
|
398
|
+
export { type CoreCaveatConfiguration as A, type Caveats as C, DELEGATION_ABI_TYPE as D, ExecutionMode as E, SIGNABLE_DELEGATION_TYPED_DATA as S, type CreateDelegationOptions as a, type CreateExecutionArgs as b, type CreateOpenDelegationOptions as c, type ExecutionStruct as d, createDelegation as e, createExecution as f, createOpenDelegation as g, CaveatBuilder as h, type CaveatBuilderConfig as i, type CoreCaveatBuilder as j, DELEGATION_ABI_TYPE_COMPONENTS as k, DELEGATION_ARRAY_ABI_TYPE as l, type DelegationStruct as m, createCaveatBuilder as n, decodeDelegation as o, decodeDelegations as p, encodeBatchExecution as q, encodeDelegation as r, signDelegation as s, encodeDelegations as t, encodeExecutionCalldata as u, encodeExecutionCalldatas as v, encodeSingleExecution as w, hashDelegation as x, toDelegation as y, toDelegationStruct as z };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Hex, AbiFunction, Address, AbiParameter, TypedData } from 'viem';
|
|
2
2
|
import { S as SmartAccountsEnvironment, C as Caveat, b as CaveatType, g as ScopeType, D as Delegation, P as PermissionContext } from './types-BWaH4KH1.cjs';
|
|
3
|
+
import { BalanceChangeType } from '@metamask/delegation-core';
|
|
3
4
|
|
|
4
5
|
type AllowedCalldataBuilderConfig = {
|
|
5
6
|
startIndex: number;
|
|
@@ -54,11 +55,6 @@ type DeployedBuilderConfig = {
|
|
|
54
55
|
};
|
|
55
56
|
declare const deployedBuilder: (environment: SmartAccountsEnvironment, config: DeployedBuilderConfig) => Caveat;
|
|
56
57
|
|
|
57
|
-
declare enum BalanceChangeType {
|
|
58
|
-
Increase = 0,
|
|
59
|
-
Decrease = 1
|
|
60
|
-
}
|
|
61
|
-
|
|
62
58
|
type Erc1155BalanceChangeBuilderConfig = {
|
|
63
59
|
tokenAddress: Address;
|
|
64
60
|
recipient: Address;
|
|
@@ -399,4 +395,4 @@ declare const signDelegation: ({ privateKey, delegation, delegationManager, chai
|
|
|
399
395
|
allowInsecureUnrestrictedDelegation?: boolean;
|
|
400
396
|
}) => Promise<`0x${string}`>;
|
|
401
397
|
|
|
402
|
-
export { type CoreCaveatConfiguration as A,
|
|
398
|
+
export { type CoreCaveatConfiguration as A, type Caveats as C, DELEGATION_ABI_TYPE as D, ExecutionMode as E, SIGNABLE_DELEGATION_TYPED_DATA as S, type CreateDelegationOptions as a, type CreateExecutionArgs as b, type CreateOpenDelegationOptions as c, type ExecutionStruct as d, createDelegation as e, createExecution as f, createOpenDelegation as g, CaveatBuilder as h, type CaveatBuilderConfig as i, type CoreCaveatBuilder as j, DELEGATION_ABI_TYPE_COMPONENTS as k, DELEGATION_ARRAY_ABI_TYPE as l, type DelegationStruct as m, createCaveatBuilder as n, decodeDelegation as o, decodeDelegations as p, encodeBatchExecution as q, encodeDelegation as r, signDelegation as s, encodeDelegations as t, encodeExecutionCalldata as u, encodeExecutionCalldatas as v, encodeSingleExecution as w, hashDelegation as x, toDelegation as y, toDelegationStruct as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkTMO23YRPcjs = require('../chunk-TMO23YRP.cjs');
|
|
5
5
|
|
|
6
6
|
// src/experimental/delegationStorage.ts
|
|
7
7
|
var _viem = require('viem');
|
|
@@ -22,7 +22,7 @@ var DelegationStorageClient = class {
|
|
|
22
22
|
#apiUrl;
|
|
23
23
|
constructor(config) {
|
|
24
24
|
const { apiUrl } = config.environment;
|
|
25
|
-
|
|
25
|
+
_chunkTMO23YRPcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
26
26
|
"experimental.DelegationStorageClient.constructor",
|
|
27
27
|
{
|
|
28
28
|
environment: getDelegationStorageEnvironment(apiUrl)
|
|
@@ -68,13 +68,13 @@ var DelegationStorageClient = class {
|
|
|
68
68
|
* is not found.
|
|
69
69
|
*/
|
|
70
70
|
async getDelegationChain(leafDelegationOrDelegationHash) {
|
|
71
|
-
|
|
71
|
+
_chunkTMO23YRPcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
72
72
|
"experimental.DelegationStorageClient.getDelegationChain",
|
|
73
73
|
{
|
|
74
74
|
inputKind: typeof leafDelegationOrDelegationHash === "string" ? "hash" : "delegation"
|
|
75
75
|
}
|
|
76
76
|
);
|
|
77
|
-
const leafDelegationHash = typeof leafDelegationOrDelegationHash === "string" ? leafDelegationOrDelegationHash :
|
|
77
|
+
const leafDelegationHash = typeof leafDelegationOrDelegationHash === "string" ? leafDelegationOrDelegationHash : _chunkTMO23YRPcjs.hashDelegation.call(void 0, leafDelegationOrDelegationHash);
|
|
78
78
|
const response = await this.#fetcher(
|
|
79
79
|
`${this.#apiUrl}/delegation/chain/${leafDelegationHash}`,
|
|
80
80
|
{
|
|
@@ -104,7 +104,7 @@ var DelegationStorageClient = class {
|
|
|
104
104
|
* empty array if the delegations are not found.
|
|
105
105
|
*/
|
|
106
106
|
async fetchDelegations(deleGatorAddress, filterMode = "RECEIVED" /* Received */) {
|
|
107
|
-
|
|
107
|
+
_chunkTMO23YRPcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
108
108
|
"experimental.DelegationStorageClient.fetchDelegations",
|
|
109
109
|
{ filterMode }
|
|
110
110
|
);
|
|
@@ -131,14 +131,14 @@ var DelegationStorageClient = class {
|
|
|
131
131
|
* @returns A promise that resolves to the delegation hash indicating successful storage.
|
|
132
132
|
*/
|
|
133
133
|
async storeDelegation(delegation) {
|
|
134
|
-
|
|
134
|
+
_chunkTMO23YRPcjs.trackSmartAccountsKitFunctionCall.call(void 0,
|
|
135
135
|
"experimental.DelegationStorageClient.storeDelegation",
|
|
136
136
|
{ caveatCount: delegation.caveats.length }
|
|
137
137
|
);
|
|
138
138
|
if (!delegation.signature || delegation.signature === "0x") {
|
|
139
139
|
throw new Error("Delegation must be signed to be stored");
|
|
140
140
|
}
|
|
141
|
-
const delegationHash =
|
|
141
|
+
const delegationHash = _chunkTMO23YRPcjs.hashDelegation.call(void 0, delegation);
|
|
142
142
|
const body = JSON.stringify(
|
|
143
143
|
{
|
|
144
144
|
...delegation,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PermissionRequest as PermissionRequest$1, PermissionTypes as PermissionTypes$1, PermissionResponse as PermissionResponse$1 } from '@metamask/7715-permission-types';
|
|
1
|
+
import { Rule, PermissionRequest as PermissionRequest$1, PermissionTypes as PermissionTypes$1, PermissionResponse as PermissionResponse$1 } from '@metamask/7715-permission-types';
|
|
2
2
|
import { Address, Hex, Client, Transport, Chain, Account, RpcSchema, OneOf, PublicClient, SendTransactionRequest, SendTransactionParameters, WalletClient } from 'viem';
|
|
3
3
|
import { SmartAccount, SendUserOperationParameters } from 'viem/account-abstraction';
|
|
4
4
|
import { l as Call, P as PermissionContext, S as SmartAccountsEnvironment, D as Delegation } from './types-BWaH4KH1.cjs';
|
|
@@ -49,19 +49,38 @@ type Erc20TokenPeriodicPermission = BasePermission & {
|
|
|
49
49
|
justification?: string;
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
+
type NativeTokenAllowancePermission = BasePermission & {
|
|
53
|
+
type: 'native-token-allowance';
|
|
54
|
+
data: {
|
|
55
|
+
allowanceAmount: bigint;
|
|
56
|
+
startTime?: number;
|
|
57
|
+
justification?: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
type Erc20TokenAllowancePermission = BasePermission & {
|
|
61
|
+
type: 'erc20-token-allowance';
|
|
62
|
+
data: {
|
|
63
|
+
allowanceAmount: bigint;
|
|
64
|
+
startTime?: number;
|
|
65
|
+
tokenAddress: Address;
|
|
66
|
+
justification?: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
52
69
|
type Erc20TokenRevocationPermission = BasePermission & {
|
|
53
70
|
type: 'erc20-token-revocation';
|
|
54
71
|
data: {
|
|
55
72
|
justification?: string;
|
|
56
73
|
};
|
|
57
74
|
};
|
|
58
|
-
type PermissionTypes = NativeTokenStreamPermission | NativeTokenPeriodicPermission | Erc20TokenStreamPermission | Erc20TokenPeriodicPermission | Erc20TokenRevocationPermission;
|
|
75
|
+
type PermissionTypes = NativeTokenStreamPermission | NativeTokenPeriodicPermission | NativeTokenAllowancePermission | Erc20TokenStreamPermission | Erc20TokenPeriodicPermission | Erc20TokenAllowancePermission | Erc20TokenRevocationPermission;
|
|
59
76
|
type PermissionRequestParameter = {
|
|
60
77
|
chainId: number;
|
|
61
78
|
permission: PermissionTypes;
|
|
62
79
|
to: Hex;
|
|
63
80
|
from?: Address | undefined | null;
|
|
64
81
|
expiry?: number | undefined | null;
|
|
82
|
+
redeemer?: readonly Address[] | undefined | null;
|
|
83
|
+
payee?: readonly Address[] | undefined | null;
|
|
65
84
|
};
|
|
66
85
|
type SupportedPermissionInfo = {
|
|
67
86
|
chainIds: number[];
|
|
@@ -74,7 +93,7 @@ type PermissionRequest<TPermission extends PermissionTypes> = {
|
|
|
74
93
|
from?: Hex;
|
|
75
94
|
to: Hex;
|
|
76
95
|
permission: TPermission;
|
|
77
|
-
rules?:
|
|
96
|
+
rules?: Rule[] | null;
|
|
78
97
|
};
|
|
79
98
|
type PermissionResponse<TPermission extends PermissionTypes> = PermissionRequest<TPermission> & {
|
|
80
99
|
context: Hex;
|
|
@@ -226,6 +245,7 @@ declare const erc7710BundlerActions: () => (client: Client) => {
|
|
|
226
245
|
|
|
227
246
|
type index_CaveatEnforcerParams = CaveatEnforcerParams;
|
|
228
247
|
type index_DelegatedCall = DelegatedCall;
|
|
248
|
+
type index_Erc20TokenAllowancePermission = Erc20TokenAllowancePermission;
|
|
229
249
|
type index_Erc20TokenPeriodicPermission = Erc20TokenPeriodicPermission;
|
|
230
250
|
type index_Erc20TokenRevocationPermission = Erc20TokenRevocationPermission;
|
|
231
251
|
type index_Erc20TokenStreamPermission = Erc20TokenStreamPermission;
|
|
@@ -234,6 +254,7 @@ type index_GetGrantedExecutionPermissionsResult = GetGrantedExecutionPermissions
|
|
|
234
254
|
type index_GetSupportedExecutionPermissionsResult = GetSupportedExecutionPermissionsResult;
|
|
235
255
|
type index_MetaMaskExtensionClient = MetaMaskExtensionClient;
|
|
236
256
|
type index_MetaMaskExtensionSchema = MetaMaskExtensionSchema;
|
|
257
|
+
type index_NativeTokenAllowancePermission = NativeTokenAllowancePermission;
|
|
237
258
|
type index_NativeTokenPeriodicPermission = NativeTokenPeriodicPermission;
|
|
238
259
|
type index_NativeTokenStreamPermission = NativeTokenStreamPermission;
|
|
239
260
|
type index_PeriodTransferResult = PeriodTransferResult;
|
|
@@ -244,6 +265,7 @@ type index_RequestExecutionPermissionsReturnType = RequestExecutionPermissionsRe
|
|
|
244
265
|
type index_RpcGetGrantedExecutionPermissionsResult = RpcGetGrantedExecutionPermissionsResult;
|
|
245
266
|
type index_RpcGetSupportedExecutionPermissionsResult = RpcGetSupportedExecutionPermissionsResult;
|
|
246
267
|
type index_RpcSupportedPermissionInfo = RpcSupportedPermissionInfo;
|
|
268
|
+
declare const index_Rule: typeof Rule;
|
|
247
269
|
type index_SignDelegationParameters = SignDelegationParameters;
|
|
248
270
|
type index_SignDelegationReturnType = SignDelegationReturnType;
|
|
249
271
|
type index_SignUserOperationParameters = SignUserOperationParameters;
|
|
@@ -265,7 +287,7 @@ declare const index_signDelegationActions: typeof signDelegationActions;
|
|
|
265
287
|
declare const index_signUserOperation: typeof signUserOperation;
|
|
266
288
|
declare const index_signUserOperationActions: typeof signUserOperationActions;
|
|
267
289
|
declare namespace index {
|
|
268
|
-
export { type index_CaveatEnforcerParams as CaveatEnforcerParams, type index_DelegatedCall as DelegatedCall, type index_Erc20TokenPeriodicPermission as Erc20TokenPeriodicPermission, type index_Erc20TokenRevocationPermission as Erc20TokenRevocationPermission, type index_Erc20TokenStreamPermission as Erc20TokenStreamPermission, type index_Erc7715Client as Erc7715Client, type index_GetGrantedExecutionPermissionsResult as GetGrantedExecutionPermissionsResult, type index_GetSupportedExecutionPermissionsResult as GetSupportedExecutionPermissionsResult, type index_MetaMaskExtensionClient as MetaMaskExtensionClient, type index_MetaMaskExtensionSchema as MetaMaskExtensionSchema, type index_NativeTokenPeriodicPermission as NativeTokenPeriodicPermission, type index_NativeTokenStreamPermission as NativeTokenStreamPermission, type index_PeriodTransferResult as PeriodTransferResult, type index_PermissionRequestParameter as PermissionRequestParameter, type index_PermissionTypes as PermissionTypes, type index_RequestExecutionPermissionsParameters as RequestExecutionPermissionsParameters, type index_RequestExecutionPermissionsReturnType as RequestExecutionPermissionsReturnType, type index_RpcGetGrantedExecutionPermissionsResult as RpcGetGrantedExecutionPermissionsResult, type index_RpcGetSupportedExecutionPermissionsResult as RpcGetSupportedExecutionPermissionsResult, type index_RpcSupportedPermissionInfo as RpcSupportedPermissionInfo, type index_SignDelegationParameters as SignDelegationParameters, type index_SignDelegationReturnType as SignDelegationReturnType, type index_SignUserOperationParameters as SignUserOperationParameters, type index_SignUserOperationReturnType as SignUserOperationReturnType, type index_StreamingResult as StreamingResult, type index_SupportedPermissionInfo as SupportedPermissionInfo, index_caveatEnforcerActions as caveatEnforcerActions, index_erc7710BundlerActions as erc7710BundlerActions, index_erc7710WalletActions as erc7710WalletActions, index_erc7715ProviderActions as erc7715ProviderActions, index_getErc20PeriodTransferEnforcerAvailableAmount as getErc20PeriodTransferEnforcerAvailableAmount, index_getErc20StreamingEnforcerAvailableAmount as getErc20StreamingEnforcerAvailableAmount, erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions, index_getMultiTokenPeriodEnforcerAvailableAmount as getMultiTokenPeriodEnforcerAvailableAmount, index_getNativeTokenPeriodTransferEnforcerAvailableAmount as getNativeTokenPeriodTransferEnforcerAvailableAmount, index_getNativeTokenStreamingEnforcerAvailableAmount as getNativeTokenStreamingEnforcerAvailableAmount, erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions, index_isValid7702Implementation as isValid7702Implementation, erc7715RequestExecutionPermissionsAction as requestExecutionPermissions, index_signDelegation as signDelegation, index_signDelegationActions as signDelegationActions, index_signUserOperation as signUserOperation, index_signUserOperationActions as signUserOperationActions };
|
|
290
|
+
export { type index_CaveatEnforcerParams as CaveatEnforcerParams, type index_DelegatedCall as DelegatedCall, type index_Erc20TokenAllowancePermission as Erc20TokenAllowancePermission, type index_Erc20TokenPeriodicPermission as Erc20TokenPeriodicPermission, type index_Erc20TokenRevocationPermission as Erc20TokenRevocationPermission, type index_Erc20TokenStreamPermission as Erc20TokenStreamPermission, type index_Erc7715Client as Erc7715Client, type index_GetGrantedExecutionPermissionsResult as GetGrantedExecutionPermissionsResult, type index_GetSupportedExecutionPermissionsResult as GetSupportedExecutionPermissionsResult, type index_MetaMaskExtensionClient as MetaMaskExtensionClient, type index_MetaMaskExtensionSchema as MetaMaskExtensionSchema, type index_NativeTokenAllowancePermission as NativeTokenAllowancePermission, type index_NativeTokenPeriodicPermission as NativeTokenPeriodicPermission, type index_NativeTokenStreamPermission as NativeTokenStreamPermission, type index_PeriodTransferResult as PeriodTransferResult, type index_PermissionRequestParameter as PermissionRequestParameter, type index_PermissionTypes as PermissionTypes, type index_RequestExecutionPermissionsParameters as RequestExecutionPermissionsParameters, type index_RequestExecutionPermissionsReturnType as RequestExecutionPermissionsReturnType, type index_RpcGetGrantedExecutionPermissionsResult as RpcGetGrantedExecutionPermissionsResult, type index_RpcGetSupportedExecutionPermissionsResult as RpcGetSupportedExecutionPermissionsResult, type index_RpcSupportedPermissionInfo as RpcSupportedPermissionInfo, index_Rule as Rule, type index_SignDelegationParameters as SignDelegationParameters, type index_SignDelegationReturnType as SignDelegationReturnType, type index_SignUserOperationParameters as SignUserOperationParameters, type index_SignUserOperationReturnType as SignUserOperationReturnType, type index_StreamingResult as StreamingResult, type index_SupportedPermissionInfo as SupportedPermissionInfo, index_caveatEnforcerActions as caveatEnforcerActions, index_erc7710BundlerActions as erc7710BundlerActions, index_erc7710WalletActions as erc7710WalletActions, index_erc7715ProviderActions as erc7715ProviderActions, index_getErc20PeriodTransferEnforcerAvailableAmount as getErc20PeriodTransferEnforcerAvailableAmount, index_getErc20StreamingEnforcerAvailableAmount as getErc20StreamingEnforcerAvailableAmount, erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions, index_getMultiTokenPeriodEnforcerAvailableAmount as getMultiTokenPeriodEnforcerAvailableAmount, index_getNativeTokenPeriodTransferEnforcerAvailableAmount as getNativeTokenPeriodTransferEnforcerAvailableAmount, index_getNativeTokenStreamingEnforcerAvailableAmount as getNativeTokenStreamingEnforcerAvailableAmount, erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions, index_isValid7702Implementation as isValid7702Implementation, erc7715RequestExecutionPermissionsAction as requestExecutionPermissions, index_signDelegation as signDelegation, index_signDelegationActions as signDelegationActions, index_signUserOperation as signUserOperation, index_signUserOperationActions as signUserOperationActions };
|
|
269
291
|
}
|
|
270
292
|
|
|
271
|
-
export {
|
|
293
|
+
export { erc7715GetGrantedExecutionPermissionsAction as A, getMultiTokenPeriodEnforcerAvailableAmount as B, type CaveatEnforcerParams as C, type DelegatedCall as D, type Erc20TokenAllowancePermission as E, getNativeTokenPeriodTransferEnforcerAvailableAmount as F, type GetGrantedExecutionPermissionsResult as G, getNativeTokenStreamingEnforcerAvailableAmount as H, erc7715GetSupportedExecutionPermissionsAction as I, isValid7702Implementation as J, erc7715RequestExecutionPermissionsAction as K, signDelegation as L, type MetaMaskExtensionClient as M, type NativeTokenAllowancePermission as N, signDelegationActions as O, type PeriodTransferResult as P, signUserOperation as Q, type RequestExecutionPermissionsParameters as R, type SignDelegationParameters as S, signUserOperationActions as T, type Erc20TokenPeriodicPermission as a, type Erc20TokenRevocationPermission as b, caveatEnforcerActions as c, type Erc20TokenStreamPermission as d, type Erc7715Client as e, type GetSupportedExecutionPermissionsResult as f, type MetaMaskExtensionSchema as g, type NativeTokenPeriodicPermission as h, index as i, type NativeTokenStreamPermission as j, type PermissionRequestParameter as k, type PermissionTypes as l, type RequestExecutionPermissionsReturnType as m, type RpcGetGrantedExecutionPermissionsResult as n, type RpcGetSupportedExecutionPermissionsResult as o, type RpcSupportedPermissionInfo as p, type SignDelegationReturnType as q, type SignUserOperationParameters as r, type SignUserOperationReturnType as s, type StreamingResult as t, type SupportedPermissionInfo as u, erc7710BundlerActions as v, erc7710WalletActions as w, erc7715ProviderActions as x, getErc20PeriodTransferEnforcerAvailableAmount as y, getErc20StreamingEnforcerAvailableAmount as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PermissionRequest as PermissionRequest$1, PermissionTypes as PermissionTypes$1, PermissionResponse as PermissionResponse$1 } from '@metamask/7715-permission-types';
|
|
1
|
+
import { Rule, PermissionRequest as PermissionRequest$1, PermissionTypes as PermissionTypes$1, PermissionResponse as PermissionResponse$1 } from '@metamask/7715-permission-types';
|
|
2
2
|
import { Address, Hex, Client, Transport, Chain, Account, RpcSchema, OneOf, PublicClient, SendTransactionRequest, SendTransactionParameters, WalletClient } from 'viem';
|
|
3
3
|
import { SmartAccount, SendUserOperationParameters } from 'viem/account-abstraction';
|
|
4
4
|
import { l as Call, P as PermissionContext, S as SmartAccountsEnvironment, D as Delegation } from './types-BWaH4KH1.js';
|
|
@@ -49,19 +49,38 @@ type Erc20TokenPeriodicPermission = BasePermission & {
|
|
|
49
49
|
justification?: string;
|
|
50
50
|
};
|
|
51
51
|
};
|
|
52
|
+
type NativeTokenAllowancePermission = BasePermission & {
|
|
53
|
+
type: 'native-token-allowance';
|
|
54
|
+
data: {
|
|
55
|
+
allowanceAmount: bigint;
|
|
56
|
+
startTime?: number;
|
|
57
|
+
justification?: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
type Erc20TokenAllowancePermission = BasePermission & {
|
|
61
|
+
type: 'erc20-token-allowance';
|
|
62
|
+
data: {
|
|
63
|
+
allowanceAmount: bigint;
|
|
64
|
+
startTime?: number;
|
|
65
|
+
tokenAddress: Address;
|
|
66
|
+
justification?: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
52
69
|
type Erc20TokenRevocationPermission = BasePermission & {
|
|
53
70
|
type: 'erc20-token-revocation';
|
|
54
71
|
data: {
|
|
55
72
|
justification?: string;
|
|
56
73
|
};
|
|
57
74
|
};
|
|
58
|
-
type PermissionTypes = NativeTokenStreamPermission | NativeTokenPeriodicPermission | Erc20TokenStreamPermission | Erc20TokenPeriodicPermission | Erc20TokenRevocationPermission;
|
|
75
|
+
type PermissionTypes = NativeTokenStreamPermission | NativeTokenPeriodicPermission | NativeTokenAllowancePermission | Erc20TokenStreamPermission | Erc20TokenPeriodicPermission | Erc20TokenAllowancePermission | Erc20TokenRevocationPermission;
|
|
59
76
|
type PermissionRequestParameter = {
|
|
60
77
|
chainId: number;
|
|
61
78
|
permission: PermissionTypes;
|
|
62
79
|
to: Hex;
|
|
63
80
|
from?: Address | undefined | null;
|
|
64
81
|
expiry?: number | undefined | null;
|
|
82
|
+
redeemer?: readonly Address[] | undefined | null;
|
|
83
|
+
payee?: readonly Address[] | undefined | null;
|
|
65
84
|
};
|
|
66
85
|
type SupportedPermissionInfo = {
|
|
67
86
|
chainIds: number[];
|
|
@@ -74,7 +93,7 @@ type PermissionRequest<TPermission extends PermissionTypes> = {
|
|
|
74
93
|
from?: Hex;
|
|
75
94
|
to: Hex;
|
|
76
95
|
permission: TPermission;
|
|
77
|
-
rules?:
|
|
96
|
+
rules?: Rule[] | null;
|
|
78
97
|
};
|
|
79
98
|
type PermissionResponse<TPermission extends PermissionTypes> = PermissionRequest<TPermission> & {
|
|
80
99
|
context: Hex;
|
|
@@ -226,6 +245,7 @@ declare const erc7710BundlerActions: () => (client: Client) => {
|
|
|
226
245
|
|
|
227
246
|
type index_CaveatEnforcerParams = CaveatEnforcerParams;
|
|
228
247
|
type index_DelegatedCall = DelegatedCall;
|
|
248
|
+
type index_Erc20TokenAllowancePermission = Erc20TokenAllowancePermission;
|
|
229
249
|
type index_Erc20TokenPeriodicPermission = Erc20TokenPeriodicPermission;
|
|
230
250
|
type index_Erc20TokenRevocationPermission = Erc20TokenRevocationPermission;
|
|
231
251
|
type index_Erc20TokenStreamPermission = Erc20TokenStreamPermission;
|
|
@@ -234,6 +254,7 @@ type index_GetGrantedExecutionPermissionsResult = GetGrantedExecutionPermissions
|
|
|
234
254
|
type index_GetSupportedExecutionPermissionsResult = GetSupportedExecutionPermissionsResult;
|
|
235
255
|
type index_MetaMaskExtensionClient = MetaMaskExtensionClient;
|
|
236
256
|
type index_MetaMaskExtensionSchema = MetaMaskExtensionSchema;
|
|
257
|
+
type index_NativeTokenAllowancePermission = NativeTokenAllowancePermission;
|
|
237
258
|
type index_NativeTokenPeriodicPermission = NativeTokenPeriodicPermission;
|
|
238
259
|
type index_NativeTokenStreamPermission = NativeTokenStreamPermission;
|
|
239
260
|
type index_PeriodTransferResult = PeriodTransferResult;
|
|
@@ -244,6 +265,7 @@ type index_RequestExecutionPermissionsReturnType = RequestExecutionPermissionsRe
|
|
|
244
265
|
type index_RpcGetGrantedExecutionPermissionsResult = RpcGetGrantedExecutionPermissionsResult;
|
|
245
266
|
type index_RpcGetSupportedExecutionPermissionsResult = RpcGetSupportedExecutionPermissionsResult;
|
|
246
267
|
type index_RpcSupportedPermissionInfo = RpcSupportedPermissionInfo;
|
|
268
|
+
declare const index_Rule: typeof Rule;
|
|
247
269
|
type index_SignDelegationParameters = SignDelegationParameters;
|
|
248
270
|
type index_SignDelegationReturnType = SignDelegationReturnType;
|
|
249
271
|
type index_SignUserOperationParameters = SignUserOperationParameters;
|
|
@@ -265,7 +287,7 @@ declare const index_signDelegationActions: typeof signDelegationActions;
|
|
|
265
287
|
declare const index_signUserOperation: typeof signUserOperation;
|
|
266
288
|
declare const index_signUserOperationActions: typeof signUserOperationActions;
|
|
267
289
|
declare namespace index {
|
|
268
|
-
export { type index_CaveatEnforcerParams as CaveatEnforcerParams, type index_DelegatedCall as DelegatedCall, type index_Erc20TokenPeriodicPermission as Erc20TokenPeriodicPermission, type index_Erc20TokenRevocationPermission as Erc20TokenRevocationPermission, type index_Erc20TokenStreamPermission as Erc20TokenStreamPermission, type index_Erc7715Client as Erc7715Client, type index_GetGrantedExecutionPermissionsResult as GetGrantedExecutionPermissionsResult, type index_GetSupportedExecutionPermissionsResult as GetSupportedExecutionPermissionsResult, type index_MetaMaskExtensionClient as MetaMaskExtensionClient, type index_MetaMaskExtensionSchema as MetaMaskExtensionSchema, type index_NativeTokenPeriodicPermission as NativeTokenPeriodicPermission, type index_NativeTokenStreamPermission as NativeTokenStreamPermission, type index_PeriodTransferResult as PeriodTransferResult, type index_PermissionRequestParameter as PermissionRequestParameter, type index_PermissionTypes as PermissionTypes, type index_RequestExecutionPermissionsParameters as RequestExecutionPermissionsParameters, type index_RequestExecutionPermissionsReturnType as RequestExecutionPermissionsReturnType, type index_RpcGetGrantedExecutionPermissionsResult as RpcGetGrantedExecutionPermissionsResult, type index_RpcGetSupportedExecutionPermissionsResult as RpcGetSupportedExecutionPermissionsResult, type index_RpcSupportedPermissionInfo as RpcSupportedPermissionInfo, type index_SignDelegationParameters as SignDelegationParameters, type index_SignDelegationReturnType as SignDelegationReturnType, type index_SignUserOperationParameters as SignUserOperationParameters, type index_SignUserOperationReturnType as SignUserOperationReturnType, type index_StreamingResult as StreamingResult, type index_SupportedPermissionInfo as SupportedPermissionInfo, index_caveatEnforcerActions as caveatEnforcerActions, index_erc7710BundlerActions as erc7710BundlerActions, index_erc7710WalletActions as erc7710WalletActions, index_erc7715ProviderActions as erc7715ProviderActions, index_getErc20PeriodTransferEnforcerAvailableAmount as getErc20PeriodTransferEnforcerAvailableAmount, index_getErc20StreamingEnforcerAvailableAmount as getErc20StreamingEnforcerAvailableAmount, erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions, index_getMultiTokenPeriodEnforcerAvailableAmount as getMultiTokenPeriodEnforcerAvailableAmount, index_getNativeTokenPeriodTransferEnforcerAvailableAmount as getNativeTokenPeriodTransferEnforcerAvailableAmount, index_getNativeTokenStreamingEnforcerAvailableAmount as getNativeTokenStreamingEnforcerAvailableAmount, erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions, index_isValid7702Implementation as isValid7702Implementation, erc7715RequestExecutionPermissionsAction as requestExecutionPermissions, index_signDelegation as signDelegation, index_signDelegationActions as signDelegationActions, index_signUserOperation as signUserOperation, index_signUserOperationActions as signUserOperationActions };
|
|
290
|
+
export { type index_CaveatEnforcerParams as CaveatEnforcerParams, type index_DelegatedCall as DelegatedCall, type index_Erc20TokenAllowancePermission as Erc20TokenAllowancePermission, type index_Erc20TokenPeriodicPermission as Erc20TokenPeriodicPermission, type index_Erc20TokenRevocationPermission as Erc20TokenRevocationPermission, type index_Erc20TokenStreamPermission as Erc20TokenStreamPermission, type index_Erc7715Client as Erc7715Client, type index_GetGrantedExecutionPermissionsResult as GetGrantedExecutionPermissionsResult, type index_GetSupportedExecutionPermissionsResult as GetSupportedExecutionPermissionsResult, type index_MetaMaskExtensionClient as MetaMaskExtensionClient, type index_MetaMaskExtensionSchema as MetaMaskExtensionSchema, type index_NativeTokenAllowancePermission as NativeTokenAllowancePermission, type index_NativeTokenPeriodicPermission as NativeTokenPeriodicPermission, type index_NativeTokenStreamPermission as NativeTokenStreamPermission, type index_PeriodTransferResult as PeriodTransferResult, type index_PermissionRequestParameter as PermissionRequestParameter, type index_PermissionTypes as PermissionTypes, type index_RequestExecutionPermissionsParameters as RequestExecutionPermissionsParameters, type index_RequestExecutionPermissionsReturnType as RequestExecutionPermissionsReturnType, type index_RpcGetGrantedExecutionPermissionsResult as RpcGetGrantedExecutionPermissionsResult, type index_RpcGetSupportedExecutionPermissionsResult as RpcGetSupportedExecutionPermissionsResult, type index_RpcSupportedPermissionInfo as RpcSupportedPermissionInfo, index_Rule as Rule, type index_SignDelegationParameters as SignDelegationParameters, type index_SignDelegationReturnType as SignDelegationReturnType, type index_SignUserOperationParameters as SignUserOperationParameters, type index_SignUserOperationReturnType as SignUserOperationReturnType, type index_StreamingResult as StreamingResult, type index_SupportedPermissionInfo as SupportedPermissionInfo, index_caveatEnforcerActions as caveatEnforcerActions, index_erc7710BundlerActions as erc7710BundlerActions, index_erc7710WalletActions as erc7710WalletActions, index_erc7715ProviderActions as erc7715ProviderActions, index_getErc20PeriodTransferEnforcerAvailableAmount as getErc20PeriodTransferEnforcerAvailableAmount, index_getErc20StreamingEnforcerAvailableAmount as getErc20StreamingEnforcerAvailableAmount, erc7715GetGrantedExecutionPermissionsAction as getGrantedExecutionPermissions, index_getMultiTokenPeriodEnforcerAvailableAmount as getMultiTokenPeriodEnforcerAvailableAmount, index_getNativeTokenPeriodTransferEnforcerAvailableAmount as getNativeTokenPeriodTransferEnforcerAvailableAmount, index_getNativeTokenStreamingEnforcerAvailableAmount as getNativeTokenStreamingEnforcerAvailableAmount, erc7715GetSupportedExecutionPermissionsAction as getSupportedExecutionPermissions, index_isValid7702Implementation as isValid7702Implementation, erc7715RequestExecutionPermissionsAction as requestExecutionPermissions, index_signDelegation as signDelegation, index_signDelegationActions as signDelegationActions, index_signUserOperation as signUserOperation, index_signUserOperationActions as signUserOperationActions };
|
|
269
291
|
}
|
|
270
292
|
|
|
271
|
-
export {
|
|
293
|
+
export { erc7715GetGrantedExecutionPermissionsAction as A, getMultiTokenPeriodEnforcerAvailableAmount as B, type CaveatEnforcerParams as C, type DelegatedCall as D, type Erc20TokenAllowancePermission as E, getNativeTokenPeriodTransferEnforcerAvailableAmount as F, type GetGrantedExecutionPermissionsResult as G, getNativeTokenStreamingEnforcerAvailableAmount as H, erc7715GetSupportedExecutionPermissionsAction as I, isValid7702Implementation as J, erc7715RequestExecutionPermissionsAction as K, signDelegation as L, type MetaMaskExtensionClient as M, type NativeTokenAllowancePermission as N, signDelegationActions as O, type PeriodTransferResult as P, signUserOperation as Q, type RequestExecutionPermissionsParameters as R, type SignDelegationParameters as S, signUserOperationActions as T, type Erc20TokenPeriodicPermission as a, type Erc20TokenRevocationPermission as b, caveatEnforcerActions as c, type Erc20TokenStreamPermission as d, type Erc7715Client as e, type GetSupportedExecutionPermissionsResult as f, type MetaMaskExtensionSchema as g, type NativeTokenPeriodicPermission as h, index as i, type NativeTokenStreamPermission as j, type PermissionRequestParameter as k, type PermissionTypes as l, type RequestExecutionPermissionsReturnType as m, type RpcGetGrantedExecutionPermissionsResult as n, type RpcGetSupportedExecutionPermissionsResult as o, type RpcSupportedPermissionInfo as p, type SignDelegationReturnType as q, type SignUserOperationParameters as r, type SignUserOperationReturnType as s, type StreamingResult as t, type SupportedPermissionInfo as u, erc7710BundlerActions as v, erc7710WalletActions as w, erc7715ProviderActions as x, getErc20PeriodTransferEnforcerAvailableAmount as y, getErc20StreamingEnforcerAvailableAmount as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ANY_BENEFICIARY, ROOT_AUTHORITY } from '@metamask/delegation-core';
|
|
2
2
|
import * as viem from 'viem';
|
|
3
3
|
import { Client, Transport, Chain, Account, Address, Hex } from 'viem';
|
|
4
|
-
import { m as DelegationStruct, E as ExecutionMode, d as ExecutionStruct } from './delegation-
|
|
4
|
+
import { m as DelegationStruct, E as ExecutionMode, d as ExecutionStruct } from './delegation-CR99q1-n.js';
|
|
5
5
|
import { D as Delegation, P as PermissionContext } from './types-BWaH4KH1.js';
|
|
6
6
|
|
|
7
7
|
declare const NAME$1 = "DelegationManager";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ANY_BENEFICIARY, ROOT_AUTHORITY } from '@metamask/delegation-core';
|
|
2
2
|
import * as viem from 'viem';
|
|
3
3
|
import { Client, Transport, Chain, Account, Address, Hex } from 'viem';
|
|
4
|
-
import { m as DelegationStruct, E as ExecutionMode, d as ExecutionStruct } from './delegation-
|
|
4
|
+
import { m as DelegationStruct, E as ExecutionMode, d as ExecutionStruct } from './delegation-DoVULGYE.cjs';
|
|
5
5
|
import { D as Delegation, P as PermissionContext } from './types-BWaH4KH1.cjs';
|
|
6
6
|
|
|
7
7
|
declare const NAME$1 = "DelegationManager";
|