@lit-protocol/vincent-ability-sdk 2.2.0 → 2.3.1
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/dist/CHANGELOG.md +30 -0
- package/dist/package.json +3 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.d.ts +9 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.d.ts.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.js +68 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.js.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/index.d.ts +3 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/index.d.ts.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/index.js +8 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/index.js.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/lit-actions-smart-signer.d.ts +68 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/lit-actions-smart-signer.d.ts.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/lit-actions-smart-signer.js +94 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/lit-actions-smart-signer.js.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/sponsored-gas-contract-call.d.ts +30 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/sponsored-gas-contract-call.d.ts.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/sponsored-gas-contract-call.js +45 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/sponsored-gas-contract-call.js.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/sponsored-gas-raw-transaction.d.ts +23 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/sponsored-gas-raw-transaction.d.ts.map +1 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/sponsored-gas-raw-transaction.js +121 -0
- package/dist/src/lib/abilityHelpers/gasSponsorship/sponsored-gas-raw-transaction.js.map +1 -0
- package/dist/src/lib/abilityHelpers/index.d.ts +1 -0
- package/dist/src/lib/abilityHelpers/index.d.ts.map +1 -1
- package/dist/src/lib/abilityHelpers/index.js +4 -1
- package/dist/src/lib/abilityHelpers/index.js.map +1 -1
- package/dist/src/type-inference-verification/ability-definition-tests.d.ts +18 -18
- package/dist/src/type-inference-verification/playground.d.ts +17 -17
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 2.3.1 (2025-10-08)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated contracts-sdk to 2.0.0
|
|
6
|
+
|
|
7
|
+
## 2.3.0 (2025-10-06)
|
|
8
|
+
|
|
9
|
+
### 🚀 Features
|
|
10
|
+
|
|
11
|
+
- Export new methods: sponsoredGasContractCall and sponsoredGasRawTransaction to allow for Alchemy gas sponsorship of broadcast transaction from a Vincent Ability ([39b5e217](https://github.com/LIT-Protocol/Vincent/commit/39b5e217))
|
|
12
|
+
|
|
13
|
+
### ❤️ Thank You
|
|
14
|
+
|
|
15
|
+
- Wyatt Barnes @spacesailor24
|
|
16
|
+
|
|
1
17
|
## 2.2.0 (2025-09-25)
|
|
2
18
|
|
|
3
19
|
### 🚀 Features
|
package/dist/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
## 2.3.1 (2025-10-08)
|
|
2
|
+
|
|
3
|
+
### 🧱 Updated Dependencies
|
|
4
|
+
|
|
5
|
+
- Updated contracts-sdk to 2.0.0
|
|
6
|
+
|
|
7
|
+
## 2.3.0 (2025-10-06)
|
|
8
|
+
|
|
9
|
+
### 🚀 Features
|
|
10
|
+
|
|
11
|
+
- Export new methods: sponsoredGasContractCall and sponsoredGasRawTransaction to allow for Alchemy gas sponsorship of broadcast transaction from a Vincent Ability ([39b5e217](https://github.com/LIT-Protocol/Vincent/commit/39b5e217))
|
|
12
|
+
|
|
13
|
+
### ❤️ Thank You
|
|
14
|
+
|
|
15
|
+
- Wyatt Barnes @spacesailor24
|
|
16
|
+
|
|
17
|
+
## 2.2.0 (2025-09-25)
|
|
18
|
+
|
|
19
|
+
### 🚀 Features
|
|
20
|
+
|
|
21
|
+
- Export new populateTransaction method which utilizes ethers v6 to populate a minimal transaction object with nonce, chain id, and gas data ([8170cda4](https://github.com/LIT-Protocol/Vincent/commit/8170cda4))
|
|
22
|
+
|
|
23
|
+
### 🧱 Updated Dependencies
|
|
24
|
+
|
|
25
|
+
- Updated contracts-sdk to 1.3.0
|
|
26
|
+
|
|
27
|
+
### ❤️ Thank You
|
|
28
|
+
|
|
29
|
+
- Wyatt Barnes @spacesailor24
|
|
30
|
+
|
|
1
31
|
## 2.1.0 (2025-09-11)
|
|
2
32
|
|
|
3
33
|
### 🚀 Features
|
package/dist/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-ability-sdk",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@account-kit/infra": "^4.53.1",
|
|
9
|
+
"@account-kit/smart-contracts": "^4.53.1",
|
|
8
10
|
"@lit-protocol/vincent-contracts-sdk": "workspace:*",
|
|
9
11
|
"ethers": "5.8.0",
|
|
10
12
|
"ethers-v6": "npm:ethers@^6",
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,5 +12,5 @@ export type { PolicyConfigLifecycleFunction, PolicyConfigCommitFunction, } from
|
|
|
12
12
|
export type { PolicyContext } from './lib/policyCore/policyConfig/context/types';
|
|
13
13
|
export type { VincentAbilityPolicy, BaseContext, PolicyEvaluationResultContext, VincentAbility, AbilityConsumerContext, PolicyConsumerContext, SchemaValidationError, } from './lib/types';
|
|
14
14
|
export type { BaseAbilityContext } from './lib/abilityCore/abilityConfig/context/types';
|
|
15
|
-
export { populateTransaction } from './lib/abilityHelpers';
|
|
15
|
+
export { populateTransaction, sponsoredGasRawTransaction, sponsoredGasContractCall, } from './lib/abilityHelpers';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AAEpG,YAAY,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACpF,YAAY,EACV,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,YAAY,EACV,oBAAoB,EACpB,WAAW,EACX,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAExF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAC;AAEpG,YAAY,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,YAAY,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AACpF,YAAY,EACV,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,qCAAqC,CAAC;AAC7C,YAAY,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAEjF,YAAY,EACV,oBAAoB,EACpB,WAAW,EACX,6BAA6B,EAC7B,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAExF,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,sBAAsB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.populateTransaction = exports.supportedPoliciesForAbility = exports.asBundledVincentPolicy = exports.asBundledVincentAbility = exports.vincentAbilityHandler = exports.vincentPolicyHandler = exports.VINCENT_TOOL_API_VERSION = exports.createVincentAbility = exports.createVincentAbilityPolicy = exports.createVincentPolicy = void 0;
|
|
3
|
+
exports.sponsoredGasContractCall = exports.sponsoredGasRawTransaction = exports.populateTransaction = exports.supportedPoliciesForAbility = exports.asBundledVincentPolicy = exports.asBundledVincentAbility = exports.vincentAbilityHandler = exports.vincentPolicyHandler = exports.VINCENT_TOOL_API_VERSION = exports.createVincentAbility = exports.createVincentAbilityPolicy = exports.createVincentPolicy = void 0;
|
|
4
4
|
var vincentPolicy_1 = require("./lib/policyCore/vincentPolicy");
|
|
5
5
|
Object.defineProperty(exports, "createVincentPolicy", { enumerable: true, get: function () { return vincentPolicy_1.createVincentPolicy; } });
|
|
6
6
|
Object.defineProperty(exports, "createVincentAbilityPolicy", { enumerable: true, get: function () { return vincentPolicy_1.createVincentAbilityPolicy; } });
|
|
@@ -20,4 +20,6 @@ var supportedPoliciesForAbility_1 = require("./lib/abilityCore/helpers/supported
|
|
|
20
20
|
Object.defineProperty(exports, "supportedPoliciesForAbility", { enumerable: true, get: function () { return supportedPoliciesForAbility_1.supportedPoliciesForAbility; } });
|
|
21
21
|
var abilityHelpers_1 = require("./lib/abilityHelpers");
|
|
22
22
|
Object.defineProperty(exports, "populateTransaction", { enumerable: true, get: function () { return abilityHelpers_1.populateTransaction; } });
|
|
23
|
+
Object.defineProperty(exports, "sponsoredGasRawTransaction", { enumerable: true, get: function () { return abilityHelpers_1.sponsoredGasRawTransaction; } });
|
|
24
|
+
Object.defineProperty(exports, "sponsoredGasContractCall", { enumerable: true, get: function () { return abilityHelpers_1.sponsoredGasContractCall; } });
|
|
23
25
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAiG;AAAxF,oHAAA,mBAAmB,OAAA;AAAE,2HAAA,0BAA0B,OAAA;AACxD,mEAAwE;AAA/D,sHAAA,oBAAoB,OAAA;AAC7B,6CAA2D;AAAlD,qHAAA,wBAAwB,OAAA;AAEjC,4EAA2E;AAAlE,4HAAA,oBAAoB,OAAA;AAC7B,8EAA6E;AAApE,8HAAA,qBAAqB,OAAA;AAE9B,kFAA0F;AAAjF,yHAAA,uBAAuB,OAAA;AAChC,8EAAsF;AAA7E,uHAAA,sBAAsB,OAAA;AAC/B,qGAAoG;AAA3F,0IAAA,2BAA2B,OAAA;AAsBpC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAiG;AAAxF,oHAAA,mBAAmB,OAAA;AAAE,2HAAA,0BAA0B,OAAA;AACxD,mEAAwE;AAA/D,sHAAA,oBAAoB,OAAA;AAC7B,6CAA2D;AAAlD,qHAAA,wBAAwB,OAAA;AAEjC,4EAA2E;AAAlE,4HAAA,oBAAoB,OAAA;AAC7B,8EAA6E;AAApE,8HAAA,qBAAqB,OAAA;AAE9B,kFAA0F;AAAjF,yHAAA,uBAAuB,OAAA;AAChC,8EAAsF;AAA7E,uHAAA,sBAAsB,OAAA;AAC/B,qGAAoG;AAA3F,0IAAA,2BAA2B,OAAA;AAsBpC,uDAI8B;AAH5B,qHAAA,mBAAmB,OAAA;AACnB,4HAAA,0BAA0B,OAAA;AAC1B,0HAAA,wBAAwB,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { mainnet } from '@account-kit/infra';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get Alchemy chain configuration
|
|
4
|
+
* Automatically supports all chains exported from @account-kit/infra by matching chainId to chain.id
|
|
5
|
+
*
|
|
6
|
+
* @returns The Alchemy chain configuration as a Viem Chain object. Using typeof mainnet to avoid adding Viem as a dev dependency just for the Chain type.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAlchemyChainConfig(chainId: number): typeof mainnet;
|
|
9
|
+
//# sourceMappingURL=get-alchemy-chain-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-alchemy-chain-config.d.ts","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,OAAO,EAmCR,MAAM,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,OAAO,CA6DrE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAlchemyChainConfig = getAlchemyChainConfig;
|
|
4
|
+
const infra_1 = require("@account-kit/infra");
|
|
5
|
+
/**
|
|
6
|
+
* Helper function to get Alchemy chain configuration
|
|
7
|
+
* Automatically supports all chains exported from @account-kit/infra by matching chainId to chain.id
|
|
8
|
+
*
|
|
9
|
+
* @returns The Alchemy chain configuration as a Viem Chain object. Using typeof mainnet to avoid adding Viem as a dev dependency just for the Chain type.
|
|
10
|
+
*/
|
|
11
|
+
function getAlchemyChainConfig(chainId) {
|
|
12
|
+
// Array of all supported chain objects
|
|
13
|
+
const supportedChains = [
|
|
14
|
+
infra_1.arbitrum,
|
|
15
|
+
infra_1.arbitrumGoerli,
|
|
16
|
+
infra_1.arbitrumNova,
|
|
17
|
+
infra_1.arbitrumSepolia,
|
|
18
|
+
infra_1.base,
|
|
19
|
+
infra_1.baseGoerli,
|
|
20
|
+
infra_1.baseSepolia,
|
|
21
|
+
infra_1.fraxtal,
|
|
22
|
+
infra_1.fraxtalSepolia,
|
|
23
|
+
infra_1.goerli,
|
|
24
|
+
infra_1.mainnet,
|
|
25
|
+
infra_1.optimism,
|
|
26
|
+
infra_1.optimismGoerli,
|
|
27
|
+
infra_1.optimismSepolia,
|
|
28
|
+
infra_1.polygon,
|
|
29
|
+
infra_1.polygonAmoy,
|
|
30
|
+
infra_1.polygonMumbai,
|
|
31
|
+
infra_1.sepolia,
|
|
32
|
+
infra_1.shape,
|
|
33
|
+
infra_1.shapeSepolia,
|
|
34
|
+
infra_1.worldChain,
|
|
35
|
+
infra_1.worldChainSepolia,
|
|
36
|
+
infra_1.zora,
|
|
37
|
+
infra_1.zoraSepolia,
|
|
38
|
+
infra_1.beraChainBartio,
|
|
39
|
+
infra_1.opbnbMainnet,
|
|
40
|
+
infra_1.opbnbTestnet,
|
|
41
|
+
infra_1.soneiumMinato,
|
|
42
|
+
infra_1.soneiumMainnet,
|
|
43
|
+
infra_1.unichainMainnet,
|
|
44
|
+
infra_1.unichainSepolia,
|
|
45
|
+
infra_1.inkMainnet,
|
|
46
|
+
infra_1.inkSepolia,
|
|
47
|
+
infra_1.mekong,
|
|
48
|
+
infra_1.monadTestnet,
|
|
49
|
+
infra_1.openlootSepolia,
|
|
50
|
+
infra_1.gensynTestnet,
|
|
51
|
+
infra_1.riseTestnet,
|
|
52
|
+
infra_1.storyMainnet,
|
|
53
|
+
infra_1.storyAeneid,
|
|
54
|
+
infra_1.celoAlfajores,
|
|
55
|
+
infra_1.celoMainnet,
|
|
56
|
+
infra_1.teaSepolia,
|
|
57
|
+
infra_1.bobaSepolia,
|
|
58
|
+
infra_1.bobaMainnet,
|
|
59
|
+
];
|
|
60
|
+
// Find the chain that matches the requested chainId
|
|
61
|
+
const chain = supportedChains.find((c) => c.id === chainId);
|
|
62
|
+
if (!chain) {
|
|
63
|
+
throw new Error(`Chain ID ${chainId} not supported by @account-kit/infra. ` +
|
|
64
|
+
`Supported chain IDs: ${supportedChains.map((c) => c.id).join(', ')}`);
|
|
65
|
+
}
|
|
66
|
+
return chain;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=get-alchemy-chain-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-alchemy-chain-config.js","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/get-alchemy-chain-config.ts"],"names":[],"mappings":";;AAsDA,sDA6DC;AAnHD,8CA8C4B;AAE5B;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,OAAe;IACnD,uCAAuC;IACvC,MAAM,eAAe,GAAG;QACtB,gBAAQ;QACR,sBAAc;QACd,oBAAY;QACZ,uBAAe;QACf,YAAI;QACJ,kBAAU;QACV,mBAAW;QACX,eAAO;QACP,sBAAc;QACd,cAAM;QACN,eAAO;QACP,gBAAQ;QACR,sBAAc;QACd,uBAAe;QACf,eAAO;QACP,mBAAW;QACX,qBAAa;QACb,eAAO;QACP,aAAK;QACL,oBAAY;QACZ,kBAAU;QACV,yBAAiB;QACjB,YAAI;QACJ,mBAAW;QACX,uBAAe;QACf,oBAAY;QACZ,oBAAY;QACZ,qBAAa;QACb,sBAAc;QACd,uBAAe;QACf,uBAAe;QACf,kBAAU;QACV,kBAAU;QACV,cAAM;QACN,oBAAY;QACZ,uBAAe;QACf,qBAAa;QACb,mBAAW;QACX,oBAAY;QACZ,mBAAW;QACX,qBAAa;QACb,mBAAW;QACX,kBAAU;QACV,mBAAW;QACX,mBAAW;KACZ,CAAC;IAEF,oDAAoD;IACpD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;IAE5D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,YAAY,OAAO,wCAAwC;YACzD,wBAAwB,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxE,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sponsoredGasContractCall = exports.sponsoredGasRawTransaction = void 0;
|
|
4
|
+
var sponsored_gas_raw_transaction_1 = require("./sponsored-gas-raw-transaction");
|
|
5
|
+
Object.defineProperty(exports, "sponsoredGasRawTransaction", { enumerable: true, get: function () { return sponsored_gas_raw_transaction_1.sponsoredGasRawTransaction; } });
|
|
6
|
+
var sponsored_gas_contract_call_1 = require("./sponsored-gas-contract-call");
|
|
7
|
+
Object.defineProperty(exports, "sponsoredGasContractCall", { enumerable: true, get: function () { return sponsored_gas_contract_call_1.sponsoredGasContractCall; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/index.ts"],"names":[],"mappings":";;;AAAA,iFAA6E;AAApE,2IAAA,0BAA0B,OAAA;AACnC,6EAAyE;AAAhE,uIAAA,wBAAwB,OAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LitActionsSmartSigner for EIP-7702 delegated transactions
|
|
3
|
+
*
|
|
4
|
+
* This signer implements the Alchemy SmartAccountSigner interface to support
|
|
5
|
+
* EIP-7702 delegation with the Lit Protocol PKP. It enables gasless transactions
|
|
6
|
+
* through integration with Alchemy's gas sponsorship.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const signer = new LitActionsSmartSigner({
|
|
11
|
+
* pkpPublicKey,
|
|
12
|
+
* chainId,
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* // Use with Alchemy's Smart Account Client, and pass as the signer.
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export interface LitActionsSmartSignerConfig {
|
|
19
|
+
pkpPublicKey: string;
|
|
20
|
+
chainId: number;
|
|
21
|
+
}
|
|
22
|
+
type Address = `0x${string}`;
|
|
23
|
+
type Hex = `0x${string}`;
|
|
24
|
+
type SignableMessage = string | {
|
|
25
|
+
raw: Hex | Uint8Array;
|
|
26
|
+
};
|
|
27
|
+
type TypedDataDefinition = {
|
|
28
|
+
domain?: any;
|
|
29
|
+
types?: any;
|
|
30
|
+
primaryType?: string;
|
|
31
|
+
message?: any;
|
|
32
|
+
};
|
|
33
|
+
type AuthorizationRequest = {
|
|
34
|
+
address?: Address;
|
|
35
|
+
contractAddress?: Address;
|
|
36
|
+
chainId: number;
|
|
37
|
+
nonce: number;
|
|
38
|
+
};
|
|
39
|
+
type SignedAuthorization = {
|
|
40
|
+
address: Address;
|
|
41
|
+
chainId: number;
|
|
42
|
+
nonce: number;
|
|
43
|
+
r: Hex;
|
|
44
|
+
s: Hex;
|
|
45
|
+
v?: bigint;
|
|
46
|
+
yParity: number;
|
|
47
|
+
};
|
|
48
|
+
interface SmartAccountSigner<Inner = any> {
|
|
49
|
+
signerType: string;
|
|
50
|
+
inner: Inner;
|
|
51
|
+
getAddress: () => Promise<Address>;
|
|
52
|
+
signMessage: (message: SignableMessage) => Promise<Hex>;
|
|
53
|
+
signTypedData: (params: TypedDataDefinition) => Promise<Hex>;
|
|
54
|
+
signAuthorization?: (unsignedAuthorization: AuthorizationRequest) => Promise<SignedAuthorization>;
|
|
55
|
+
}
|
|
56
|
+
export declare class LitActionsSmartSigner implements SmartAccountSigner {
|
|
57
|
+
readonly signerType = "lit-actions";
|
|
58
|
+
readonly inner: any;
|
|
59
|
+
private pkpPublicKey;
|
|
60
|
+
private signerAddress;
|
|
61
|
+
constructor(config: LitActionsSmartSignerConfig);
|
|
62
|
+
getAddress(): Promise<Address>;
|
|
63
|
+
signMessage(message: SignableMessage): Promise<Hex>;
|
|
64
|
+
signTypedData(params: TypedDataDefinition): Promise<Hex>;
|
|
65
|
+
signAuthorization(unsignedAuthorization: AuthorizationRequest): Promise<SignedAuthorization>;
|
|
66
|
+
}
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=lit-actions-smart-signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-actions-smart-signer.d.ts","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/lit-actions-smart-signer.ts"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAGD,KAAK,OAAO,GAAG,KAAK,MAAM,EAAE,CAAC;AAC7B,KAAK,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAGzB,KAAK,eAAe,GAChB,MAAM,GACN;IACE,GAAG,EAAE,GAAG,GAAG,UAAU,CAAC;CACvB,CAAC;AAGN,KAAK,mBAAmB,GAAG;IACzB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAGF,KAAK,oBAAoB,GAAG;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,GAAG,CAAC;IACP,CAAC,EAAE,GAAG,CAAC;IACP,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAGF,UAAU,kBAAkB,CAAC,KAAK,GAAG,GAAG;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,WAAW,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IACxD,aAAa,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;IAC7D,iBAAiB,CAAC,EAAE,CAAC,qBAAqB,EAAE,oBAAoB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACnG;AAED,qBAAa,qBAAsB,YAAW,kBAAkB;IAC9D,QAAQ,CAAC,UAAU,iBAAiB;IACpC,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;IACpB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAS;gBAElB,MAAM,EAAE,2BAA2B;IAYzC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAI9B,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IA2BnD,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC;IAyBxD,iBAAiB,CACrB,qBAAqB,EAAE,oBAAoB,GAC1C,OAAO,CAAC,mBAAmB,CAAC;CAoChC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LitActionsSmartSigner = void 0;
|
|
4
|
+
class LitActionsSmartSigner {
|
|
5
|
+
signerType = 'lit-actions';
|
|
6
|
+
inner;
|
|
7
|
+
pkpPublicKey;
|
|
8
|
+
signerAddress;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
if (config.pkpPublicKey.startsWith('0x')) {
|
|
11
|
+
config.pkpPublicKey = config.pkpPublicKey.slice(2);
|
|
12
|
+
}
|
|
13
|
+
this.pkpPublicKey = config.pkpPublicKey;
|
|
14
|
+
this.signerAddress = ethers.utils.computeAddress('0x' + config.pkpPublicKey);
|
|
15
|
+
this.inner = {
|
|
16
|
+
pkpPublicKey: config.pkpPublicKey,
|
|
17
|
+
chainId: config.chainId,
|
|
18
|
+
}; // Inner client reference
|
|
19
|
+
}
|
|
20
|
+
async getAddress() {
|
|
21
|
+
return this.signerAddress;
|
|
22
|
+
}
|
|
23
|
+
async signMessage(message) {
|
|
24
|
+
let messageToSign;
|
|
25
|
+
if (typeof message === 'string') {
|
|
26
|
+
messageToSign = message;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
messageToSign =
|
|
30
|
+
typeof message.raw === 'string' ? ethers.utils.arrayify(message.raw) : message.raw;
|
|
31
|
+
}
|
|
32
|
+
const messageHash = ethers.utils.hashMessage(messageToSign);
|
|
33
|
+
const sig = await Lit.Actions.signAndCombineEcdsa({
|
|
34
|
+
toSign: ethers.utils.arrayify(messageHash),
|
|
35
|
+
publicKey: this.pkpPublicKey,
|
|
36
|
+
sigName: `alchemyMessage`,
|
|
37
|
+
});
|
|
38
|
+
const parsedSig = JSON.parse(sig);
|
|
39
|
+
return ethers.utils.joinSignature({
|
|
40
|
+
r: '0x' + parsedSig.r.substring(2),
|
|
41
|
+
s: '0x' + parsedSig.s,
|
|
42
|
+
v: parsedSig.v,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async signTypedData(params) {
|
|
46
|
+
// console.log("signTypedData called with params", params);
|
|
47
|
+
// Create the EIP-712 hash
|
|
48
|
+
const hash = ethers.utils._TypedDataEncoder.hash(params.domain || {}, params.types || {}, params.message || {});
|
|
49
|
+
const sig = await Lit.Actions.signAndCombineEcdsa({
|
|
50
|
+
toSign: ethers.utils.arrayify(hash),
|
|
51
|
+
publicKey: this.pkpPublicKey,
|
|
52
|
+
sigName: `alchemyTypedData`,
|
|
53
|
+
});
|
|
54
|
+
const parsedSig = JSON.parse(sig);
|
|
55
|
+
return ethers.utils.joinSignature({
|
|
56
|
+
r: '0x' + parsedSig.r.substring(2),
|
|
57
|
+
s: '0x' + parsedSig.s,
|
|
58
|
+
v: parsedSig.v,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// reference implementation is from Viem SmartAccountSigner
|
|
62
|
+
async signAuthorization(unsignedAuthorization) {
|
|
63
|
+
// console.log("signAuthorization called with params", unsignedAuthorization);
|
|
64
|
+
const { contractAddress, chainId, nonce } = unsignedAuthorization;
|
|
65
|
+
if (!contractAddress || !chainId) {
|
|
66
|
+
throw new Error('Invalid authorization: contractAddress and chainId are required');
|
|
67
|
+
}
|
|
68
|
+
const hash = ethers.utils.keccak256(ethers.utils.hexConcat([
|
|
69
|
+
'0x05',
|
|
70
|
+
ethers.utils.RLP.encode([
|
|
71
|
+
ethers.utils.hexlify(chainId),
|
|
72
|
+
contractAddress,
|
|
73
|
+
nonce ? ethers.utils.hexlify(nonce) : '0x',
|
|
74
|
+
]),
|
|
75
|
+
]));
|
|
76
|
+
const sig = await Lit.Actions.signAndCombineEcdsa({
|
|
77
|
+
toSign: ethers.utils.arrayify(hash),
|
|
78
|
+
publicKey: this.pkpPublicKey,
|
|
79
|
+
sigName: `alchemyAuth7702`,
|
|
80
|
+
});
|
|
81
|
+
const sigObj = JSON.parse(sig);
|
|
82
|
+
return {
|
|
83
|
+
address: (unsignedAuthorization.address || contractAddress),
|
|
84
|
+
chainId: chainId,
|
|
85
|
+
nonce: nonce,
|
|
86
|
+
r: ('0x' + sigObj.r.substring(2)),
|
|
87
|
+
s: ('0x' + sigObj.s),
|
|
88
|
+
v: BigInt(sigObj.v),
|
|
89
|
+
yParity: sigObj.v,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.LitActionsSmartSigner = LitActionsSmartSigner;
|
|
94
|
+
//# sourceMappingURL=lit-actions-smart-signer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-actions-smart-signer.js","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/lit-actions-smart-signer.ts"],"names":[],"mappings":";;;AAiGA,MAAa,qBAAqB;IACvB,UAAU,GAAG,aAAa,CAAC;IAC3B,KAAK,CAAM;IACZ,YAAY,CAAS;IACrB,aAAa,CAAS;IAE9B,YAAY,MAAmC;QAC7C,IAAI,MAAM,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACzC,MAAM,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC;QACD,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;QAC7E,IAAI,CAAC,KAAK,GAAG;YACX,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC,CAAC,yBAAyB;IAC9B,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO,IAAI,CAAC,aAAwB,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAwB;QACxC,IAAI,aAAkC,CAAC;QAEvC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,aAAa,GAAG,OAAO,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,aAAa;gBACX,OAAO,OAAO,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;QACvF,CAAC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,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAQ;YACxC,CAAC,EAAE,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAQ;YAC3B,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;YACnB,OAAO,EAAE,MAAM,CAAC,CAAC;SAClB,CAAC;IACJ,CAAC;CACF;AAhHD,sDAgHC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler function for making contract calls
|
|
3
|
+
* This function handles the preparation, signing, and sending of contract transactions
|
|
4
|
+
*
|
|
5
|
+
* @param pkpPublicKey - The PKP public key for transaction signing
|
|
6
|
+
* @param pkpEthAddress - The ethereum address derived from PKP
|
|
7
|
+
* @param abi - The ABI of the contract function
|
|
8
|
+
* @param contractAddress - The contract address
|
|
9
|
+
* @param functionName - The name of the function to call
|
|
10
|
+
* @param args - The arguments to pass to the function
|
|
11
|
+
* @param overrides - Optional transaction overrides (value)
|
|
12
|
+
* @param chainId - Optional chain ID (defaults to yellowstoneConfig.id)
|
|
13
|
+
* @param eip7702AlchemyApiKey - The Alchemy API key for gas sponsorship
|
|
14
|
+
* @param eip7702AlchemyPolicyId - The Alchemy policy ID for gas sponsorship
|
|
15
|
+
* @returns The UserOperation hash. You must use the alchemy smartAccountClient.waitForUserOperationTransaction() to convert the userOp into a txHash.
|
|
16
|
+
*/
|
|
17
|
+
export declare const sponsoredGasContractCall: ({ pkpPublicKey, abi, contractAddress, functionName, args, overrides, chainId, eip7702AlchemyApiKey, eip7702AlchemyPolicyId, }: {
|
|
18
|
+
pkpPublicKey: string;
|
|
19
|
+
abi: any[];
|
|
20
|
+
contractAddress: string;
|
|
21
|
+
functionName: string;
|
|
22
|
+
args: any[];
|
|
23
|
+
overrides?: {
|
|
24
|
+
value?: string | number | bigint;
|
|
25
|
+
};
|
|
26
|
+
chainId?: number;
|
|
27
|
+
eip7702AlchemyApiKey?: string;
|
|
28
|
+
eip7702AlchemyPolicyId?: string;
|
|
29
|
+
}) => Promise<string>;
|
|
30
|
+
//# sourceMappingURL=sponsored-gas-contract-call.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sponsored-gas-contract-call.d.ts","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/sponsored-gas-contract-call.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,wBAAwB,GAAU,+HAU5C;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,GAAG,EAAE,CAAC;IACX,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;KAClC,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC,oBA6BA,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sponsoredGasContractCall = void 0;
|
|
4
|
+
const sponsored_gas_raw_transaction_1 = require("./sponsored-gas-raw-transaction");
|
|
5
|
+
/**
|
|
6
|
+
* Handler function for making contract calls
|
|
7
|
+
* This function handles the preparation, signing, and sending of contract transactions
|
|
8
|
+
*
|
|
9
|
+
* @param pkpPublicKey - The PKP public key for transaction signing
|
|
10
|
+
* @param pkpEthAddress - The ethereum address derived from PKP
|
|
11
|
+
* @param abi - The ABI of the contract function
|
|
12
|
+
* @param contractAddress - The contract address
|
|
13
|
+
* @param functionName - The name of the function to call
|
|
14
|
+
* @param args - The arguments to pass to the function
|
|
15
|
+
* @param overrides - Optional transaction overrides (value)
|
|
16
|
+
* @param chainId - Optional chain ID (defaults to yellowstoneConfig.id)
|
|
17
|
+
* @param eip7702AlchemyApiKey - The Alchemy API key for gas sponsorship
|
|
18
|
+
* @param eip7702AlchemyPolicyId - The Alchemy policy ID for gas sponsorship
|
|
19
|
+
* @returns The UserOperation hash. You must use the alchemy smartAccountClient.waitForUserOperationTransaction() to convert the userOp into a txHash.
|
|
20
|
+
*/
|
|
21
|
+
const sponsoredGasContractCall = async ({ pkpPublicKey, abi, contractAddress, functionName, args, overrides = {}, chainId, eip7702AlchemyApiKey, eip7702AlchemyPolicyId, }) => {
|
|
22
|
+
// Step 1: Encode function data using ethers Interface
|
|
23
|
+
const iface = new ethers.utils.Interface(abi);
|
|
24
|
+
const encodedData = iface.encodeFunctionData(functionName, args);
|
|
25
|
+
console.log('Encoded data:', encodedData);
|
|
26
|
+
if (!eip7702AlchemyApiKey || !eip7702AlchemyPolicyId) {
|
|
27
|
+
throw new Error('EIP7702 Alchemy API key and policy ID are required when using Alchemy for gas sponsorship');
|
|
28
|
+
}
|
|
29
|
+
if (!chainId) {
|
|
30
|
+
throw new Error('Chain ID is required when using Alchemy for gas sponsorship');
|
|
31
|
+
}
|
|
32
|
+
// Convert value override if exists to BigNumber
|
|
33
|
+
const txValue = overrides.value ? BigInt(overrides.value.toString()) : 0n;
|
|
34
|
+
return (0, sponsored_gas_raw_transaction_1.sponsoredGasRawTransaction)({
|
|
35
|
+
pkpPublicKey,
|
|
36
|
+
to: contractAddress,
|
|
37
|
+
value: txValue.toString(),
|
|
38
|
+
data: encodedData,
|
|
39
|
+
chainId,
|
|
40
|
+
eip7702AlchemyApiKey,
|
|
41
|
+
eip7702AlchemyPolicyId,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
exports.sponsoredGasContractCall = sponsoredGasContractCall;
|
|
45
|
+
//# sourceMappingURL=sponsored-gas-contract-call.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sponsored-gas-contract-call.js","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/sponsored-gas-contract-call.ts"],"names":[],"mappings":";;;AAAA,mFAA6E;AAQ7E;;;;;;;;;;;;;;;GAeG;AACI,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAC7C,YAAY,EACZ,GAAG,EACH,eAAe,EACf,YAAY,EACZ,IAAI,EACJ,SAAS,GAAG,EAAE,EACd,OAAO,EACP,oBAAoB,EACpB,sBAAsB,GAavB,EAAE,EAAE;IACH,sDAAsD;IACtD,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,KAAK,CAAC,kBAAkB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAEjE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAE1C,IAAI,CAAC,oBAAoB,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IAED,gDAAgD;IAChD,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1E,OAAO,IAAA,0DAA0B,EAAC;QAChC,YAAY;QACZ,EAAE,EAAE,eAAe;QACnB,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE;QACzB,IAAI,EAAE,WAAW;QACjB,OAAO;QACP,oBAAoB;QACpB,sBAAsB;KACvB,CAAC,CAAC;AACL,CAAC,CAAC;AAnDW,QAAA,wBAAwB,4BAmDnC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handler function for making raw transaction calls with gas sponsorship
|
|
3
|
+
* This function handles the preparation, signing, and sending of raw transactions
|
|
4
|
+
*
|
|
5
|
+
* @param pkpPublicKey - The PKP public key for transaction signing
|
|
6
|
+
* @param to - The recipient address
|
|
7
|
+
* @param value - The value to send with the transaction
|
|
8
|
+
* @param data - The calldata for the transaction
|
|
9
|
+
* @param chainId - The chain ID
|
|
10
|
+
* @param eip7702AlchemyApiKey - The Alchemy API key for gas sponsorship
|
|
11
|
+
* @param eip7702AlchemyPolicyId - The Alchemy policy ID for gas sponsorship
|
|
12
|
+
* @returns The UserOperation hash. You must use the alchemy smartAccountClient.waitForUserOperationTransaction() to convert the userOp into a txHash.
|
|
13
|
+
*/
|
|
14
|
+
export declare const sponsoredGasRawTransaction: ({ pkpPublicKey, to, value, data, chainId, eip7702AlchemyApiKey, eip7702AlchemyPolicyId, }: {
|
|
15
|
+
pkpPublicKey: string;
|
|
16
|
+
to: string;
|
|
17
|
+
value: string;
|
|
18
|
+
data: string;
|
|
19
|
+
chainId: number;
|
|
20
|
+
eip7702AlchemyApiKey: string;
|
|
21
|
+
eip7702AlchemyPolicyId: string;
|
|
22
|
+
}) => Promise<string>;
|
|
23
|
+
//# sourceMappingURL=sponsored-gas-raw-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sponsored-gas-raw-transaction.d.ts","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/sponsored-gas-raw-transaction.ts"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,GAAU,2FAQ9C;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,sBAAsB,EAAE,MAAM,CAAC;CAChC,KAAG,OAAO,CAAC,MAAM,CAkIjB,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sponsoredGasRawTransaction = void 0;
|
|
4
|
+
const infra_1 = require("@account-kit/infra");
|
|
5
|
+
const smart_contracts_1 = require("@account-kit/smart-contracts");
|
|
6
|
+
const get_alchemy_chain_config_1 = require("./get-alchemy-chain-config");
|
|
7
|
+
const lit_actions_smart_signer_1 = require("./lit-actions-smart-signer");
|
|
8
|
+
/**
|
|
9
|
+
* Handler function for making raw transaction calls with gas sponsorship
|
|
10
|
+
* This function handles the preparation, signing, and sending of raw transactions
|
|
11
|
+
*
|
|
12
|
+
* @param pkpPublicKey - The PKP public key for transaction signing
|
|
13
|
+
* @param to - The recipient address
|
|
14
|
+
* @param value - The value to send with the transaction
|
|
15
|
+
* @param data - The calldata for the transaction
|
|
16
|
+
* @param chainId - The chain ID
|
|
17
|
+
* @param eip7702AlchemyApiKey - The Alchemy API key for gas sponsorship
|
|
18
|
+
* @param eip7702AlchemyPolicyId - The Alchemy policy ID for gas sponsorship
|
|
19
|
+
* @returns The UserOperation hash. You must use the alchemy smartAccountClient.waitForUserOperationTransaction() to convert the userOp into a txHash.
|
|
20
|
+
*/
|
|
21
|
+
const sponsoredGasRawTransaction = async ({ pkpPublicKey, to, value, data, chainId, eip7702AlchemyApiKey, eip7702AlchemyPolicyId, }) => {
|
|
22
|
+
if (!eip7702AlchemyApiKey || !eip7702AlchemyPolicyId) {
|
|
23
|
+
throw new Error('EIP7702 Alchemy API key and policy ID are required when using Alchemy for gas sponsorship');
|
|
24
|
+
}
|
|
25
|
+
if (!chainId) {
|
|
26
|
+
throw new Error('Chain ID is required when using Alchemy for gas sponsorship');
|
|
27
|
+
}
|
|
28
|
+
console.log('[sponsoredGasRawTransaction] Encoded data:', data);
|
|
29
|
+
// Convert value to BigInt
|
|
30
|
+
const txValue = value ? BigInt(value.toString()) : 0n;
|
|
31
|
+
// Create LitActionsSmartSigner for EIP-7702
|
|
32
|
+
const litSigner = new lit_actions_smart_signer_1.LitActionsSmartSigner({
|
|
33
|
+
pkpPublicKey,
|
|
34
|
+
chainId,
|
|
35
|
+
});
|
|
36
|
+
// Get the Alchemy chain configuration
|
|
37
|
+
const alchemyChain = (0, get_alchemy_chain_config_1.getAlchemyChainConfig)(chainId);
|
|
38
|
+
// Create the Smart Account Client with EIP-7702 mode
|
|
39
|
+
const smartAccountClient = await (0, smart_contracts_1.createModularAccountV2Client)({
|
|
40
|
+
mode: '7702',
|
|
41
|
+
transport: (0, infra_1.alchemy)({ apiKey: eip7702AlchemyApiKey }),
|
|
42
|
+
chain: alchemyChain,
|
|
43
|
+
signer: litSigner,
|
|
44
|
+
policyId: eip7702AlchemyPolicyId,
|
|
45
|
+
});
|
|
46
|
+
console.log('[sponsoredGasRawTransaction] Smart account client created');
|
|
47
|
+
// Prepare the user operation
|
|
48
|
+
const userOperation = {
|
|
49
|
+
target: to,
|
|
50
|
+
value: txValue,
|
|
51
|
+
data: data,
|
|
52
|
+
};
|
|
53
|
+
console.log('[sponsoredGasRawTransaction] User operation prepared', userOperation);
|
|
54
|
+
// Build the user operation
|
|
55
|
+
const uoStructResponse = await Lit.Actions.runOnce({
|
|
56
|
+
waitForResponse: true,
|
|
57
|
+
name: 'buildUserOperation',
|
|
58
|
+
}, async () => {
|
|
59
|
+
try {
|
|
60
|
+
const uoStruct = await smartAccountClient.buildUserOperation({
|
|
61
|
+
uo: userOperation,
|
|
62
|
+
account: smartAccountClient.account,
|
|
63
|
+
});
|
|
64
|
+
// Properly serialize BigInt with a "type" tag
|
|
65
|
+
return JSON.stringify(uoStruct, (_, v) => typeof v === 'bigint' ? { type: 'BigInt', value: v.toString() } : v);
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
console.log('[sponsoredGasRawTransaction] Failed to build user operation, error below');
|
|
69
|
+
console.log(e);
|
|
70
|
+
console.log(e.stack);
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (uoStructResponse === '') {
|
|
75
|
+
throw new Error('[sponsoredGasRawTransaction] Failed to build user operation');
|
|
76
|
+
}
|
|
77
|
+
// Custom reviver to convert {type: "BigInt", value: "..."} back to BigInt
|
|
78
|
+
const uoStruct = JSON.parse(uoStructResponse, (_, v) => {
|
|
79
|
+
if (v && typeof v === 'object' && v.type === 'BigInt' && typeof v.value === 'string') {
|
|
80
|
+
return BigInt(v.value);
|
|
81
|
+
}
|
|
82
|
+
return v;
|
|
83
|
+
});
|
|
84
|
+
console.log('[sponsoredGasRawTransaction] User operation built, starting signing...', uoStruct);
|
|
85
|
+
// sign the actual user operation with the PKP.
|
|
86
|
+
// this must be done outside a runOnce call, because all the nodes must initiate a signature for it to be valid
|
|
87
|
+
const signedUserOperation = await smartAccountClient.signUserOperation({
|
|
88
|
+
account: smartAccountClient.account,
|
|
89
|
+
uoStruct,
|
|
90
|
+
});
|
|
91
|
+
console.log('[sponsoredGasRawTransaction] User operation signed', signedUserOperation);
|
|
92
|
+
// getting the entry point from the smart account client so we can send the user operation
|
|
93
|
+
const entryPoint = smartAccountClient.account.getEntryPoint();
|
|
94
|
+
// send the user operation with EIP-7702 delegation in a runOnce
|
|
95
|
+
// so that we don't submit it more than once
|
|
96
|
+
const uoHash = await Lit.Actions.runOnce({
|
|
97
|
+
waitForResponse: true,
|
|
98
|
+
name: 'sendWithAlchemy',
|
|
99
|
+
}, async () => {
|
|
100
|
+
try {
|
|
101
|
+
// Send the user operation with EIP-7702 delegation
|
|
102
|
+
const userOpResult = await smartAccountClient.sendRawUserOperation(signedUserOperation, entryPoint.address);
|
|
103
|
+
console.log(`[sponsoredGasRawTransaction] User operation sent`, {
|
|
104
|
+
userOpHash: userOpResult,
|
|
105
|
+
});
|
|
106
|
+
return userOpResult;
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
console.log('[sponsoredGasRawTransaction] Failed to send user operation, error below');
|
|
110
|
+
console.log(e);
|
|
111
|
+
console.log(e.stack);
|
|
112
|
+
return '';
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
if (uoHash === '') {
|
|
116
|
+
throw new Error('[sponsoredGasRawTransaction] Failed to send user operation');
|
|
117
|
+
}
|
|
118
|
+
return uoHash;
|
|
119
|
+
};
|
|
120
|
+
exports.sponsoredGasRawTransaction = sponsoredGasRawTransaction;
|
|
121
|
+
//# sourceMappingURL=sponsored-gas-raw-transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sponsored-gas-raw-transaction.js","sourceRoot":"","sources":["../../../../../src/lib/abilityHelpers/gasSponsorship/sponsored-gas-raw-transaction.ts"],"names":[],"mappings":";;;AAAA,8CAA6C;AAC7C,kEAA4E;AAE5E,yEAAmE;AACnE,yEAAmE;AAcnE;;;;;;;;;;;;GAYG;AACI,MAAM,0BAA0B,GAAG,KAAK,EAAE,EAC/C,YAAY,EACZ,EAAE,EACF,KAAK,EACL,IAAI,EACJ,OAAO,EACP,oBAAoB,EACpB,sBAAsB,GASvB,EAAmB,EAAE;IACpB,IAAI,CAAC,oBAAoB,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CACb,2FAA2F,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACjF,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,4CAA4C,EAAE,IAAI,CAAC,CAAC;IAEhE,0BAA0B;IAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtD,4CAA4C;IAC5C,MAAM,SAAS,GAAG,IAAI,gDAAqB,CAAC;QAC1C,YAAY;QACZ,OAAO;KACR,CAAC,CAAC;IAEH,sCAAsC;IACtC,M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D,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAAC,oBAAoB,CAChE,mBAAmB,EACnB,UAAU,CAAC,OAAO,CACnB,CAAC;YAEF,OAAO,CAAC,GAAG,CAAC,kDAAkD,EAAE;gBAC9D,UAAU,EAAE,YAAY;aACzB,CAAC,CAAC;YAEH,OAAO,YAAY,CAAC;QACtB,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;YACvF,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CACF,CAAC;IAEF,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAlJW,QAAA,0BAA0B,8BAkJrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/abilityHelpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/abilityHelpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.populateTransaction = void 0;
|
|
3
|
+
exports.sponsoredGasContractCall = exports.sponsoredGasRawTransaction = exports.populateTransaction = void 0;
|
|
4
4
|
var populateTransaction_1 = require("./populateTransaction");
|
|
5
5
|
Object.defineProperty(exports, "populateTransaction", { enumerable: true, get: function () { return populateTransaction_1.populateTransaction; } });
|
|
6
|
+
var gasSponsorship_1 = require("./gasSponsorship");
|
|
7
|
+
Object.defineProperty(exports, "sponsoredGasRawTransaction", { enumerable: true, get: function () { return gasSponsorship_1.sponsoredGasRawTransaction; } });
|
|
8
|
+
Object.defineProperty(exports, "sponsoredGasContractCall", { enumerable: true, get: function () { return gasSponsorship_1.sponsoredGasContractCall; } });
|
|
6
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/abilityHelpers/index.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/abilityHelpers/index.ts"],"names":[],"mappings":";;;AAAA,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,mDAAwF;AAA/E,4HAAA,0BAA0B,OAAA;AAAE,0HAAA,wBAAwB,OAAA"}
|
|
@@ -169,11 +169,11 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
169
169
|
confirmed: z.ZodBoolean;
|
|
170
170
|
timestamp: z.ZodNumber;
|
|
171
171
|
}, "strip", z.ZodTypeAny, {
|
|
172
|
-
confirmed: boolean;
|
|
173
172
|
timestamp: number;
|
|
174
|
-
}, {
|
|
175
173
|
confirmed: boolean;
|
|
174
|
+
}, {
|
|
176
175
|
timestamp: number;
|
|
176
|
+
confirmed: boolean;
|
|
177
177
|
}>, z.ZodUndefined, import("../lib/types").PolicyLifecycleFunction<z.ZodObject<{
|
|
178
178
|
operation: z.ZodString;
|
|
179
179
|
resource: z.ZodString;
|
|
@@ -220,11 +220,11 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
220
220
|
confirmed: z.ZodBoolean;
|
|
221
221
|
timestamp: z.ZodNumber;
|
|
222
222
|
}, "strip", z.ZodTypeAny, {
|
|
223
|
-
confirmed: boolean;
|
|
224
223
|
timestamp: number;
|
|
225
|
-
}, {
|
|
226
224
|
confirmed: boolean;
|
|
225
|
+
}, {
|
|
227
226
|
timestamp: number;
|
|
227
|
+
confirmed: boolean;
|
|
228
228
|
}>, z.ZodUndefined>>;
|
|
229
229
|
ipfsCid: "ajialkjads";
|
|
230
230
|
abilityParameterMappings: Partial<{
|
|
@@ -275,11 +275,11 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
275
275
|
confirmed: z.ZodBoolean;
|
|
276
276
|
timestamp: z.ZodNumber;
|
|
277
277
|
}, "strip", z.ZodTypeAny, {
|
|
278
|
-
confirmed: boolean;
|
|
279
278
|
timestamp: number;
|
|
280
|
-
}, {
|
|
281
279
|
confirmed: boolean;
|
|
280
|
+
}, {
|
|
282
281
|
timestamp: number;
|
|
282
|
+
confirmed: boolean;
|
|
283
283
|
}>;
|
|
284
284
|
commitDenyResultSchema: z.ZodUndefined;
|
|
285
285
|
evaluate: import("../lib/types").PolicyLifecycleFunction<z.ZodObject<{
|
|
@@ -330,11 +330,11 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
330
330
|
confirmed: z.ZodBoolean;
|
|
331
331
|
timestamp: z.ZodNumber;
|
|
332
332
|
}, "strip", z.ZodTypeAny, {
|
|
333
|
-
confirmed: boolean;
|
|
334
333
|
timestamp: number;
|
|
335
|
-
}, {
|
|
336
334
|
confirmed: boolean;
|
|
335
|
+
}, {
|
|
337
336
|
timestamp: number;
|
|
337
|
+
confirmed: boolean;
|
|
338
338
|
}>, z.ZodUndefined> | undefined;
|
|
339
339
|
};
|
|
340
340
|
}], "@lit-protocol/simple-policy@1.0.0" | "@lit-protocol/commit-policy@1.0.0">, {
|
|
@@ -487,11 +487,11 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
487
487
|
confirmed: z.ZodBoolean;
|
|
488
488
|
timestamp: z.ZodNumber;
|
|
489
489
|
}, "strip", z.ZodTypeAny, {
|
|
490
|
-
confirmed: boolean;
|
|
491
490
|
timestamp: number;
|
|
492
|
-
}, {
|
|
493
491
|
confirmed: boolean;
|
|
492
|
+
}, {
|
|
494
493
|
timestamp: number;
|
|
494
|
+
confirmed: boolean;
|
|
495
495
|
}>, z.ZodUndefined, import("../lib/types").PolicyLifecycleFunction<z.ZodObject<{
|
|
496
496
|
operation: z.ZodString;
|
|
497
497
|
resource: z.ZodString;
|
|
@@ -538,11 +538,11 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
538
538
|
confirmed: z.ZodBoolean;
|
|
539
539
|
timestamp: z.ZodNumber;
|
|
540
540
|
}, "strip", z.ZodTypeAny, {
|
|
541
|
-
confirmed: boolean;
|
|
542
541
|
timestamp: number;
|
|
543
|
-
}, {
|
|
544
542
|
confirmed: boolean;
|
|
543
|
+
}, {
|
|
545
544
|
timestamp: number;
|
|
545
|
+
confirmed: boolean;
|
|
546
546
|
}>, z.ZodUndefined>>;
|
|
547
547
|
ipfsCid: "ajialkjads";
|
|
548
548
|
abilityParameterMappings: Partial<{
|
|
@@ -593,11 +593,11 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
593
593
|
confirmed: z.ZodBoolean;
|
|
594
594
|
timestamp: z.ZodNumber;
|
|
595
595
|
}, "strip", z.ZodTypeAny, {
|
|
596
|
-
confirmed: boolean;
|
|
597
596
|
timestamp: number;
|
|
598
|
-
}, {
|
|
599
597
|
confirmed: boolean;
|
|
598
|
+
}, {
|
|
600
599
|
timestamp: number;
|
|
600
|
+
confirmed: boolean;
|
|
601
601
|
}>;
|
|
602
602
|
commitDenyResultSchema: z.ZodUndefined;
|
|
603
603
|
evaluate: import("../lib/types").PolicyLifecycleFunction<z.ZodObject<{
|
|
@@ -648,11 +648,11 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
648
648
|
confirmed: z.ZodBoolean;
|
|
649
649
|
timestamp: z.ZodNumber;
|
|
650
650
|
}, "strip", z.ZodTypeAny, {
|
|
651
|
-
confirmed: boolean;
|
|
652
651
|
timestamp: number;
|
|
653
|
-
}, {
|
|
654
652
|
confirmed: boolean;
|
|
653
|
+
}, {
|
|
655
654
|
timestamp: number;
|
|
655
|
+
confirmed: boolean;
|
|
656
656
|
}>, z.ZodUndefined> | undefined;
|
|
657
657
|
};
|
|
658
658
|
};
|
|
@@ -664,13 +664,13 @@ export declare function testPolicyEvaluationResults(): import("..").VincentAbili
|
|
|
664
664
|
}, "strip", z.ZodTypeAny, {
|
|
665
665
|
message: string;
|
|
666
666
|
success: boolean;
|
|
667
|
-
confirmed?: boolean | undefined;
|
|
668
667
|
timestamp?: number | undefined;
|
|
668
|
+
confirmed?: boolean | undefined;
|
|
669
669
|
}, {
|
|
670
670
|
message: string;
|
|
671
671
|
success: boolean;
|
|
672
|
-
confirmed?: boolean | undefined;
|
|
673
672
|
timestamp?: number | undefined;
|
|
673
|
+
confirmed?: boolean | undefined;
|
|
674
674
|
}>, z.ZodObject<{
|
|
675
675
|
errorCode: z.ZodNumber;
|
|
676
676
|
errorMessage: z.ZodString;
|
|
@@ -285,11 +285,11 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
285
285
|
transaction: z.ZodString;
|
|
286
286
|
timestamp: z.ZodNumber;
|
|
287
287
|
}, "strip", z.ZodTypeAny, {
|
|
288
|
-
timestamp: number;
|
|
289
288
|
transaction: string;
|
|
290
|
-
}, {
|
|
291
289
|
timestamp: number;
|
|
290
|
+
}, {
|
|
292
291
|
transaction: string;
|
|
292
|
+
timestamp: number;
|
|
293
293
|
}>, z.ZodObject<{
|
|
294
294
|
failureReason: z.ZodString;
|
|
295
295
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -363,11 +363,11 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
363
363
|
transaction: z.ZodString;
|
|
364
364
|
timestamp: z.ZodNumber;
|
|
365
365
|
}, "strip", z.ZodTypeAny, {
|
|
366
|
-
timestamp: number;
|
|
367
366
|
transaction: string;
|
|
368
|
-
}, {
|
|
369
367
|
timestamp: number;
|
|
368
|
+
}, {
|
|
370
369
|
transaction: string;
|
|
370
|
+
timestamp: number;
|
|
371
371
|
}>, z.ZodObject<{
|
|
372
372
|
failureReason: z.ZodString;
|
|
373
373
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -442,11 +442,11 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
442
442
|
transaction: z.ZodString;
|
|
443
443
|
timestamp: z.ZodNumber;
|
|
444
444
|
}, "strip", z.ZodTypeAny, {
|
|
445
|
-
timestamp: number;
|
|
446
445
|
transaction: string;
|
|
447
|
-
}, {
|
|
448
446
|
timestamp: number;
|
|
447
|
+
}, {
|
|
449
448
|
transaction: string;
|
|
449
|
+
timestamp: number;
|
|
450
450
|
}>;
|
|
451
451
|
commitDenyResultSchema: z.ZodObject<{
|
|
452
452
|
failureReason: z.ZodString;
|
|
@@ -524,11 +524,11 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
524
524
|
transaction: z.ZodString;
|
|
525
525
|
timestamp: z.ZodNumber;
|
|
526
526
|
}, "strip", z.ZodTypeAny, {
|
|
527
|
-
timestamp: number;
|
|
528
527
|
transaction: string;
|
|
529
|
-
}, {
|
|
530
528
|
timestamp: number;
|
|
529
|
+
}, {
|
|
531
530
|
transaction: string;
|
|
531
|
+
timestamp: number;
|
|
532
532
|
}>, z.ZodObject<{
|
|
533
533
|
failureReason: z.ZodString;
|
|
534
534
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1028,11 +1028,11 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
1028
1028
|
transaction: z.ZodString;
|
|
1029
1029
|
timestamp: z.ZodNumber;
|
|
1030
1030
|
}, "strip", z.ZodTypeAny, {
|
|
1031
|
-
timestamp: number;
|
|
1032
1031
|
transaction: string;
|
|
1033
|
-
}, {
|
|
1034
1032
|
timestamp: number;
|
|
1033
|
+
}, {
|
|
1035
1034
|
transaction: string;
|
|
1035
|
+
timestamp: number;
|
|
1036
1036
|
}>, z.ZodObject<{
|
|
1037
1037
|
failureReason: z.ZodString;
|
|
1038
1038
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1106,11 +1106,11 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
1106
1106
|
transaction: z.ZodString;
|
|
1107
1107
|
timestamp: z.ZodNumber;
|
|
1108
1108
|
}, "strip", z.ZodTypeAny, {
|
|
1109
|
-
timestamp: number;
|
|
1110
1109
|
transaction: string;
|
|
1111
|
-
}, {
|
|
1112
1110
|
timestamp: number;
|
|
1111
|
+
}, {
|
|
1113
1112
|
transaction: string;
|
|
1113
|
+
timestamp: number;
|
|
1114
1114
|
}>, z.ZodObject<{
|
|
1115
1115
|
failureReason: z.ZodString;
|
|
1116
1116
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1185,11 +1185,11 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
1185
1185
|
transaction: z.ZodString;
|
|
1186
1186
|
timestamp: z.ZodNumber;
|
|
1187
1187
|
}, "strip", z.ZodTypeAny, {
|
|
1188
|
-
timestamp: number;
|
|
1189
1188
|
transaction: string;
|
|
1190
|
-
}, {
|
|
1191
1189
|
timestamp: number;
|
|
1190
|
+
}, {
|
|
1192
1191
|
transaction: string;
|
|
1192
|
+
timestamp: number;
|
|
1193
1193
|
}>;
|
|
1194
1194
|
commitDenyResultSchema: z.ZodObject<{
|
|
1195
1195
|
failureReason: z.ZodString;
|
|
@@ -1267,11 +1267,11 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
1267
1267
|
transaction: z.ZodString;
|
|
1268
1268
|
timestamp: z.ZodNumber;
|
|
1269
1269
|
}, "strip", z.ZodTypeAny, {
|
|
1270
|
-
timestamp: number;
|
|
1271
1270
|
transaction: string;
|
|
1272
|
-
}, {
|
|
1273
1271
|
timestamp: number;
|
|
1272
|
+
}, {
|
|
1274
1273
|
transaction: string;
|
|
1274
|
+
timestamp: number;
|
|
1275
1275
|
}>, z.ZodObject<{
|
|
1276
1276
|
failureReason: z.ZodString;
|
|
1277
1277
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1547,8 +1547,8 @@ export declare const myAbility: import("..").VincentAbility<z.ZodObject<{
|
|
|
1547
1547
|
invalidField: string;
|
|
1548
1548
|
}>>;
|
|
1549
1549
|
export declare const gogoPolicy: () => Promise<true | import("../lib/types").PolicyResponseAllow<{
|
|
1550
|
-
timestamp: number;
|
|
1551
1550
|
transaction: string;
|
|
1551
|
+
timestamp: number;
|
|
1552
1552
|
}> | import("../lib/types").PolicyResponseDeny<{
|
|
1553
1553
|
failureReason: string;
|
|
1554
1554
|
}>>;
|
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lit-protocol/vincent-ability-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
+
"@account-kit/infra": "^4.53.1",
|
|
9
|
+
"@account-kit/smart-contracts": "^4.53.1",
|
|
8
10
|
"ethers": "5.8.0",
|
|
9
11
|
"ethers-v6": "npm:ethers@^6",
|
|
10
12
|
"semver": "^7.7.2",
|
|
11
13
|
"tslib": "^2.8.1",
|
|
12
14
|
"zod": "^3.25.64",
|
|
13
|
-
"@lit-protocol/vincent-contracts-sdk": "
|
|
15
|
+
"@lit-protocol/vincent-contracts-sdk": "2.0.0"
|
|
14
16
|
},
|
|
15
17
|
"main": "./dist/src/index.js",
|
|
16
18
|
"types": "./dist/src/index.d.ts",
|