@lit-protocol/vincent-ability-debridge 0.0.7-mma
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/CONTRIBUTING.md +90 -0
- package/README.md +124 -0
- package/dist/CONTRIBUTING.md +90 -0
- package/dist/README.md +124 -0
- package/dist/package.json +35 -0
- package/dist/src/generated/lit-action.js +9 -0
- package/dist/src/generated/vincent-ability-metadata.json +3 -0
- package/dist/src/generated/vincent-bundled-ability.d.ts +191 -0
- package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -0
- package/dist/src/generated/vincent-bundled-ability.js +15 -0
- package/dist/src/generated/vincent-bundled-ability.js.map +1 -0
- package/dist/src/generated/vincent-bundled-ability.ts +13 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/helpers/index.d.ts +67 -0
- package/dist/src/lib/helpers/index.d.ts.map +1 -0
- package/dist/src/lib/helpers/index.js +241 -0
- package/dist/src/lib/helpers/index.js.map +1 -0
- package/dist/src/lib/lit-action.d.ts +2 -0
- package/dist/src/lib/lit-action.d.ts.map +1 -0
- package/dist/src/lib/lit-action.js +16 -0
- package/dist/src/lib/lit-action.js.map +1 -0
- package/dist/src/lib/schemas.d.ts +198 -0
- package/dist/src/lib/schemas.d.ts.map +1 -0
- package/dist/src/lib/schemas.js +93 -0
- package/dist/src/lib/schemas.js.map +1 -0
- package/dist/src/lib/vincent-ability.d.ts +188 -0
- package/dist/src/lib/vincent-ability.d.ts.map +1 -0
- package/dist/src/lib/vincent-ability.js +258 -0
- package/dist/src/lib/vincent-ability.js.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,191 @@
|
|
|
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
|
+
rpcUrl: import("zod").ZodString;
|
|
6
|
+
sourceChain: import("zod").ZodString;
|
|
7
|
+
destinationChain: import("zod").ZodString;
|
|
8
|
+
sourceToken: import("zod").ZodString;
|
|
9
|
+
destinationToken: import("zod").ZodString;
|
|
10
|
+
amount: import("zod").ZodEffects<import("zod").ZodString, string, string>;
|
|
11
|
+
recipientAddress: import("zod").ZodString;
|
|
12
|
+
operation: import("zod").ZodEnum<["BRIDGE", "BRIDGE_AND_SWAP"]>;
|
|
13
|
+
slippageBps: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodNumber>>;
|
|
14
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
15
|
+
rpcUrl: string;
|
|
16
|
+
sourceChain: string;
|
|
17
|
+
destinationChain: string;
|
|
18
|
+
sourceToken: string;
|
|
19
|
+
destinationToken: string;
|
|
20
|
+
amount: string;
|
|
21
|
+
recipientAddress: string;
|
|
22
|
+
operation: "BRIDGE" | "BRIDGE_AND_SWAP";
|
|
23
|
+
slippageBps: number;
|
|
24
|
+
}, {
|
|
25
|
+
rpcUrl: string;
|
|
26
|
+
sourceChain: string;
|
|
27
|
+
destinationChain: string;
|
|
28
|
+
sourceToken: string;
|
|
29
|
+
destinationToken: string;
|
|
30
|
+
amount: string;
|
|
31
|
+
recipientAddress: string;
|
|
32
|
+
operation: "BRIDGE" | "BRIDGE_AND_SWAP";
|
|
33
|
+
slippageBps?: number | undefined;
|
|
34
|
+
}>, string, import("node_modules/@lit-protocol/vincent-ability-sdk/dist/src/lib/abilityCore/helpers").AbilityPolicyMap<readonly [], never>, {}, import("zod").ZodObject<{
|
|
35
|
+
data: import("zod").ZodObject<{
|
|
36
|
+
txHash: import("zod").ZodString;
|
|
37
|
+
sourceChain: import("zod").ZodString;
|
|
38
|
+
destinationChain: import("zod").ZodString;
|
|
39
|
+
sourceToken: import("zod").ZodString;
|
|
40
|
+
destinationToken: import("zod").ZodString;
|
|
41
|
+
sourceAmount: import("zod").ZodString;
|
|
42
|
+
orderId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
43
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
44
|
+
sourceChain: string;
|
|
45
|
+
destinationChain: string;
|
|
46
|
+
sourceToken: string;
|
|
47
|
+
destinationToken: string;
|
|
48
|
+
sourceAmount: string;
|
|
49
|
+
txHash: string;
|
|
50
|
+
orderId?: string | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
sourceChain: string;
|
|
53
|
+
destinationChain: string;
|
|
54
|
+
sourceToken: string;
|
|
55
|
+
destinationToken: string;
|
|
56
|
+
sourceAmount: string;
|
|
57
|
+
txHash: string;
|
|
58
|
+
orderId?: string | undefined;
|
|
59
|
+
}>;
|
|
60
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
61
|
+
data: {
|
|
62
|
+
sourceChain: string;
|
|
63
|
+
destinationChain: string;
|
|
64
|
+
sourceToken: string;
|
|
65
|
+
destinationToken: string;
|
|
66
|
+
sourceAmount: string;
|
|
67
|
+
txHash: string;
|
|
68
|
+
orderId?: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
}, {
|
|
71
|
+
data: {
|
|
72
|
+
sourceChain: string;
|
|
73
|
+
destinationChain: string;
|
|
74
|
+
sourceToken: string;
|
|
75
|
+
destinationToken: string;
|
|
76
|
+
sourceAmount: string;
|
|
77
|
+
txHash: string;
|
|
78
|
+
orderId?: string | undefined;
|
|
79
|
+
};
|
|
80
|
+
}>, import("zod").ZodObject<{
|
|
81
|
+
error: import("zod").ZodString;
|
|
82
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
83
|
+
error: string;
|
|
84
|
+
}, {
|
|
85
|
+
error: string;
|
|
86
|
+
}>, import("zod").ZodObject<{
|
|
87
|
+
data: import("zod").ZodObject<{
|
|
88
|
+
sourceChain: import("zod").ZodString;
|
|
89
|
+
destinationChain: import("zod").ZodString;
|
|
90
|
+
sourceToken: import("zod").ZodString;
|
|
91
|
+
destinationToken: import("zod").ZodString;
|
|
92
|
+
sourceAmount: import("zod").ZodString;
|
|
93
|
+
estimatedDestinationAmount: import("zod").ZodString;
|
|
94
|
+
estimatedFees: import("zod").ZodObject<{
|
|
95
|
+
protocolFee: import("zod").ZodString;
|
|
96
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
97
|
+
protocolFee: string;
|
|
98
|
+
}, {
|
|
99
|
+
protocolFee: string;
|
|
100
|
+
}>;
|
|
101
|
+
estimatedExecutionTime: import("zod").ZodString;
|
|
102
|
+
orderData: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
103
|
+
orderId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
104
|
+
txData: import("zod").ZodOptional<import("zod").ZodString>;
|
|
105
|
+
contractAddress: import("zod").ZodString;
|
|
106
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
107
|
+
contractAddress: string;
|
|
108
|
+
orderId?: string | undefined;
|
|
109
|
+
txData?: string | undefined;
|
|
110
|
+
}, {
|
|
111
|
+
contractAddress: string;
|
|
112
|
+
orderId?: string | undefined;
|
|
113
|
+
txData?: string | undefined;
|
|
114
|
+
}>>;
|
|
115
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
116
|
+
sourceChain: string;
|
|
117
|
+
destinationChain: string;
|
|
118
|
+
sourceToken: string;
|
|
119
|
+
destinationToken: string;
|
|
120
|
+
sourceAmount: string;
|
|
121
|
+
estimatedDestinationAmount: string;
|
|
122
|
+
estimatedFees: {
|
|
123
|
+
protocolFee: string;
|
|
124
|
+
};
|
|
125
|
+
estimatedExecutionTime: string;
|
|
126
|
+
orderData?: {
|
|
127
|
+
contractAddress: string;
|
|
128
|
+
orderId?: string | undefined;
|
|
129
|
+
txData?: string | undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
}, {
|
|
132
|
+
sourceChain: string;
|
|
133
|
+
destinationChain: string;
|
|
134
|
+
sourceToken: string;
|
|
135
|
+
destinationToken: string;
|
|
136
|
+
sourceAmount: string;
|
|
137
|
+
estimatedDestinationAmount: string;
|
|
138
|
+
estimatedFees: {
|
|
139
|
+
protocolFee: string;
|
|
140
|
+
};
|
|
141
|
+
estimatedExecutionTime: string;
|
|
142
|
+
orderData?: {
|
|
143
|
+
contractAddress: string;
|
|
144
|
+
orderId?: string | undefined;
|
|
145
|
+
txData?: string | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
}>;
|
|
148
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
149
|
+
data: {
|
|
150
|
+
sourceChain: string;
|
|
151
|
+
destinationChain: string;
|
|
152
|
+
sourceToken: string;
|
|
153
|
+
destinationToken: string;
|
|
154
|
+
sourceAmount: string;
|
|
155
|
+
estimatedDestinationAmount: string;
|
|
156
|
+
estimatedFees: {
|
|
157
|
+
protocolFee: string;
|
|
158
|
+
};
|
|
159
|
+
estimatedExecutionTime: string;
|
|
160
|
+
orderData?: {
|
|
161
|
+
contractAddress: string;
|
|
162
|
+
orderId?: string | undefined;
|
|
163
|
+
txData?: string | undefined;
|
|
164
|
+
} | undefined;
|
|
165
|
+
};
|
|
166
|
+
}, {
|
|
167
|
+
data: {
|
|
168
|
+
sourceChain: string;
|
|
169
|
+
destinationChain: string;
|
|
170
|
+
sourceToken: string;
|
|
171
|
+
destinationToken: string;
|
|
172
|
+
sourceAmount: string;
|
|
173
|
+
estimatedDestinationAmount: string;
|
|
174
|
+
estimatedFees: {
|
|
175
|
+
protocolFee: string;
|
|
176
|
+
};
|
|
177
|
+
estimatedExecutionTime: string;
|
|
178
|
+
orderData?: {
|
|
179
|
+
contractAddress: string;
|
|
180
|
+
orderId?: string | undefined;
|
|
181
|
+
txData?: string | undefined;
|
|
182
|
+
} | undefined;
|
|
183
|
+
};
|
|
184
|
+
}>, import("zod").ZodObject<{
|
|
185
|
+
error: import("zod").ZodString;
|
|
186
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
187
|
+
error: string;
|
|
188
|
+
}, {
|
|
189
|
+
error: string;
|
|
190
|
+
}>>, string>;
|
|
191
|
+
//# 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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
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
|
+
//# 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"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
export declare const NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
3
|
+
export declare const CHAIN_IDS: {
|
|
4
|
+
readonly ETHEREUM: "1";
|
|
5
|
+
readonly BASE: "8453";
|
|
6
|
+
readonly ARBITRUM: "42161";
|
|
7
|
+
readonly OPTIMISM: "10";
|
|
8
|
+
readonly POLYGON: "137";
|
|
9
|
+
readonly BSC: "56";
|
|
10
|
+
readonly AVALANCHE: "43114";
|
|
11
|
+
};
|
|
12
|
+
export declare const CHAIN_NAMES: Record<string, string>;
|
|
13
|
+
export declare const DEBRIDGE_API_URL = "https://dln.debridge.finance/v1.0";
|
|
14
|
+
export declare const DEBRIDGE_CONTRACTS: Record<string, string>;
|
|
15
|
+
export declare const DEBRIDGE_ABI: {
|
|
16
|
+
inputs: ({
|
|
17
|
+
components: {
|
|
18
|
+
internalType: string;
|
|
19
|
+
name: string;
|
|
20
|
+
type: string;
|
|
21
|
+
}[];
|
|
22
|
+
internalType: string;
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
} | {
|
|
26
|
+
internalType: string;
|
|
27
|
+
name: string;
|
|
28
|
+
type: string;
|
|
29
|
+
components?: undefined;
|
|
30
|
+
})[];
|
|
31
|
+
name: string;
|
|
32
|
+
outputs: {
|
|
33
|
+
internalType: string;
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
}[];
|
|
37
|
+
stateMutability: string;
|
|
38
|
+
type: string;
|
|
39
|
+
}[];
|
|
40
|
+
export declare const ERC20_ABI: {
|
|
41
|
+
constant: boolean;
|
|
42
|
+
inputs: {
|
|
43
|
+
name: string;
|
|
44
|
+
type: string;
|
|
45
|
+
}[];
|
|
46
|
+
name: string;
|
|
47
|
+
outputs: {
|
|
48
|
+
name: string;
|
|
49
|
+
type: string;
|
|
50
|
+
}[];
|
|
51
|
+
type: string;
|
|
52
|
+
}[];
|
|
53
|
+
export declare function isNativeToken(tokenAddress: string): boolean;
|
|
54
|
+
export declare function getChainName(chainId: string): string;
|
|
55
|
+
export declare function getTokenBalance(provider: ethers.providers.Provider, tokenAddress: string, userAddress: string): Promise<ethers.BigNumber>;
|
|
56
|
+
export declare function getTokenDecimals(provider: ethers.providers.Provider, tokenAddress: string): Promise<number>;
|
|
57
|
+
export declare function checkAndApproveToken(provider: ethers.providers.Provider, tokenAddress: string, ownerAddress: string, spenderAddress: string, amount: ethers.BigNumber): Promise<{
|
|
58
|
+
needsApproval: boolean;
|
|
59
|
+
currentAllowance: ethers.BigNumber;
|
|
60
|
+
}>;
|
|
61
|
+
export declare function validateChainId(chainId: string): boolean;
|
|
62
|
+
export declare function validateAddress(address: string): boolean;
|
|
63
|
+
export declare function callDeBridgeAPI(endpoint: string, method?: string, data?: any): Promise<any>;
|
|
64
|
+
export declare function formatAmount(amount: string, decimals: number): string;
|
|
65
|
+
export declare function parseAmount(amount: string, decimals: number): string;
|
|
66
|
+
export declare function getRpcUrl(chainId: string): Promise<string>;
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,eAAO,MAAM,oBAAoB,+CAA+C,CAAC;AAEjF,eAAO,MAAM,SAAS;;;;;;;;CAQZ,CAAC;AAEX,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQ9C,CAAC;AAEF,eAAO,MAAM,gBAAgB,sCAAsC,CAAC;AAEpE,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MA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,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOpE;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYhE"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ERC20_ABI = exports.DEBRIDGE_ABI = exports.DEBRIDGE_CONTRACTS = exports.DEBRIDGE_API_URL = exports.CHAIN_NAMES = exports.CHAIN_IDS = exports.NATIVE_TOKEN_ADDRESS = void 0;
|
|
4
|
+
exports.isNativeToken = isNativeToken;
|
|
5
|
+
exports.getChainName = getChainName;
|
|
6
|
+
exports.getTokenBalance = getTokenBalance;
|
|
7
|
+
exports.getTokenDecimals = getTokenDecimals;
|
|
8
|
+
exports.checkAndApproveToken = checkAndApproveToken;
|
|
9
|
+
exports.validateChainId = validateChainId;
|
|
10
|
+
exports.validateAddress = validateAddress;
|
|
11
|
+
exports.callDeBridgeAPI = callDeBridgeAPI;
|
|
12
|
+
exports.formatAmount = formatAmount;
|
|
13
|
+
exports.parseAmount = parseAmount;
|
|
14
|
+
exports.getRpcUrl = getRpcUrl;
|
|
15
|
+
const ethers_1 = require("ethers");
|
|
16
|
+
const constants_1 = require("@lit-protocol/constants");
|
|
17
|
+
exports.NATIVE_TOKEN_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
18
|
+
exports.CHAIN_IDS = {
|
|
19
|
+
ETHEREUM: '1',
|
|
20
|
+
BASE: '8453',
|
|
21
|
+
ARBITRUM: '42161',
|
|
22
|
+
OPTIMISM: '10',
|
|
23
|
+
POLYGON: '137',
|
|
24
|
+
BSC: '56',
|
|
25
|
+
AVALANCHE: '43114',
|
|
26
|
+
};
|
|
27
|
+
exports.CHAIN_NAMES = {
|
|
28
|
+
'1': 'Ethereum',
|
|
29
|
+
'8453': 'Base',
|
|
30
|
+
'42161': 'Arbitrum',
|
|
31
|
+
'10': 'Optimism',
|
|
32
|
+
'137': 'Polygon',
|
|
33
|
+
'56': 'BSC',
|
|
34
|
+
'43114': 'Avalanche',
|
|
35
|
+
};
|
|
36
|
+
exports.DEBRIDGE_API_URL = 'https://dln.debridge.finance/v1.0';
|
|
37
|
+
exports.DEBRIDGE_CONTRACTS = {
|
|
38
|
+
'1': '0xeF4fB24aD0916217251F553c0596F8Edc630EB66', // Ethereum
|
|
39
|
+
'8453': '0xeF4fB24aD0916217251F553c0596F8Edc630EB66', // Base
|
|
40
|
+
'42161': '0xeF4fB24aD0916217251F553c0596F8Edc630EB66', // Arbitrum
|
|
41
|
+
'10': '0xeF4fB24aD0916217251F553c0596F8Edc630EB66', // Optimism
|
|
42
|
+
'137': '0xeF4fB24aD0916217251F553c0596F8Edc630EB66', // Polygon
|
|
43
|
+
'56': '0xeF4fB24aD0916217251F553c0596F8Edc630EB66', // BSC
|
|
44
|
+
'43114': '0xeF4fB24aD0916217251F553c0596F8Edc630EB66', // Avalanche
|
|
45
|
+
};
|
|
46
|
+
exports.DEBRIDGE_ABI = [
|
|
47
|
+
{
|
|
48
|
+
inputs: [
|
|
49
|
+
{
|
|
50
|
+
components: [
|
|
51
|
+
{
|
|
52
|
+
internalType: 'address',
|
|
53
|
+
name: 'giveTokenAddress',
|
|
54
|
+
type: 'address',
|
|
55
|
+
},
|
|
56
|
+
{ internalType: 'uint256', name: 'giveAmount', type: 'uint256' },
|
|
57
|
+
{ internalType: 'uint256', name: 'takeAmount', type: 'uint256' },
|
|
58
|
+
{ internalType: 'uint256', name: 'takeChainId', type: 'uint256' },
|
|
59
|
+
{ internalType: 'address', name: 'receiverDst', type: 'address' },
|
|
60
|
+
{
|
|
61
|
+
internalType: 'address',
|
|
62
|
+
name: 'givePatchAuthoritySrc',
|
|
63
|
+
type: 'address',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
internalType: 'address',
|
|
67
|
+
name: 'orderAuthorityAddressDst',
|
|
68
|
+
type: 'address',
|
|
69
|
+
},
|
|
70
|
+
{ internalType: 'bytes', name: 'allowedTakerDst', type: 'bytes' },
|
|
71
|
+
{ internalType: 'bytes', name: 'externalCall', type: 'bytes' },
|
|
72
|
+
{
|
|
73
|
+
internalType: 'bytes',
|
|
74
|
+
name: 'allowedCancelBeneficiarySrc',
|
|
75
|
+
type: 'bytes',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
internalType: 'struct DLNOrder',
|
|
79
|
+
name: '_order',
|
|
80
|
+
type: 'tuple',
|
|
81
|
+
},
|
|
82
|
+
{ internalType: 'bytes', name: '_affiliateFee', type: 'bytes' },
|
|
83
|
+
{ internalType: 'uint32', name: '_referralCode', type: 'uint32' },
|
|
84
|
+
{ internalType: 'bytes', name: '_permit', type: 'bytes' },
|
|
85
|
+
],
|
|
86
|
+
name: 'createOrder',
|
|
87
|
+
outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }],
|
|
88
|
+
stateMutability: 'payable',
|
|
89
|
+
type: 'function',
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
exports.ERC20_ABI = [
|
|
93
|
+
{
|
|
94
|
+
constant: true,
|
|
95
|
+
inputs: [{ name: '_owner', type: 'address' }],
|
|
96
|
+
name: 'balanceOf',
|
|
97
|
+
outputs: [{ name: 'balance', type: 'uint256' }],
|
|
98
|
+
type: 'function',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
constant: true,
|
|
102
|
+
inputs: [
|
|
103
|
+
{ name: '_owner', type: 'address' },
|
|
104
|
+
{ name: '_spender', type: 'address' },
|
|
105
|
+
],
|
|
106
|
+
name: 'allowance',
|
|
107
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
108
|
+
type: 'function',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
constant: false,
|
|
112
|
+
inputs: [
|
|
113
|
+
{ name: '_spender', type: 'address' },
|
|
114
|
+
{ name: '_value', type: 'uint256' },
|
|
115
|
+
],
|
|
116
|
+
name: 'approve',
|
|
117
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
118
|
+
type: 'function',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
constant: true,
|
|
122
|
+
inputs: [],
|
|
123
|
+
name: 'decimals',
|
|
124
|
+
outputs: [{ name: '', type: 'uint8' }],
|
|
125
|
+
type: 'function',
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
function isNativeToken(tokenAddress) {
|
|
129
|
+
return tokenAddress.toLowerCase() === exports.NATIVE_TOKEN_ADDRESS.toLowerCase();
|
|
130
|
+
}
|
|
131
|
+
function getChainName(chainId) {
|
|
132
|
+
return exports.CHAIN_NAMES[chainId] || `Chain ${chainId}`;
|
|
133
|
+
}
|
|
134
|
+
async function getTokenBalance(provider, tokenAddress, userAddress) {
|
|
135
|
+
if (isNativeToken(tokenAddress)) {
|
|
136
|
+
return await provider.getBalance(userAddress);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const tokenContract = new ethers_1.ethers.Contract(tokenAddress, exports.ERC20_ABI, provider);
|
|
140
|
+
return await tokenContract.balanceOf(userAddress);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
async function getTokenDecimals(provider, tokenAddress) {
|
|
144
|
+
if (isNativeToken(tokenAddress)) {
|
|
145
|
+
return 18;
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const tokenContract = new ethers_1.ethers.Contract(tokenAddress, exports.ERC20_ABI, provider);
|
|
149
|
+
return await tokenContract.decimals();
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async function checkAndApproveToken(provider, tokenAddress, ownerAddress, spenderAddress, amount) {
|
|
153
|
+
if (isNativeToken(tokenAddress)) {
|
|
154
|
+
return {
|
|
155
|
+
needsApproval: false,
|
|
156
|
+
currentAllowance: ethers_1.ethers.constants.MaxUint256,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const tokenContract = new ethers_1.ethers.Contract(tokenAddress, exports.ERC20_ABI, provider);
|
|
160
|
+
const currentAllowance = await tokenContract.allowance(ownerAddress, spenderAddress);
|
|
161
|
+
return {
|
|
162
|
+
needsApproval: currentAllowance.lt(amount),
|
|
163
|
+
currentAllowance,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function validateChainId(chainId) {
|
|
167
|
+
return Object.values(exports.CHAIN_IDS).includes(chainId);
|
|
168
|
+
}
|
|
169
|
+
function validateAddress(address) {
|
|
170
|
+
try {
|
|
171
|
+
ethers_1.ethers.utils.getAddress(address);
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
async function callDeBridgeAPI(endpoint, method = 'GET', data) {
|
|
179
|
+
let url = `${exports.DEBRIDGE_API_URL}${endpoint}`;
|
|
180
|
+
const options = {
|
|
181
|
+
method,
|
|
182
|
+
headers: {
|
|
183
|
+
'Content-Type': 'application/json',
|
|
184
|
+
Accept: 'application/json',
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
if (method === 'GET' && data && typeof data === 'object') {
|
|
188
|
+
const params = new URLSearchParams();
|
|
189
|
+
for (const key in data) {
|
|
190
|
+
if (data[key] !== undefined && data[key] !== null) {
|
|
191
|
+
params.append(key, String(data[key]));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const paramString = params.toString();
|
|
195
|
+
if (paramString) {
|
|
196
|
+
url += (url.includes('?') ? '&' : '?') + paramString;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
else if (data && method !== 'GET') {
|
|
200
|
+
options.body = JSON.stringify(data);
|
|
201
|
+
}
|
|
202
|
+
console.log(`Fetching debridge API URL:`, url);
|
|
203
|
+
const response = await fetch(url, options);
|
|
204
|
+
if (!response.ok) {
|
|
205
|
+
const errorText = await response.text();
|
|
206
|
+
throw new Error(`DeBridge API error: ${response.status} - ${errorText}`);
|
|
207
|
+
}
|
|
208
|
+
return await response.json();
|
|
209
|
+
}
|
|
210
|
+
function formatAmount(amount, decimals) {
|
|
211
|
+
try {
|
|
212
|
+
const formatted = ethers_1.ethers.utils.formatUnits(amount, decimals);
|
|
213
|
+
return formatted;
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return amount;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
function parseAmount(amount, decimals) {
|
|
220
|
+
try {
|
|
221
|
+
const parsed = ethers_1.ethers.utils.parseUnits(amount, decimals);
|
|
222
|
+
return parsed.toString();
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
throw new Error(`Invalid amount format: ${amount}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async function getRpcUrl(chainId) {
|
|
229
|
+
// Try to find the chain entry in LIT_EVM_CHAINS with matching chainId
|
|
230
|
+
for (const [chainKey, chainData] of Object.entries(constants_1.LIT_EVM_CHAINS)) {
|
|
231
|
+
// LIT_EVM_CHAINS chainId is a number, input is string
|
|
232
|
+
if (String(chainData.chainId) === String(chainId)) {
|
|
233
|
+
// Return the first rpcUrl if available
|
|
234
|
+
if (Array.isArray(chainData.rpcUrls) && chainData.rpcUrls.length > 0) {
|
|
235
|
+
return await Lit.Actions.getRpcUrl({ chain: chainKey });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
throw new Error(`ChainId ${chainId} not found in LIT_EVM_CHAINS`);
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/helpers/index.ts"],"names":[],"mappings":";;;AAyHA,sCAEC;AAED,oCAEC;AAED,0CAWC;AAED,4CAUC;AAED,oDAqBC;AAED,0CAEC;AAED,0CAOC;AAED,0CAmCC;AAED,oCAOC;AAED,kCAOC;AAED,8BAYC;AAjQD,mCAAgC;AAChC,uDAAyD;AAE5C,QAAA,oBAAoB,GAAG,4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AAM,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;YAClD,uCAAuC;YACvC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrE,OAAO,MAAM,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;YAC1D,CAAC;QACH,CAAC;IACH,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,WAAW,OAAO,8BAA8B,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-action.d.ts","sourceRoot":"","sources":["../../../src/lib/lit-action.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vincent_ability_sdk_1 = require("@lit-protocol/vincent-ability-sdk");
|
|
4
|
+
// FIXME: This should be generated code
|
|
5
|
+
const vincent_ability_1 = require("src/lib/vincent-ability");
|
|
6
|
+
(async () => {
|
|
7
|
+
const func = (0, vincent_ability_sdk_1.vincentAbilityHandler)({
|
|
8
|
+
vincentAbility: vincent_ability_1.vincentAbility,
|
|
9
|
+
context: {
|
|
10
|
+
delegatorPkpEthAddress: context.delegatorPkpEthAddress,
|
|
11
|
+
},
|
|
12
|
+
abilityParams,
|
|
13
|
+
});
|
|
14
|
+
await func();
|
|
15
|
+
})();
|
|
16
|
+
//# sourceMappingURL=lit-action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lit-action.js","sourceRoot":"","sources":["../../../src/lib/lit-action.ts"],"names":[],"mappings":";;AAAA,2EAA0E;AAG1E,uCAAuC;AAEvC,6DAAyD;AAQzD,CAAC,KAAK,IAAI,EAAE;IACV,MAAM,IAAI,GAAG,IAAA,2CAAqB,EAAC;QACjC,cAAc,EAAE,gCAAc;QAC9B,OAAO,EAAE;YACP,sBAAsB,EAAE,OAAO,CAAC,sBAAsB;SACvD;QACD,aAAa;KACd,CAAC,CAAC;IACH,MAAM,IAAI,EAAE,CAAC;AACf,CAAC,CAAC,EAAE,CAAC"}
|