@lit-protocol/vincent-ability-aerodrome-swap 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.
Files changed (78) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/CONTRIBUTING.md +5 -0
  3. package/README.md +5 -0
  4. package/dist/CONTRIBUTING.md +5 -0
  5. package/dist/README.md +5 -0
  6. package/dist/package.json +30 -0
  7. package/dist/src/generated/lit-action.js +9 -0
  8. package/dist/src/generated/vincent-ability-metadata.json +3 -0
  9. package/dist/src/generated/vincent-bundled-ability.d.ts +136 -0
  10. package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -0
  11. package/dist/src/generated/vincent-bundled-ability.js +15 -0
  12. package/dist/src/generated/vincent-bundled-ability.js.map +1 -0
  13. package/dist/src/generated/vincent-bundled-ability.ts +13 -0
  14. package/dist/src/index.d.ts +4 -0
  15. package/dist/src/index.d.ts.map +1 -0
  16. package/dist/src/index.js +8 -0
  17. package/dist/src/index.js.map +1 -0
  18. package/dist/src/lib/ability-checks/check-erc20-allowance.d.ts +10 -0
  19. package/dist/src/lib/ability-checks/check-erc20-allowance.d.ts.map +1 -0
  20. package/dist/src/lib/ability-checks/check-erc20-allowance.js +31 -0
  21. package/dist/src/lib/ability-checks/check-erc20-allowance.js.map +1 -0
  22. package/dist/src/lib/ability-checks/check-erc20-balance.d.ts +9 -0
  23. package/dist/src/lib/ability-checks/check-erc20-balance.d.ts.map +1 -0
  24. package/dist/src/lib/ability-checks/check-erc20-balance.js +25 -0
  25. package/dist/src/lib/ability-checks/check-erc20-balance.js.map +1 -0
  26. package/dist/src/lib/ability-checks/check-native-token-balance.d.ts +7 -0
  27. package/dist/src/lib/ability-checks/check-native-token-balance.d.ts.map +1 -0
  28. package/dist/src/lib/ability-checks/check-native-token-balance.js +18 -0
  29. package/dist/src/lib/ability-checks/check-native-token-balance.js.map +1 -0
  30. package/dist/src/lib/ability-checks/index.d.ts +4 -0
  31. package/dist/src/lib/ability-checks/index.d.ts.map +1 -0
  32. package/dist/src/lib/ability-checks/index.js +7 -0
  33. package/dist/src/lib/ability-checks/index.js.map +1 -0
  34. package/dist/src/lib/ability-helpers/find-supported-token-on-base.d.ts +18 -0
  35. package/dist/src/lib/ability-helpers/find-supported-token-on-base.d.ts.map +1 -0
  36. package/dist/src/lib/ability-helpers/find-supported-token-on-base.js +10 -0
  37. package/dist/src/lib/ability-helpers/find-supported-token-on-base.js.map +1 -0
  38. package/dist/src/lib/ability-helpers/get-erc20-allowance.d.ts +8 -0
  39. package/dist/src/lib/ability-helpers/get-erc20-allowance.d.ts.map +1 -0
  40. package/dist/src/lib/ability-helpers/get-erc20-allowance.js +10 -0
  41. package/dist/src/lib/ability-helpers/get-erc20-allowance.js.map +1 -0
  42. package/dist/src/lib/ability-helpers/get-erc20-contract.d.ts +4 -0
  43. package/dist/src/lib/ability-helpers/get-erc20-contract.d.ts.map +1 -0
  44. package/dist/src/lib/ability-helpers/get-erc20-contract.js +20 -0
  45. package/dist/src/lib/ability-helpers/get-erc20-contract.js.map +1 -0
  46. package/dist/src/lib/ability-helpers/index.d.ts +6 -0
  47. package/dist/src/lib/ability-helpers/index.d.ts.map +1 -0
  48. package/dist/src/lib/ability-helpers/index.js +9 -0
  49. package/dist/src/lib/ability-helpers/index.js.map +1 -0
  50. package/dist/src/lib/ability-helpers/send-aerodrome-swap-tx.d.ts +15 -0
  51. package/dist/src/lib/ability-helpers/send-aerodrome-swap-tx.d.ts.map +1 -0
  52. package/dist/src/lib/ability-helpers/send-aerodrome-swap-tx.js +79 -0
  53. package/dist/src/lib/ability-helpers/send-aerodrome-swap-tx.js.map +1 -0
  54. package/dist/src/lib/ability-helpers/send-erc20-approval-tx.d.ts +15 -0
  55. package/dist/src/lib/ability-helpers/send-erc20-approval-tx.d.ts.map +1 -0
  56. package/dist/src/lib/ability-helpers/send-erc20-approval-tx.js +86 -0
  57. package/dist/src/lib/ability-helpers/send-erc20-approval-tx.js.map +1 -0
  58. package/dist/src/lib/ability-helpers/sign-tx.d.ts +3 -0
  59. package/dist/src/lib/ability-helpers/sign-tx.d.ts.map +1 -0
  60. package/dist/src/lib/ability-helpers/sign-tx.js +28 -0
  61. package/dist/src/lib/ability-helpers/sign-tx.js.map +1 -0
  62. package/dist/src/lib/lit-action.d.ts +2 -0
  63. package/dist/src/lib/lit-action.d.ts.map +1 -0
  64. package/dist/src/lib/lit-action.js +16 -0
  65. package/dist/src/lib/lit-action.js.map +1 -0
  66. package/dist/src/lib/schemas.d.ts +139 -0
  67. package/dist/src/lib/schemas.d.ts.map +1 -0
  68. package/dist/src/lib/schemas.js +128 -0
  69. package/dist/src/lib/schemas.js.map +1 -0
  70. package/dist/src/lib/types.d.ts +43 -0
  71. package/dist/src/lib/types.d.ts.map +1 -0
  72. package/dist/src/lib/types.js +9 -0
  73. package/dist/src/lib/types.js.map +1 -0
  74. package/dist/src/lib/vincent-ability.d.ts +134 -0
  75. package/dist/src/lib/vincent-ability.d.ts.map +1 -0
  76. package/dist/src/lib/vincent-ability.js +322 -0
  77. package/dist/src/lib/vincent-ability.js.map +1 -0
  78. package/package.json +29 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ "ipfsCid": "QmcE1zA7Ra21HpA4NnxSS26ZLqYi23g7p1zDxJker3WUha"
