@0xkey-io/gas-station 0.1.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/LICENSE +201 -0
- package/README.md +655 -0
- package/dist/abi/gas-station.d.ts +500 -0
- package/dist/abi/gas-station.d.ts.map +1 -0
- package/dist/abi/gas-station.js +252 -0
- package/dist/abi/gas-station.js.map +1 -0
- package/dist/abi/gas-station.mjs +250 -0
- package/dist/abi/gas-station.mjs.map +1 -0
- package/dist/abi/reimbursable-gas-station.d.ts +756 -0
- package/dist/abi/reimbursable-gas-station.d.ts.map +1 -0
- package/dist/abi/reimbursable-gas-station.js +625 -0
- package/dist/abi/reimbursable-gas-station.js.map +1 -0
- package/dist/abi/reimbursable-gas-station.mjs +623 -0
- package/dist/abi/reimbursable-gas-station.mjs.map +1 -0
- package/dist/config.d.ts +57 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +59 -0
- package/dist/config.js.map +1 -0
- package/dist/config.mjs +52 -0
- package/dist/config.mjs.map +1 -0
- package/dist/gasStationClient.d.ts +110 -0
- package/dist/gasStationClient.d.ts.map +1 -0
- package/dist/gasStationClient.js +415 -0
- package/dist/gasStationClient.js.map +1 -0
- package/dist/gasStationClient.mjs +413 -0
- package/dist/gasStationClient.mjs.map +1 -0
- package/dist/gasStationUtils.d.ts +7250 -0
- package/dist/gasStationUtils.d.ts.map +1 -0
- package/dist/gasStationUtils.js +147 -0
- package/dist/gasStationUtils.js.map +1 -0
- package/dist/gasStationUtils.mjs +137 -0
- package/dist/gasStationUtils.mjs.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -0
- package/dist/intentBuilder.d.ts +75 -0
- package/dist/intentBuilder.d.ts.map +1 -0
- package/dist/intentBuilder.js +259 -0
- package/dist/intentBuilder.js.map +1 -0
- package/dist/intentBuilder.mjs +257 -0
- package/dist/intentBuilder.mjs.map +1 -0
- package/dist/policyUtils.d.ts +271 -0
- package/dist/policyUtils.d.ts.map +1 -0
- package/dist/policyUtils.js +386 -0
- package/dist/policyUtils.js.map +1 -0
- package/dist/policyUtils.mjs +380 -0
- package/dist/policyUtils.mjs.map +1 -0
- package/package.json +61 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Chain, WalletClient, Account, Transport, Hex } from "viem";
|
|
2
|
+
export declare const DEFAULT_DELEGATE_CONTRACT: Hex;
|
|
3
|
+
export declare const DEFAULT_EXECUTION_CONTRACT: Hex;
|
|
4
|
+
export declare const DEFAULT_REIMBURSABLE_USDC_CONTRACT: Hex;
|
|
5
|
+
export interface GasStationConfig {
|
|
6
|
+
walletClient: WalletClient<Transport, Chain, Account>;
|
|
7
|
+
delegateContract?: Hex;
|
|
8
|
+
executionContract?: Hex;
|
|
9
|
+
reimbursableContract?: Hex;
|
|
10
|
+
defaultGasLimit?: bigint;
|
|
11
|
+
}
|
|
12
|
+
export interface ChainPreset {
|
|
13
|
+
chain: Chain;
|
|
14
|
+
rpcUrl: string;
|
|
15
|
+
delegateContract?: Hex;
|
|
16
|
+
executionContract?: Hex;
|
|
17
|
+
tokens?: {
|
|
18
|
+
USDC?: Hex;
|
|
19
|
+
[key: string]: Hex | undefined;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface ContractCallParams {
|
|
23
|
+
contract: Hex;
|
|
24
|
+
abi: readonly any[] | any[];
|
|
25
|
+
functionName: string;
|
|
26
|
+
args: any[];
|
|
27
|
+
value?: bigint;
|
|
28
|
+
}
|
|
29
|
+
export interface ExecutionIntent {
|
|
30
|
+
nonce: bigint;
|
|
31
|
+
deadline: number;
|
|
32
|
+
outputContract: Hex;
|
|
33
|
+
ethAmount: bigint;
|
|
34
|
+
callData: Hex;
|
|
35
|
+
signature: Hex;
|
|
36
|
+
eoaAddress: Hex;
|
|
37
|
+
}
|
|
38
|
+
export interface ApprovalExecutionIntent extends ExecutionIntent {
|
|
39
|
+
erc20Address: Hex;
|
|
40
|
+
spender: Hex;
|
|
41
|
+
approveAmount: bigint;
|
|
42
|
+
}
|
|
43
|
+
export interface ReimbursableExecutionIntent extends ExecutionIntent {
|
|
44
|
+
initialDepositUSDC: bigint;
|
|
45
|
+
transactionGasLimitWei: bigint;
|
|
46
|
+
sessionSignature: Hex;
|
|
47
|
+
}
|
|
48
|
+
export declare const CHAIN_PRESETS: Record<string, ChainPreset>;
|
|
49
|
+
/**
|
|
50
|
+
* Create a custom preset with validation
|
|
51
|
+
*/
|
|
52
|
+
export declare function createCustomPreset(config: ChainPreset): ChainPreset;
|
|
53
|
+
/**
|
|
54
|
+
* Get a preset with optional environment variable overrides
|
|
55
|
+
*/
|
|
56
|
+
export declare function getPreset(presetName: keyof typeof CHAIN_PRESETS, overrides?: Partial<ChainPreset>): ChainPreset;
|
|
57
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAKzE,eAAO,MAAM,yBAAyB,EAAE,GACM,CAAC;AAC/C,eAAO,MAAM,0BAA0B,EAAE,GACK,CAAC;AAC/C,eAAO,MAAM,kCAAkC,EAAE,GACH,CAAC;AAG/C,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACtD,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,iBAAiB,CAAC,EAAE,GAAG,CAAC;IACxB,oBAAoB,CAAC,EAAE,GAAG,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,WAAW;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a,EACtC,SAAS,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAC/B,WAAW,CAQb"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chains = require('viem/chains');
|
|
4
|
+
|
|
5
|
+
// Default contract addresses (deterministically deployed across all chains)
|
|
6
|
+
const DEFAULT_DELEGATE_CONTRACT = "0x000066a00056CD44008768E2aF00696e19A30084";
|
|
7
|
+
const DEFAULT_EXECUTION_CONTRACT = "0x00000000008c57a1CE37836a5e9d36759D070d8c";
|
|
8
|
+
const DEFAULT_REIMBURSABLE_USDC_CONTRACT = "0x4c0a2998B4Dc7BAF418109b80E5dde7395703dcb";
|
|
9
|
+
// Chain preset configurations
|
|
10
|
+
const CHAIN_PRESETS = {
|
|
11
|
+
BASE_MAINNET: {
|
|
12
|
+
chain: chains.base,
|
|
13
|
+
rpcUrl: process.env.BASE_RPC_URL || "",
|
|
14
|
+
tokens: {
|
|
15
|
+
USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
ETHEREUM_MAINNET: {
|
|
19
|
+
chain: chains.mainnet,
|
|
20
|
+
rpcUrl: process.env.ETH_RPC_URL || "",
|
|
21
|
+
tokens: {
|
|
22
|
+
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
SEPOLIA: {
|
|
26
|
+
chain: chains.sepolia,
|
|
27
|
+
rpcUrl: process.env.SEPOLIA_RPC_URL || "",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Create a custom preset with validation
|
|
32
|
+
*/
|
|
33
|
+
function createCustomPreset(config) {
|
|
34
|
+
if (!config.chain) {
|
|
35
|
+
throw new Error("Chain configuration is required");
|
|
36
|
+
}
|
|
37
|
+
if (!config.rpcUrl) {
|
|
38
|
+
throw new Error("RPC URL is required");
|
|
39
|
+
}
|
|
40
|
+
return config;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get a preset with optional environment variable overrides
|
|
44
|
+
*/
|
|
45
|
+
function getPreset(presetName, overrides) {
|
|
46
|
+
const preset = CHAIN_PRESETS[presetName];
|
|
47
|
+
if (!preset) {
|
|
48
|
+
throw new Error(`Unknown preset: ${presetName}. Available: ${Object.keys(CHAIN_PRESETS).join(", ")}`);
|
|
49
|
+
}
|
|
50
|
+
return { ...preset, ...overrides };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
exports.CHAIN_PRESETS = CHAIN_PRESETS;
|
|
54
|
+
exports.DEFAULT_DELEGATE_CONTRACT = DEFAULT_DELEGATE_CONTRACT;
|
|
55
|
+
exports.DEFAULT_EXECUTION_CONTRACT = DEFAULT_EXECUTION_CONTRACT;
|
|
56
|
+
exports.DEFAULT_REIMBURSABLE_USDC_CONTRACT = DEFAULT_REIMBURSABLE_USDC_CONTRACT;
|
|
57
|
+
exports.createCustomPreset = createCustomPreset;
|
|
58
|
+
exports.getPreset = getPreset;
|
|
59
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sources":["../src/config.ts"],"sourcesContent":[null],"names":["base","mainnet","sepolia"],"mappings":";;;;AAIA;AACO,MAAM,yBAAyB,GACpC;AACK,MAAM,0BAA0B,GACrC;AACK,MAAM,kCAAkC,GAC7C;AAoDF;AACO,MAAM,aAAa,GAAgC;AACxD,IAAA,YAAY,EAAE;AACZ,QAAA,KAAK,EAAEA,WAAI;AACX,QAAA,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE;AACtC,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,4CAA4C;AACnD,SAAA;AACF,KAAA;AACD,IAAA,gBAAgB,EAAE;AAChB,QAAA,KAAK,EAAEC,cAAO;AACd,QAAA,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE;AACrC,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,4CAA4C;AACnD,SAAA;AACF,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,KAAK,EAAEC,cAAO;AACd,QAAA,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE;AAC1C,KAAA;;AAGH;;AAEG;AACG,SAAU,kBAAkB,CAAC,MAAmB,EAAA;AACpD,IAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;AACjB,QAAA,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;IACpD;AACA,IAAA,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;AAClB,QAAA,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC;IACxC;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;AAEG;AACG,SAAU,SAAS,CACvB,UAAsC,EACtC,SAAgC,EAAA;AAEhC,IAAA,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CACb,mBAAmB,UAAU,CAAA,aAAA,EAAgB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CACrF;IACH;AACA,IAAA,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,EAAE;AACpC;;;;;;;;;"}
|
package/dist/config.mjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { sepolia, mainnet, base } from 'viem/chains';
|
|
2
|
+
|
|
3
|
+
// Default contract addresses (deterministically deployed across all chains)
|
|
4
|
+
const DEFAULT_DELEGATE_CONTRACT = "0x000066a00056CD44008768E2aF00696e19A30084";
|
|
5
|
+
const DEFAULT_EXECUTION_CONTRACT = "0x00000000008c57a1CE37836a5e9d36759D070d8c";
|
|
6
|
+
const DEFAULT_REIMBURSABLE_USDC_CONTRACT = "0x4c0a2998B4Dc7BAF418109b80E5dde7395703dcb";
|
|
7
|
+
// Chain preset configurations
|
|
8
|
+
const CHAIN_PRESETS = {
|
|
9
|
+
BASE_MAINNET: {
|
|
10
|
+
chain: base,
|
|
11
|
+
rpcUrl: process.env.BASE_RPC_URL || "",
|
|
12
|
+
tokens: {
|
|
13
|
+
USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
ETHEREUM_MAINNET: {
|
|
17
|
+
chain: mainnet,
|
|
18
|
+
rpcUrl: process.env.ETH_RPC_URL || "",
|
|
19
|
+
tokens: {
|
|
20
|
+
USDC: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
SEPOLIA: {
|
|
24
|
+
chain: sepolia,
|
|
25
|
+
rpcUrl: process.env.SEPOLIA_RPC_URL || "",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Create a custom preset with validation
|
|
30
|
+
*/
|
|
31
|
+
function createCustomPreset(config) {
|
|
32
|
+
if (!config.chain) {
|
|
33
|
+
throw new Error("Chain configuration is required");
|
|
34
|
+
}
|
|
35
|
+
if (!config.rpcUrl) {
|
|
36
|
+
throw new Error("RPC URL is required");
|
|
37
|
+
}
|
|
38
|
+
return config;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get a preset with optional environment variable overrides
|
|
42
|
+
*/
|
|
43
|
+
function getPreset(presetName, overrides) {
|
|
44
|
+
const preset = CHAIN_PRESETS[presetName];
|
|
45
|
+
if (!preset) {
|
|
46
|
+
throw new Error(`Unknown preset: ${presetName}. Available: ${Object.keys(CHAIN_PRESETS).join(", ")}`);
|
|
47
|
+
}
|
|
48
|
+
return { ...preset, ...overrides };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { CHAIN_PRESETS, DEFAULT_DELEGATE_CONTRACT, DEFAULT_EXECUTION_CONTRACT, DEFAULT_REIMBURSABLE_USDC_CONTRACT, createCustomPreset, getPreset };
|
|
52
|
+
//# sourceMappingURL=config.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.mjs","sources":["../src/config.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;AACO,MAAM,yBAAyB,GACpC;AACK,MAAM,0BAA0B,GACrC;AACK,MAAM,kCAAkC,GAC7C;AAoDF;AACO,MAAM,aAAa,GAAgC;AACxD,IAAA,YAAY,EAAE;AACZ,QAAA,KAAK,EAAE,IAAI;AACX,QAAA,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE;AACtC,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,4CAA4C;AACnD,SAAA;AACF,KAAA;AACD,IAAA,gBAAgB,EAAE;AAChB,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE;AACrC,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,4CAA4C;AACnD,SAAA;AACF,KAAA;AACD,IAAA,OAAO,EAAE;AACP,QAAA,KAAK,EAAE,OAAO;AACd,QAAA,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE;AAC1C,KAAA;;AAGH;;AAEG;AACG,SAAU,kBAAkB,CAAC,MAAmB,EAAA;AACpD,IAAA,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;AACjB,QAAA,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;IACpD;AACA,IAAA,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;AAClB,QAAA,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC;IACxC;AACA,IAAA,OAAO,MAAM;AACf;AAEA;;AAEG;AACG,SAAU,SAAS,CACvB,UAAsC,EACtC,SAAgC,EAAA;AAEhC,IAAA,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,MAAM,IAAI,KAAK,CACb,mBAAmB,UAAU,CAAA,aAAA,EAAgB,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CACrF;IACH;AACA,IAAA,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,SAAS,EAAE;AACpC;;;;"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type SignedAuthorization, type Hex } from "viem";
|
|
2
|
+
import type { GasStationConfig, ExecutionIntent, ApprovalExecutionIntent, ReimbursableExecutionIntent } from "./config";
|
|
3
|
+
import { IntentBuilder } from "./intentBuilder";
|
|
4
|
+
export declare class GasStationClient {
|
|
5
|
+
private walletClient;
|
|
6
|
+
private publicClient;
|
|
7
|
+
private delegateContract;
|
|
8
|
+
private executionContract;
|
|
9
|
+
private reimbursableContract;
|
|
10
|
+
constructor(config: GasStationConfig);
|
|
11
|
+
/**
|
|
12
|
+
* Sign an EIP-7702 authorization to delegate control to the gas station contract
|
|
13
|
+
* Call this with an end-user client to get a signed authorization
|
|
14
|
+
* The authorization can then be submitted by the paymaster using submitAuthorization()
|
|
15
|
+
*/
|
|
16
|
+
signAuthorization(chainId?: number): Promise<SignedAuthorization>;
|
|
17
|
+
/**
|
|
18
|
+
* Submit signed EIP-7702 authorization transaction(s)
|
|
19
|
+
* Supports authorizing multiple EOAs in a single transaction
|
|
20
|
+
* Call this with a paymaster client to broadcast the authorization transaction
|
|
21
|
+
* The paymaster pays for the gas
|
|
22
|
+
*/
|
|
23
|
+
submitAuthorizations(authorizations: SignedAuthorization[]): Promise<{
|
|
24
|
+
txHash: Hex;
|
|
25
|
+
blockNumber: bigint;
|
|
26
|
+
}>;
|
|
27
|
+
/**
|
|
28
|
+
* Check if an EOA is delegated to the gas station contract
|
|
29
|
+
* If no address is provided, uses the signer's address
|
|
30
|
+
*/
|
|
31
|
+
isAuthorized(eoaAddress?: Hex): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Get the current nonce for an EOA address from the gas station contract
|
|
34
|
+
* If no address is provided, uses the signer's address
|
|
35
|
+
*/
|
|
36
|
+
getNonce(eoaAddress?: Hex): Promise<bigint>;
|
|
37
|
+
/**
|
|
38
|
+
* Attempts to get the revert reason from a failed transaction.
|
|
39
|
+
* Replays the transaction via eth_call to extract detailed error information.
|
|
40
|
+
*
|
|
41
|
+
* This helps surface on-chain failure reasons such as:
|
|
42
|
+
* - Out of gas errors
|
|
43
|
+
* - Revert with reason strings
|
|
44
|
+
* - Custom error selectors
|
|
45
|
+
* - Insufficient balance errors
|
|
46
|
+
*/
|
|
47
|
+
private getRevertReason;
|
|
48
|
+
/**
|
|
49
|
+
* Create an intent builder for composing complex transactions
|
|
50
|
+
* Call this with an end-user client to create intents for signing
|
|
51
|
+
*/
|
|
52
|
+
createIntent(): IntentBuilder;
|
|
53
|
+
/**
|
|
54
|
+
* Sign an execution transaction for a signed intent (paymaster signs, doesn't send)
|
|
55
|
+
* This is useful for testing policies - the paymaster attempts to sign the execution
|
|
56
|
+
* but doesn't actually broadcast it to the network.
|
|
57
|
+
* Call this with a paymaster client to test if the paymaster can sign the execution.
|
|
58
|
+
*/
|
|
59
|
+
signExecution(intent: ExecutionIntent): Promise<Hex>;
|
|
60
|
+
/**
|
|
61
|
+
* Execute a signed intent through the gas station contract.
|
|
62
|
+
* Packs the execution data according to the delegate contract's expected format and
|
|
63
|
+
* submits it via the execution contract.
|
|
64
|
+
* Call this with a paymaster client to submit and pay for the transaction.
|
|
65
|
+
*/
|
|
66
|
+
execute(intent: ExecutionIntent): Promise<{
|
|
67
|
+
txHash: Hex;
|
|
68
|
+
blockNumber: bigint;
|
|
69
|
+
gasUsed: bigint;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Sign an approval then execution transaction for a signed intent (paymaster signs, doesn't send)
|
|
73
|
+
* This is useful for testing policies - the paymaster attempts to sign the execution
|
|
74
|
+
* but doesn't actually broadcast it to the network.
|
|
75
|
+
* Call this with a paymaster client to test if the paymaster can sign the execution.
|
|
76
|
+
*/
|
|
77
|
+
signApproveThenExecution(intent: ApprovalExecutionIntent): Promise<Hex>;
|
|
78
|
+
/**
|
|
79
|
+
* Execute an approval then execution through the gas station contract.
|
|
80
|
+
* Atomically approves an ERC20 token and executes a transaction in a single call.
|
|
81
|
+
* Packs the execution data according to the delegate contract's expected format and
|
|
82
|
+
* submits it via the execution contract's approveThenExecute function.
|
|
83
|
+
* Call this with a paymaster client to submit and pay for the transaction.
|
|
84
|
+
*/
|
|
85
|
+
approveThenExecute(intent: ApprovalExecutionIntent): Promise<{
|
|
86
|
+
txHash: Hex;
|
|
87
|
+
blockNumber: bigint;
|
|
88
|
+
gasUsed: bigint;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Sign a reimbursable execution transaction (paymaster signs, doesn't send).
|
|
92
|
+
* This is useful for testing policies - the paymaster attempts to sign the execution
|
|
93
|
+
* but doesn't actually broadcast it to the network.
|
|
94
|
+
* Call this with a paymaster client to test if the paymaster can sign the execution.
|
|
95
|
+
*/
|
|
96
|
+
signReimbursableExecution(intent: ReimbursableExecutionIntent): Promise<Hex>;
|
|
97
|
+
/**
|
|
98
|
+
* Execute with reimbursement through the reimbursable gas station contract.
|
|
99
|
+
* The EOA pays for gas in USDC rather than the paymaster covering the cost.
|
|
100
|
+
* The contract pulls initialDepositUSDC from the EOA, executes the transaction
|
|
101
|
+
* with a gas limit of transactionGasLimitWei, and refunds any unused USDC.
|
|
102
|
+
* Call this with a paymaster client to submit the transaction (paymaster only pays initial gas).
|
|
103
|
+
*/
|
|
104
|
+
executeWithReimbursement(intent: ReimbursableExecutionIntent): Promise<{
|
|
105
|
+
txHash: Hex;
|
|
106
|
+
blockNumber: bigint;
|
|
107
|
+
gasUsed: bigint;
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=gasStationClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gasStationClient.d.ts","sourceRoot":"","sources":["../src/gasStationClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,mBAAmB,EAMxB,KAAK,GAAG,EACT,MAAM,MAAM,CAAC;AAGd,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAMlB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMhD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,YAAY,CAA0C;IAC9D,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,gBAAgB,CAAM;IAC9B,OAAO,CAAC,iBAAiB,CAAM;IAC/B,OAAO,CAAC,oBAAoB,CAAM;gBAEtB,MAAM,EAAE,gBAAgB;IAcpC;;;;OAIG;IACG,iBAAiB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAUvE;;;;;OAKG;IACG,oBAAoB,CACxB,cAAc,EAAE,mBAAmB,EAAE,GACpC,OAAO,CAAC;QAAE,MAAM,EAAE,GAAG,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IA8BhD;;;OAGG;IACG,YAAY,CAAC,UAAU,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAatD;;;OAGG;IACG,QAAQ,CAAC,UAAU,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAajD;;;;;;;;;OASG;YACW,eAAe;IAkD7B;;;OAGG;IACH,YAAY,IAAI,aAAa;IAa7B;;;;;OAKG;IACG,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IAkC1D;;;;;OAKG;IACG,OAAO,CACX,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC;Q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