3
+ }
@@ -0,0 +1,136 @@
1
+ /**
2
+ * DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD.
3
+ */
4
+ export declare const bundledVincentAbility: import("@lit-protocol/vincent-ability-sdk").BundledVincentAbility<import("@lit-protocol/vincent-ability-sdk").VincentAbility<import("zod").ZodObject<{
5
+ action: import("zod").ZodEnum<["approve", "swap"]>;
6
+ rpcUrl: import("zod").ZodString;
7
+ tokenInAddress: import("zod").ZodString;
8
+ tokenOutAddress: import("zod").ZodString;
9
+ amountIn: import("zod").ZodString;
10
+ slippage: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodNumber>>;
11
+ gasBufferPercentage: import("zod").ZodOptional<import("zod").ZodNumber>;
12
+ baseFeePerGasBufferPercentage: import("zod").ZodOptional<import("zod").ZodNumber>;
13
+ alchemyGasSponsor: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
14
+ alchemyGasSponsorApiKey: import("zod").ZodOptional<import("zod").ZodString>;
15
+ alchemyGasSponsorPolicyId: import("zod").ZodOptional<import("zod").ZodString>;
16
+ }, "strip", import("zod").ZodTypeAny, {
17
+ action: "approve" | "swap";
18
+ rpcUrl: string;
19
+ tokenInAddress: string;
20
+ tokenOutAddress: string;
21
+ amountIn: string;
22
+ alchemyGasSponsor: boolean;
23
+ slippage?: number | undefined;
24
+ gasBufferPercentage?: number | undefined;
25
+ baseFeePerGasBufferPercentage?: number | undefined;
26
+ alchemyGasSponsorApiKey?: string | undefined;
27
+ alchemyGasSponsorPolicyId?: string | undefined;
28
+ }, {
29
+ action: "approve" | "swap";
30
+ rpcUrl: string;
31
+ tokenInAddress: string;
32
+ tokenOutAddress: string;
33
+ amountIn: string;
34
+ slippage?: number | undefined;
35
+ gasBufferPercentage?: number | undefined;
36
+ baseFeePerGasBufferPercentage?: number | undefined;
37
+ alchemyGasSponsor?: boolean | undefined;
38
+ alchemyGasSponsorApiKey?: string | undefined;
39
+ alchemyGasSponsorPolicyId?: string | undefined;
40
+ }>, string, import("node_modules/@lit-protocol/vincent-ability-sdk/dist/src/lib/abilityCore/helpers").AbilityPolicyMap<readonly [], never>, {}, import("zod").ZodObject<{
41
+ swapTxHash: import("zod").ZodOptional<import("zod").ZodString>;
42
+ swapTxUserOperationHash: import("zod").ZodOptional<import("zod").ZodString>;
43
+ approvalTxHash: import("zod").ZodOptional<import("zod").ZodString>;
44
+ approvalTxUserOperationHash: import("zod").ZodOptional<import("zod").ZodString>;
45
+ currentAllowance: import("zod").ZodOptional<import("zod").ZodString>;
46
+ requiredAllowance: import("zod").ZodOptional<import("zod").ZodString>;
47
+ }, "strip", import("zod").ZodTypeAny, {
48
+ currentAllowance?: string | undefined;
49
+ requiredAllowance?: string | undefined;
50
+ swapTxHash?: string | undefined;
51
+ swapTxUserOperationHash?: string | undefined;
52
+ approvalTxHash?: string | undefined;
53
+ approvalTxUserOperationHash?: string | undefined;
54
+ }, {
55
+ currentAllowance?: string | undefined;
56
+ requiredAllowance?: string | undefined;
57
+ swapTxHash?: string | undefined;
58
+ swapTxUserOperationHash?: string | undefined;
59
+ approvalTxHash?: string | undefined;
60
+ approvalTxUserOperationHash?: string | undefined;
61
+ }>, import("zod").ZodObject<{
62
+ reason: import("zod").ZodOptional<import("zod").ZodString>;
63
+ }, "strip", import("zod").ZodTypeAny, {
64
+ reason?: string | undefined;
65
+ }, {
66
+ reason?: string | undefined;
67
+ }>, import("zod").ZodObject<{
68
+ nativeTokenBalance: import("zod").ZodOptional<import("zod").ZodString>;
69
+ tokenInAddress: import("zod").ZodOptional<import("zod").ZodString>;
70
+ tokenInBalance: import("zod").ZodOptional<import("zod").ZodString>;
71
+ currentTokenInAllowanceForSpender: import("zod").ZodString;
72
+ spenderAddress: import("zod").ZodString;
73
+ requiredTokenInAllowance: import("zod").ZodOptional<import("zod").ZodString>;
74
+ quote: import("zod").ZodOptional<import("zod").ZodObject<{
75
+ tokenInAmount: import("zod").ZodString;
76
+ tokenOutAmount: import("zod").ZodString;
77
+ priceImpact: import("zod").ZodString;
78
+ }, "strip", import("zod").ZodTypeAny, {
79
+ tokenInAmount: string;
80
+ tokenOutAmount: string;
81
+ priceImpact: string;
82
+ }, {
83
+ tokenInAmount: string;
84
+ tokenOutAmount: string;
85
+ priceImpact: string;
86
+ }>>;
87
+ }, "strip", import("zod").ZodTypeAny, {
88
+ currentTokenInAllowanceForSpender: string;
89
+ spenderAddress: string;
90
+ tokenInAddress?: string | undefined;
91
+ nativeTokenBalance?: string | undefined;
92
+ tokenInBalance?: string | undefined;
93
+ requiredTokenInAllowance?: string | undefined;
94
+ quote?: {
95
+ tokenInAmount: string;
96
+ tokenOutAmount: string;
97
+ priceImpact: string;
98
+ } | undefined;
99
+ }, {
100
+ currentTokenInAllowanceForSpender: string;
101
+ spenderAddress: string;
102
+ tokenInAddress?: string | undefined;
103
+ nativeTokenBalance?: string | undefined;
104
+ tokenInBalance?: string | undefined;
105
+ requiredTokenInAllowance?: string | undefined;
106
+ quote?: {
107
+ tokenInAmount: string;
108
+ tokenOutAmount: string;
109
+ priceImpact: string;
110
+ } | undefined;
111
+ }>, import("zod").ZodObject<{
112
+ reason: import("zod").ZodString;
113
+ spenderAddress: import("zod").ZodOptional<import("zod").ZodString>;
114
+ tokenAddress: import("zod").ZodOptional<import("zod").ZodString>;
115
+ requiredTokenAmount: import("zod").ZodOptional<import("zod").ZodString>;
116
+ tokenBalance: import("zod").ZodOptional<import("zod").ZodString>;
117
+ currentAllowance: import("zod").ZodOptional<import("zod").ZodString>;
118
+ requiredAllowance: import("zod").ZodOptional<import("zod").ZodString>;
119
+ }, "strip", import("zod").ZodTypeAny, {
120
+ reason: string;
121
+ spenderAddress?: string | undefined;
122
+ tokenAddress?: string | undefined;
123
+ requiredTokenAmount?: string | undefined;
124
+ tokenBalance?: string | undefined;
125
+ currentAllowance?: string | undefined;
126
+ requiredAllowance?: string | undefined;
127
+ }, {
128
+ reason: string;
129
+ spenderAddress?: string | undefined;
130
+ tokenAddress?: string | undefined;
131
+ requiredTokenAmount?: string | undefined;
132
+ tokenBalance?: string | undefined;
133
+ currentAllowance?: string | undefined;
134
+ requiredAllowance?: string | undefined;
135
+ }>>, string>;
136
+ //# sourceMappingURL=vincent-bundled-ability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vincent-bundled-ability.d.ts","sourceRoot":"","sources":["../../../src/generated/vincent-bundled-ability.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAA4D,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.bundledVincentAbility = void 0;
7
+ const tslib_1 = require("tslib");
8
+ const vincent_ability_sdk_1 = require("@lit-protocol/vincent-ability-sdk");
9
+ const vincent_ability_1 = require("../lib/vincent-ability");
10
+ const vincent_ability_metadata_json_1 = tslib_1.__importDefault(require("./vincent-ability-metadata.json"));
11
+ if (!vincent_ability_metadata_json_1.default.ipfsCid) {
12
+ throw new Error('ipfsCid is not defined in metadata JSON file');
13
+ }
14
+ exports.bundledVincentAbility = (0, vincent_ability_sdk_1.asBundledVincentAbility)(vincent_ability_1.vincentAbility, vincent_ability_metadata_json_1.default.ipfsCid);
15
+ //# sourceMappingURL=vincent-bundled-ability.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vincent-bundled-ability.js","sourceRoot":"","sources":["../../../src/generated/vincent-bundled-ability.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;AAEH,2EAA4E;AAC5E,4DAAwD;AACxD,4GAAuD;AAEvD,IAAG,CAAC,uCAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;AAClE,CAAC;AAEY,QAAA,qBAAqB,GAAG,IAAA,6CAAuB,EAAC,gCAAc,EAAE,uCAAQ,CAAC,OAAO,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * DO NOT EDIT THIS FILE. IT IS GENERATED ON BUILD.
3
+ */
4
+
5
+ import { asBundledVincentAbility } from '@lit-protocol/vincent-ability-sdk';
6
+ import { vincentAbility } from '../lib/vincent-ability';
7
+ import metadata from './vincent-ability-metadata.json';
8
+
9
+ if(!metadata.ipfsCid) {
10
+ throw new Error('ipfsCid is not defined in metadata JSON file');
11
+ }
12
+
13
+ export const bundledVincentAbility = asBundledVincentAbility(vincentAbility, metadata.ipfsCid);
@@ -0,0 +1,4 @@
1
+ export { bundledVincentAbility } from './generated/vincent-bundled-ability';
2
+ export type { CheckNativeTokenBalanceResult, CheckNativeTokenBalanceResultSuccess, CheckNativeTokenBalanceResultFailure, CheckErc20BalanceResult, CheckErc20BalanceResultSuccess, CheckErc20BalanceResultFailure, CheckErc20AllowanceResult, CheckErc20AllowanceResultSuccess, CheckErc20AllowanceResultFailure, } from './lib/types';
3
+ export { AbilityAction } from './lib/types';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,YAAY,EACV,6BAA6B,EAC7B,oCAAoC,EACpC,oCAAoC,EACpC,uBAAuB,EACvB,8BAA8B,EAC9B,8BAA8B,EAC9B,yBAAyB,EACzB,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbilityAction = exports.bundledVincentAbility = void 0;
4
+ var vincent_bundled_ability_1 = require("./generated/vincent-bundled-ability");
5
+ Object.defineProperty(exports, "bundledVincentAbility", { enumerable: true, get: function () { return vincent_bundled_ability_1.bundledVincentAbility; } });
6
+ var types_1 = require("./lib/types");
7
+ Object.defineProperty(exports, "AbilityAction", { enumerable: true, get: function () { return types_1.AbilityAction; } });
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+EAA4E;AAAnE,gIAAA,qBAAqB,OAAA;AAY9B,qCAA4C;AAAnC,sGAAA,aAAa,OAAA"}
@@ -0,0 +1,10 @@
1
+ import { ethers } from 'ethers';
2
+ import { CheckErc20AllowanceResult } from '../types';
3
+ export declare const checkErc20Allowance: ({ provider, tokenAddress, owner, spender, requiredAllowance, }: {
4
+ provider: ethers.providers.StaticJsonRpcProvider;
5
+ tokenAddress: string;
6
+ owner: string;
7
+ spender: string;
8
+ requiredAllowance: ethers.BigNumber;
9
+ }) => Promise<CheckErc20AllowanceResult>;
10
+ //# sourceMappingURL=check-erc20-allowance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-erc20-allowance.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-checks/check-erc20-allowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAErD,eAAO,MAAM,mBAAmB,GAAU,gEAMvC;IACD,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC,SAAS,CAAC;CACrC,KAAG,OAAO,CAAC,yBAAyB,CA0BpC,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkErc20Allowance = void 0;
4
+ const get_erc20_allowance_1 = require("../ability-helpers/get-erc20-allowance");
5
+ const checkErc20Allowance = async ({ provider, tokenAddress, owner, spender, requiredAllowance, }) => {
6
+ const currentAllowance = await (0, get_erc20_allowance_1.getErc20Allowance)({
7
+ provider,
8
+ tokenAddress,
9
+ owner,
10
+ spender,
11
+ });
12
+ if (currentAllowance.lt(requiredAllowance)) {
13
+ return {
14
+ success: false,
15
+ reason: `[checkErc20Allowance] Address ${owner} has insufficient ERC20 allowance for spender ${spender} for token ${tokenAddress}`,
16
+ spenderAddress: spender,
17
+ tokenAddress: tokenAddress,
18
+ requiredAllowance,
19
+ currentAllowance,
20
+ };
21
+ }
22
+ return {
23
+ success: true,
24
+ spenderAddress: spender,
25
+ tokenAddress: tokenAddress,
26
+ requiredAllowance,
27
+ currentAllowance,
28
+ };
29
+ };
30
+ exports.checkErc20Allowance = checkErc20Allowance;
31
+ //# sourceMappingURL=check-erc20-allowance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-erc20-allowance.js","sourceRoot":"","sources":["../../../../src/lib/ability-checks/check-erc20-allowance.ts"],"names":[],"mappings":";;;AAEA,gFAA2E;AAGpE,MAAM,mBAAmB,GAAG,KAAK,EAAE,EACxC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,EACP,iBAAiB,GAOlB,EAAsC,EAAE;IACvC,MAAM,gBAAgB,GAAG,MAAM,IAAA,uCAAiB,EAAC;QAC/C,QAAQ;QACR,YAAY;QACZ,KAAK;QACL,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,gBAAgB,CAAC,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC3C,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,iCAAiC,KAAK,iDAAiD,OAAO,cAAc,YAAY,EAAE;YAClI,cAAc,EAAE,OAAO;YACvB,YAAY,EAAE,YAAY;YAC1B,iBAAiB;YACjB,gBAAgB;SACjB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,cAAc,EAAE,OAAO;QACvB,YAAY,EAAE,YAAY;QAC1B,iBAAiB;QACjB,gBAAgB;KACjB,CAAC;AACJ,CAAC,CAAC;AAtCW,QAAA,mBAAmB,uBAsC9B"}
@@ -0,0 +1,9 @@
1
+ import { ethers } from 'ethers';
2
+ import { CheckErc20BalanceResult } from '../types';
3
+ export declare const checkErc20Balance: ({ provider, pkpEthAddress, tokenAddress, requiredTokenAmount, }: {
4
+ provider: ethers.providers.StaticJsonRpcProvider;
5
+ pkpEthAddress: string;
6
+ tokenAddress: string;
7
+ requiredTokenAmount: ethers.BigNumber;
8
+ }) => Promise<CheckErc20BalanceResult>;
9
+ //# sourceMappingURL=check-erc20-balance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-erc20-balance.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-checks/check-erc20-balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAEnD,eAAO,MAAM,iBAAiB,GAAU,iEAKrC;IACD,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC,SAAS,CAAC;CACvC,KAAG,OAAO,CAAC,uBAAuB,CAqBlC,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkErc20Balance = void 0;
4
+ const get_erc20_contract_1 = require("../ability-helpers/get-erc20-contract");
5
+ const checkErc20Balance = async ({ provider, pkpEthAddress, tokenAddress, requiredTokenAmount, }) => {
6
+ const contract = (0, get_erc20_contract_1.getErc20Contract)(tokenAddress, provider);
7
+ const tokenBalance = await contract.balanceOf(pkpEthAddress);
8
+ if (tokenBalance.lt(requiredTokenAmount)) {
9
+ return {
10
+ success: false,
11
+ reason: `pkpEthAddress (${pkpEthAddress}) has insufficient balance of fromToken (${tokenAddress}). Wanted ${requiredTokenAmount}, but only have ${tokenBalance}`,
12
+ tokenAddress,
13
+ requiredTokenAmount,
14
+ tokenBalance,
15
+ };
16
+ }
17
+ return {
18
+ success: true,
19
+ tokenAddress,
20
+ requiredTokenAmount,
21
+ tokenBalance,
22
+ };
23
+ };
24
+ exports.checkErc20Balance = checkErc20Balance;
25
+ //# sourceMappingURL=check-erc20-balance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-erc20-balance.js","sourceRoot":"","sources":["../../../../src/lib/ability-checks/check-erc20-balance.ts"],"names":[],"mappings":";;;AAEA,8EAAyE;AAGlE,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,mBAAmB,GAMpB,EAAoC,EAAE;IACrC,MAAM,QAAQ,GAAG,IAAA,qCAAgB,EAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAE1D,MAAM,YAAY,GAAqB,MAAM,QAAQ,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAE/E,IAAI,YAAY,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,CAAC;QACzC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,kBAAkB,aAAa,4CAA4C,YAAY,aAAa,mBAAmB,mBAAmB,YAAY,EAAE;YAChK,YAAY;YACZ,mBAAmB;YACnB,YAAY;SACb,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,YAAY;QACZ,mBAAmB;QACnB,YAAY;KACb,CAAC;AACJ,CAAC,CAAC;AA/BW,QAAA,iBAAiB,qBA+B5B"}
@@ -0,0 +1,7 @@
1
+ import { ethers } from 'ethers';
2
+ import { CheckNativeTokenBalanceResult } from '../types';
3
+ export declare const checkNativeTokenBalance: ({ provider, pkpEthAddress, }: {
4
+ provider: ethers.providers.Provider;
5
+ pkpEthAddress: string;
6
+ }) => Promise<CheckNativeTokenBalanceResult>;
7
+ //# sourceMappingURL=check-native-token-balance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-native-token-balance.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-checks/check-native-token-balance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,6BAA6B,EAAE,MAAM,UAAU,CAAC;AAEzD,eAAO,MAAM,uBAAuB,GAAU,8BAG3C;IACD,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;CACvB,KAAG,OAAO,CAAC,6BAA6B,CAcxC,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkNativeTokenBalance = void 0;
4
+ const checkNativeTokenBalance = async ({ provider, pkpEthAddress, }) => {
5
+ const ethBalance = await provider.getBalance(pkpEthAddress);
6
+ if (ethBalance.isZero()) {
7
+ return {
8
+ success: false,
9
+ reason: `pkpEthAddress (${pkpEthAddress}) has zero native token balance (AerodromeSwapAbilityPrecheck)`,
10
+ };
11
+ }
12
+ return {
13
+ success: true,
14
+ ethBalance,
15
+ };
16
+ };
17
+ exports.checkNativeTokenBalance = checkNativeTokenBalance;
18
+ //# sourceMappingURL=check-native-token-balance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check-native-token-balance.js","sourceRoot":"","sources":["../../../../src/lib/ability-checks/check-native-token-balance.ts"],"names":[],"mappings":";;;AAIO,MAAM,uBAAuB,GAAG,KAAK,EAAE,EAC5C,QAAQ,EACR,aAAa,GAId,EAA0C,EAAE;IAC3C,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAE5D,IAAI,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;QACxB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,kBAAkB,aAAa,gEAAgE;SACxG,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,uBAAuB,2BAoBlC"}
@@ -0,0 +1,4 @@
1
+ export * from './check-erc20-allowance';
2
+ export * from './check-erc20-balance';
3
+ export * from './check-native-token-balance';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-checks/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./check-erc20-allowance"), exports);
5
+ tslib_1.__exportStar(require("./check-erc20-balance"), exports);
6
+ tslib_1.__exportStar(require("./check-native-token-balance"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/ability-checks/index.ts"],"names":[],"mappings":";;;AAAA,kEAAwC;AACxC,gEAAsC;AACtC,uEAA6C"}
@@ -0,0 +1,18 @@
1
+ import { type SugarWagmiConfig } from 'sugar-sdk';
2
+ export declare const findSupportedTokenOnBase: ({ config, chainId, tokenAddress, }: {
3
+ config: SugarWagmiConfig;
4
+ chainId: number;
5
+ tokenAddress: string;
6
+ }) => Promise<Readonly<{
7
+ chainId: number;
8
+ address: `0x${string}`;
9
+ name?: string;
10
+ symbol: string;
11
+ listed: boolean;
12
+ decimals: number;
13
+ balance: bigint;
14
+ price: bigint;
15
+ balanceValue: bigint;
16
+ wrappedAddress?: `0x${string}`;
17
+ }> | undefined>;
18
+ //# sourceMappingURL=find-supported-token-on-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-supported-token-on-base.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/find-supported-token-on-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEnE,eAAO,MAAM,wBAAwB,GAAU,oCAI5C;IACD,MAAM,EAAE,gBAAgB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;CACtB;;;;;;;;;;;eAMA,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findSupportedTokenOnBase = void 0;
4
+ const sugar_sdk_1 = require("sugar-sdk");
5
+ const findSupportedTokenOnBase = async ({ config, chainId, tokenAddress, }) => {
6
+ const allTokensSupportedOnBaseMainnet = await (0, sugar_sdk_1.getListedTokens)({ config });
7
+ return allTokensSupportedOnBaseMainnet.find((token) => token.address.toLowerCase() === tokenAddress.toLowerCase() && token.chainId === chainId);
8
+ };
9
+ exports.findSupportedTokenOnBase = findSupportedTokenOnBase;
10
+ //# sourceMappingURL=find-supported-token-on-base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-supported-token-on-base.js","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/find-supported-token-on-base.ts"],"names":[],"mappings":";;;AAAA,yCAAmE;AAE5D,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAC7C,MAAM,EACN,OAAO,EACP,YAAY,GAKb,EAAE,EAAE;IACH,MAAM,+BAA+B,GAAG,MAAM,IAAA,2BAAe,EAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1E,OAAO,+BAA+B,CAAC,IAAI,CACzC,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,YAAY,CAAC,WAAW,EAAE,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,CAC1F,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,wBAAwB,4BAcnC"}
@@ -0,0 +1,8 @@
1
+ import { ethers } from 'ethers';
2
+ export declare const getErc20Allowance: ({ provider, tokenAddress, owner, spender, }: {
3
+ provider: ethers.providers.JsonRpcProvider;
4
+ tokenAddress: string;
5
+ owner: string;
6
+ spender: string;
7
+ }) => Promise<ethers.BigNumber>;
8
+ //# sourceMappingURL=get-erc20-allowance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-erc20-allowance.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/get-erc20-allowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,eAAO,MAAM,iBAAiB,GAAU,6CAKrC;IACD,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,KAAG,OAAO,CAAC,MAAM,CAAC,SAAS,CAG3B,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getErc20Allowance = void 0;
4
+ const get_erc20_contract_1 = require("./get-erc20-contract");
5
+ const getErc20Allowance = async ({ provider, tokenAddress, owner, spender, }) => {
6
+ const contract = (0, get_erc20_contract_1.getErc20Contract)(tokenAddress, provider);
7
+ return await contract.allowance(owner, spender);
8
+ };
9
+ exports.getErc20Allowance = getErc20Allowance;
10
+ //# sourceMappingURL=get-erc20-allowance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-erc20-allowance.js","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/get-erc20-allowance.ts"],"names":[],"mappings":";;;AAEA,6DAAwD;AAEjD,MAAM,iBAAiB,GAAG,KAAK,EAAE,EACtC,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,OAAO,GAMR,EAA6B,EAAE;IAC9B,MAAM,QAAQ,GAAG,IAAA,qCAAgB,EAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAC1D,OAAO,MAAM,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC,CAAC;AAbW,QAAA,iBAAiB,qBAa5B"}
@@ -0,0 +1,4 @@
1
+ import { ethers } from 'ethers';
2
+ export declare const ERC20_ABI: string[];
3
+ export declare function getErc20Contract(tokenAddress: string, provider: ethers.providers.JsonRpcProvider): ethers.Contract;
4
+ //# sourceMappingURL=get-erc20-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-erc20-contract.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/get-erc20-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,SAAS,UAUrB,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,eAAe,mBAEhG"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ERC20_ABI = void 0;
4
+ exports.getErc20Contract = getErc20Contract;
5
+ const ethers_1 = require("ethers");
6
+ exports.ERC20_ABI = [
7
+ 'function balanceOf(address owner) external view returns (uint256)',
8
+ 'function approve(address spender, uint256 amount) external returns (bool)',
9
+ 'function allowance(address owner, address spender) external view returns (uint256)',
10
+ 'function decimals() view returns (uint8)',
11
+ 'function totalSupply() external view returns (uint256)',
12
+ 'function transfer(address to, uint256 amount) external returns (bool)',
13
+ 'function transferFrom(address from, address to, uint256 amount) external returns (bool)',
14
+ 'function name() external view returns (string)',
15
+ 'function symbol() external view returns (string)',
16
+ ];
17
+ function getErc20Contract(tokenAddress, provider) {
18
+ return new ethers_1.ethers.Contract(tokenAddress, exports.ERC20_ABI, provider);
19
+ }
20
+ //# sourceMappingURL=get-erc20-contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-erc20-contract.js","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/get-erc20-contract.ts"],"names":[],"mappings":";;;AAcA,4CAEC;AAhBD,mCAAgC;AAEnB,QAAA,SAAS,GAAG;IACvB,mEAAmE;IACnE,2EAA2E;IAC3E,oFAAoF;IACpF,0CAA0C;IAC1C,wDAAwD;IACxD,uEAAuE;IACvE,yFAAyF;IACzF,gDAAgD;IAChD,kDAAkD;CACnD,CAAC;AAEF,SAAgB,gBAAgB,CAAC,YAAoB,EAAE,QAA0C;IAC/F,OAAO,IAAI,eAAM,CAAC,QAAQ,CAAC,YAAY,EAAE,iBAAS,EAAE,QAAQ,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from './get-erc20-allowance';
2
+ export * from './get-erc20-contract';
3
+ export * from './send-aerodrome-swap-tx';
4
+ export * from './send-erc20-approval-tx';
5
+ export * from './sign-tx';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./get-erc20-allowance"), exports);
5
+ tslib_1.__exportStar(require("./get-erc20-contract"), exports);
6
+ tslib_1.__exportStar(require("./send-aerodrome-swap-tx"), exports);
7
+ tslib_1.__exportStar(require("./send-erc20-approval-tx"), exports);
8
+ tslib_1.__exportStar(require("./sign-tx"), exports);
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,+DAAqC;AACrC,mEAAyC;AACzC,mEAAyC;AACzC,oDAA0B"}
@@ -0,0 +1,15 @@
1
+ export declare const sendAerodromeSwapTx: ({ rpcUrl, chainId, pkpEthAddress, pkpPublicKey, to, value, calldata, gasBufferPercentage, baseFeePerGasBufferPercentage, alchemyGasSponsor, alchemyGasSponsorApiKey, alchemyGasSponsorPolicyId, }: {
2
+ rpcUrl: string;
3
+ chainId: number;
4
+ pkpEthAddress: string;
5
+ pkpPublicKey: string;
6
+ to: string;
7
+ value: string;
8
+ calldata: string;
9
+ gasBufferPercentage?: number;
10
+ baseFeePerGasBufferPercentage?: number;
11
+ alchemyGasSponsor?: boolean;
12
+ alchemyGasSponsorApiKey?: string;
13
+ alchemyGasSponsorPolicyId?: string;
14
+ }) => Promise<string>;
15
+ //# sourceMappingURL=send-aerodrome-swap-tx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-aerodrome-swap-tx.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/send-aerodrome-swap-tx.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,mBAAmB,GAAU,mMAavC;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,KAAG,OAAO,CAAC,MAAM,CAyFjB,CAAC"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sendAerodromeSwapTx = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const vincent_ability_sdk_1 = require("@lit-protocol/vincent-ability-sdk");
6
+ const sign_tx_1 = require("./sign-tx");
7
+ const sendAerodromeSwapTx = async ({ rpcUrl, chainId, pkpEthAddress, pkpPublicKey, to, value, calldata, gasBufferPercentage, baseFeePerGasBufferPercentage, alchemyGasSponsor, alchemyGasSponsorApiKey, alchemyGasSponsorPolicyId, }) => {
8
+ if (alchemyGasSponsor) {
9
+ console.log('[sendAerodromeSwapTx] Alchemy gas sponsor is enabled');
10
+ if (!alchemyGasSponsorApiKey || !alchemyGasSponsorPolicyId) {
11
+ throw new Error('[sendAerodromeSwapTx] Alchemy gas sponsor is enabled, but API key or policy ID is not provided.');
12
+ }
13
+ return await (0, vincent_ability_sdk_1.sponsoredGasRawTransaction)({
14
+ pkpPublicKey,
15
+ to,
16
+ value,
17
+ data: calldata,
18
+ chainId,
19
+ eip7702AlchemyApiKey: alchemyGasSponsorApiKey,
20
+ eip7702AlchemyPolicyId: alchemyGasSponsorPolicyId,
21
+ });
22
+ }
23
+ console.log('Estimating gas for Aerodrome swap transaction (sendAerodromeSwapTx)');
24
+ const populateTxResponse = await Lit.Actions.runOnce({ waitForResponse: true, name: 'Aerodrome swap tx gas estimation' }, async () => {
25
+ try {
26
+ return JSON.stringify({
27
+ status: 'success',
28
+ populatedTransaction: await (0, vincent_ability_sdk_1.populateTransaction)({
29
+ to,
30
+ from: pkpEthAddress,
31
+ value,
32
+ data: calldata,
33
+ rpcUrl,
34
+ chainId,
35
+ gasBufferPercentage,
36
+ baseFeePerGasBufferPercentage,
37
+ }),
38
+ });
39
+ }
40
+ catch (error) {
41
+ return JSON.stringify({
42
+ status: 'error',
43
+ error: error instanceof Error ? error.message : String(error),
44
+ });
45
+ }
46
+ });
47
+ const parsedPopulateTxResponse = JSON.parse(populateTxResponse);
48
+ if (parsedPopulateTxResponse.status === 'error') {
49
+ throw new Error(`[sendAerodromeSwapTx] Error populating transaction for swap: ${parsedPopulateTxResponse.error}`);
50
+ }
51
+ const { populatedTransaction } = parsedPopulateTxResponse;
52
+ const signedSwapTx = await (0, sign_tx_1.signTx)(pkpPublicKey, populatedTransaction, 'aerodromeSwapSig');
53
+ console.log(`Broadcasting Aerodrome swap transaction (sendAerodromeSwapTx)`);
54
+ const swapTxResponse = await Lit.Actions.runOnce({ waitForResponse: true, name: 'aerodromeSwapTxSender' }, async () => {
55
+ try {
56
+ const rpcProvider = new ethers_1.ethers.providers.StaticJsonRpcProvider(rpcUrl);
57
+ const receipt = await rpcProvider.sendTransaction(signedSwapTx);
58
+ return JSON.stringify({
59
+ status: 'success',
60
+ txHash: receipt.hash,
61
+ });
62
+ }
63
+ catch (error) {
64
+ return JSON.stringify({
65
+ status: 'error',
66
+ error: error instanceof Error ? error.message : String(error),
67
+ });
68
+ }
69
+ });
70
+ const parsedSwapTxResponse = JSON.parse(swapTxResponse);
71
+ if (parsedSwapTxResponse.status === 'error') {
72
+ throw new Error(`Error broadcasting Aerodrome swap transaction: ${parsedSwapTxResponse.error} (sendAerodromeSwapTx)`);
73
+ }
74
+ const { txHash } = parsedSwapTxResponse;
75
+ console.log(`Aerodrome swap transaction broadcasted (sendAerodromeSwapTx): ${txHash}`);
76
+ return txHash;
77
+ };
78
+ exports.sendAerodromeSwapTx = sendAerodromeSwapTx;
79
+ //# sourceMappingURL=send-aerodrome-swap-tx.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-aerodrome-swap-tx.js","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/send-aerodrome-swap-tx.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,15 @@
1
+ export declare const sendErc20ApprovalTx: ({ rpcUrl, chainId, pkpPublicKey, pkpEthAddress, erc20TokenAddress, spenderAddress, allowanceAmount, gasBufferPercentage, baseFeePerGasBufferPercentage, alchemyGasSponsor, alchemyGasSponsorApiKey, alchemyGasSponsorPolicyId, }: {
2
+ rpcUrl: string;
3
+ chainId: number;
4
+ pkpPublicKey: string;
5
+ pkpEthAddress: string;
6
+ erc20TokenAddress: string;
7
+ spenderAddress: string;
8
+ allowanceAmount: string;
9
+ gasBufferPercentage?: number;
10
+ baseFeePerGasBufferPercentage?: number;
11
+ alchemyGasSponsor: boolean;
12
+ alchemyGasSponsorApiKey?: string;
13
+ alchemyGasSponsorPolicyId?: string;
14
+ }) => Promise<string>;
15
+ //# sourceMappingURL=send-erc20-approval-tx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-erc20-approval-tx.d.ts","sourceRoot":"","sources":["../../../../src/lib/ability-helpers/send-erc20-approval-tx.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,mBAAmB,GAAU,kOAavC;IACD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,KAAG,OAAO,CAAC,MAAM,CA+FjB,CAAC"}