@1stdex/first-sdk 1.0.90-beta.1 → 1.0.90
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/dist/cjs/calls/batch/index.js +2 -3
- package/dist/cjs/calls/batch/index.js.map +1 -1
- package/dist/cjs/calls/batch/prepare-claim-real-tokens.js +41 -99
- package/dist/cjs/calls/batch/prepare-claim-real-tokens.js.map +1 -1
- package/dist/cjs/calls/index.js +2 -3
- package/dist/cjs/calls/index.js.map +1 -1
- package/dist/cjs/constants/abis/core/erc20.js +33 -0
- package/dist/cjs/constants/abis/core/erc20.js.map +1 -0
- package/dist/cjs/constants/abis/core/layer-zero-sponsor.js +514 -0
- package/dist/cjs/constants/abis/core/layer-zero-sponsor.js.map +1 -0
- package/dist/cjs/constants/chain-configs/addresses.js +4 -0
- package/dist/cjs/constants/chain-configs/addresses.js.map +1 -1
- package/dist/esm/calls/batch/index.js +1 -1
- package/dist/esm/calls/batch/index.js.map +1 -1
- package/dist/esm/calls/batch/prepare-claim-real-tokens.js +50 -134
- package/dist/esm/calls/batch/prepare-claim-real-tokens.js.map +1 -1
- package/dist/esm/calls/index.js +1 -1
- package/dist/esm/calls/index.js.map +1 -1
- package/dist/esm/constants/abis/core/erc20.js +30 -0
- package/dist/esm/constants/abis/core/erc20.js.map +1 -0
- package/dist/esm/constants/abis/core/layer-zero-sponsor.js +511 -0
- package/dist/esm/constants/abis/core/layer-zero-sponsor.js.map +1 -0
- package/dist/esm/constants/chain-configs/addresses.js +4 -0
- package/dist/esm/constants/chain-configs/addresses.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/calls/batch/index.d.ts +1 -1
- package/dist/types/calls/batch/index.d.ts.map +1 -1
- package/dist/types/calls/batch/prepare-claim-real-tokens.d.ts +6 -38
- package/dist/types/calls/batch/prepare-claim-real-tokens.d.ts.map +1 -1
- package/dist/types/calls/index.d.ts +1 -1
- package/dist/types/calls/index.d.ts.map +1 -1
- package/dist/types/constants/abis/core/erc20.d.ts +52 -0
- package/dist/types/constants/abis/core/erc20.d.ts.map +1 -0
- package/dist/types/constants/abis/core/layer-zero-sponsor.d.ts +399 -0
- package/dist/types/constants/abis/core/layer-zero-sponsor.d.ts.map +1 -0
- package/dist/types/constants/chain-configs/addresses.d.ts +1 -0
- package/dist/types/constants/chain-configs/addresses.d.ts.map +1 -1
- package/dist/types/views/address.d.ts +1 -0
- package/dist/types/views/address.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotEnoughClaimableError = exports.
|
|
3
|
+
exports.NotEnoughClaimableError = exports.prepareClaimRealTokensCrossChainBridgeLZ = exports.NotEnoughFundsError = exports.prepareWithdraw = exports.prepareMarketOrderWithSetup = exports.prepareLimitOrderWithSetup = void 0;
|
|
4
4
|
var prepare_limit_order_with_setup_1 = require("./prepare-limit-order-with-setup");
|
|
5
5
|
Object.defineProperty(exports, "prepareLimitOrderWithSetup", { enumerable: true, get: function () { return prepare_limit_order_with_setup_1.prepareLimitOrderWithSetup; } });
|
|
6
6
|
var prepare_market_order_with_setup_1 = require("./prepare-market-order-with-setup");
|
|
@@ -9,7 +9,6 @@ var prepare_withdraw_1 = require("./prepare-withdraw");
|
|
|
9
9
|
Object.defineProperty(exports, "prepareWithdraw", { enumerable: true, get: function () { return prepare_withdraw_1.prepareWithdraw; } });
|
|
10
10
|
Object.defineProperty(exports, "NotEnoughFundsError", { enumerable: true, get: function () { return prepare_withdraw_1.NotEnoughFundsError; } });
|
|
11
11
|
var prepare_claim_real_tokens_1 = require("./prepare-claim-real-tokens");
|
|
12
|
-
Object.defineProperty(exports, "
|
|
13
|
-
Object.defineProperty(exports, "prepareClaimRealTokensCrossChainLZ", { enumerable: true, get: function () { return prepare_claim_real_tokens_1.prepareClaimRealTokensCrossChainLZ; } });
|
|
12
|
+
Object.defineProperty(exports, "prepareClaimRealTokensCrossChainBridgeLZ", { enumerable: true, get: function () { return prepare_claim_real_tokens_1.prepareClaimRealTokensCrossChainBridgeLZ; } });
|
|
14
13
|
Object.defineProperty(exports, "NotEnoughClaimableError", { enumerable: true, get: function () { return prepare_claim_real_tokens_1.NotEnoughClaimableError; } });
|
|
15
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/calls/batch/index.ts"],"names":[],"mappings":";;;AAAA,mFAA8E;AAArE,4IAAA,0BAA0B,OAAA;AACnC,qFAAgF;AAAvE,8IAAA,2BAA2B,OAAA;AACpC,uDAA0E;AAAjE,mHAAA,eAAe,OAAA;AAAE,uHAAA,mBAAmB,OAAA;AAC7C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/calls/batch/index.ts"],"names":[],"mappings":";;;AAAA,mFAA8E;AAArE,4IAAA,0BAA0B,OAAA;AACnC,qFAAgF;AAAvE,8IAAA,2BAA2B,OAAA;AACpC,uDAA0E;AAAjE,mHAAA,eAAe,OAAA;AAAE,uHAAA,mBAAmB,OAAA;AAC7C,yEAGqC;AAFnC,qJAAA,wCAAwC,OAAA;AACxC,oIAAA,uBAAuB,OAAA"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.prepareClaimRealTokensCrossChainBridgeLZ = exports.NotEnoughClaimableError = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const chain_1 = require("../../constants/chain-configs/chain");
|
|
6
6
|
const eids_1 = require("../../constants/chain-configs/eids");
|
|
7
7
|
const claimable_dex_vault_abi_1 = require("../../constants/abis/core/claimable-dex-vault-abi");
|
|
8
8
|
const mirror_token_abi_1 = require("../../constants/abis/core/mirror-token-abi");
|
|
9
|
-
const
|
|
9
|
+
const layer_zero_sponsor_1 = require("../../constants/abis/core/layer-zero-sponsor");
|
|
10
|
+
const addresses_1 = require("../../constants/chain-configs/addresses");
|
|
11
|
+
const erc20_1 = require("../../constants/abis/core/erc20");
|
|
10
12
|
const vault_1 = require("../../views/vault");
|
|
11
13
|
class NotEnoughClaimableError extends Error {
|
|
12
14
|
constructor(message, required, available) {
|
|
@@ -28,7 +30,7 @@ class NotEnoughClaimableError extends Error {
|
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
exports.NotEnoughClaimableError = NotEnoughClaimableError;
|
|
31
|
-
const
|
|
33
|
+
const prepareClaimRealTokensCrossChainBridgeLZ = async ({ chainId, destinationChainId, userAddress, mirrorTokenAddress, receivingAddress, amount, options, }) => {
|
|
32
34
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
33
35
|
chain: chain_1.CHAIN_MAP[chainId],
|
|
34
36
|
transport: options?.rpcUrl ? (0, viem_1.http)(options.rpcUrl) : (0, viem_1.http)(),
|
|
@@ -38,6 +40,12 @@ const prepareClaimRealTokensSameChain = async ({ chainId, userAddress, mirrorTok
|
|
|
38
40
|
tokenAddress: mirrorTokenAddress,
|
|
39
41
|
...(options?.rpcUrl && { options: { rpcUrl: options.rpcUrl } }),
|
|
40
42
|
});
|
|
43
|
+
const layerZeroSponsor = addresses_1.CONTRACT_ADDRESSES[chainId].LayerZeroSponsor;
|
|
44
|
+
const realTokenAddress = await publicClient.readContract({
|
|
45
|
+
address: mirrorTokenAddress,
|
|
46
|
+
abi: mirror_token_abi_1.MIRROR_TOKEN_ABI,
|
|
47
|
+
functionName: 'realToken',
|
|
48
|
+
});
|
|
41
49
|
const contracts = [
|
|
42
50
|
{
|
|
43
51
|
address: vault.address,
|
|
@@ -51,96 +59,27 @@ const prepareClaimRealTokensSameChain = async ({ chainId, userAddress, mirrorTok
|
|
|
51
59
|
functionName: 'getClaimableAmount',
|
|
52
60
|
args: [userAddress],
|
|
53
61
|
},
|
|
54
|
-
];
|
|
55
|
-
const results = await publicClient.multicall({
|
|
56
|
-
contracts,
|
|
57
|
-
});
|
|
58
|
-
const vaultClaimableAmount = results[0].result || 0n;
|
|
59
|
-
const mirrorTokenClaimableAmount = results[1].result || 0n;
|
|
60
|
-
const calls = [];
|
|
61
|
-
if (vaultClaimableAmount > 0n) {
|
|
62
|
-
calls.push({
|
|
63
|
-
to: vault.address,
|
|
64
|
-
data: (0, viem_1.encodeFunctionData)({
|
|
65
|
-
abi: mirror_token_abi_1.MIRROR_TOKEN_ABI,
|
|
66
|
-
functionName: 'claim',
|
|
67
|
-
args: [userAddress, vaultClaimableAmount],
|
|
68
|
-
}),
|
|
69
|
-
value: 0n,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
const totalClaimableAmount = vaultClaimableAmount + mirrorTokenClaimableAmount;
|
|
73
|
-
if (totalClaimableAmount > 0n) {
|
|
74
|
-
calls.push({
|
|
75
|
-
to: mirrorTokenAddress,
|
|
76
|
-
data: (0, viem_1.encodeFunctionData)({
|
|
77
|
-
abi: mirror_token_abi_1.MIRROR_TOKEN_ABI,
|
|
78
|
-
functionName: 'claim',
|
|
79
|
-
args: [receivingAddress, totalClaimableAmount],
|
|
80
|
-
}),
|
|
81
|
-
value: 0n,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return calls;
|
|
85
|
-
};
|
|
86
|
-
exports.prepareClaimRealTokensSameChain = prepareClaimRealTokensSameChain;
|
|
87
|
-
const prepareClaimRealTokensCrossChainLZ = async ({ chainId, destinationChainId, userAddress, mirrorTokenAddress, receivingAddress, amount, options, }) => {
|
|
88
|
-
const publicClient = (0, viem_1.createPublicClient)({
|
|
89
|
-
chain: chain_1.CHAIN_MAP[chainId],
|
|
90
|
-
transport: options?.rpcUrl ? (0, viem_1.http)(options.rpcUrl) : (0, viem_1.http)(),
|
|
91
|
-
});
|
|
92
|
-
const vault = await (0, vault_1.getVault)({
|
|
93
|
-
chainId,
|
|
94
|
-
tokenAddress: mirrorTokenAddress,
|
|
95
|
-
...(options?.rpcUrl && { options: { rpcUrl: options.rpcUrl } }),
|
|
96
|
-
});
|
|
97
|
-
const ERC20_ABI = [
|
|
98
62
|
{
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
stateMutability: 'view',
|
|
103
|
-
type: 'function',
|
|
104
|
-
},
|
|
105
|
-
];
|
|
106
|
-
const initialContracts = [
|
|
107
|
-
{
|
|
108
|
-
address: vault.address,
|
|
109
|
-
abi: claimable_dex_vault_abi_1.CLAIMABLE_DEX_VAULT_ABI,
|
|
110
|
-
functionName: 'getClaimableAssets',
|
|
111
|
-
args: [userAddress],
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
address: mirrorTokenAddress,
|
|
115
|
-
abi: mirror_token_abi_1.MIRROR_TOKEN_ABI,
|
|
116
|
-
functionName: 'getClaimableAmount',
|
|
63
|
+
address: realTokenAddress,
|
|
64
|
+
abi: erc20_1.ERC20_ABI,
|
|
65
|
+
functionName: 'balanceOf',
|
|
117
66
|
args: [userAddress],
|
|
118
67
|
},
|
|
119
|
-
{
|
|
120
|
-
address: mirrorTokenAddress,
|
|
121
|
-
abi: mirror_token_abi_1.MIRROR_TOKEN_ABI,
|
|
122
|
-
functionName: 'realToken',
|
|
123
|
-
},
|
|
124
|
-
];
|
|
125
|
-
const initialResults = await publicClient.multicall({
|
|
126
|
-
contracts: initialContracts,
|
|
127
|
-
});
|
|
128
|
-
const vaultClaimableAmount = initialResults[0].result || 0n;
|
|
129
|
-
const mirrorTokenClaimableAmount = initialResults[1].result || 0n;
|
|
130
|
-
const realTokenAddress = initialResults[2].result;
|
|
131
|
-
const totalClaimableAmount = vaultClaimableAmount + mirrorTokenClaimableAmount;
|
|
132
|
-
const balanceContracts = [
|
|
133
68
|
{
|
|
134
69
|
address: realTokenAddress,
|
|
135
|
-
abi: ERC20_ABI,
|
|
136
|
-
functionName: '
|
|
137
|
-
args: [userAddress],
|
|
70
|
+
abi: erc20_1.ERC20_ABI,
|
|
71
|
+
functionName: 'allowance',
|
|
72
|
+
args: [userAddress, layerZeroSponsor],
|
|
138
73
|
},
|
|
139
74
|
];
|
|
140
|
-
const
|
|
141
|
-
contracts
|
|
75
|
+
const results = await publicClient.multicall({
|
|
76
|
+
contracts,
|
|
142
77
|
});
|
|
143
|
-
const
|
|
78
|
+
const vaultClaimableAmount = results[0].result || 0n;
|
|
79
|
+
const mirrorTokenClaimableAmount = results[1].result || 0n;
|
|
80
|
+
const realTokenBalance = results[2].result || 0n;
|
|
81
|
+
const currentAllowance = results[3].result || 0n;
|
|
82
|
+
const totalClaimableAmount = vaultClaimableAmount + mirrorTokenClaimableAmount;
|
|
144
83
|
const amountNeededToClaim = amount > realTokenBalance ? amount - realTokenBalance : 0n;
|
|
145
84
|
if (amountNeededToClaim > totalClaimableAmount) {
|
|
146
85
|
throw new NotEnoughClaimableError(`Insufficient funds: need ${amount} total, have ${realTokenBalance} in wallet, need to claim ${amountNeededToClaim}, but only ${totalClaimableAmount} claimable (mirror token: ${mirrorTokenClaimableAmount}, vault: ${vaultClaimableAmount})`, amountNeededToClaim, totalClaimableAmount);
|
|
@@ -182,6 +121,17 @@ const prepareClaimRealTokensCrossChainLZ = async ({ chainId, destinationChainId,
|
|
|
182
121
|
}
|
|
183
122
|
}
|
|
184
123
|
}
|
|
124
|
+
if (currentAllowance < amount) {
|
|
125
|
+
calls.push({
|
|
126
|
+
to: realTokenAddress,
|
|
127
|
+
data: (0, viem_1.encodeFunctionData)({
|
|
128
|
+
abi: erc20_1.ERC20_ABI,
|
|
129
|
+
functionName: 'approve',
|
|
130
|
+
args: [layerZeroSponsor, amount],
|
|
131
|
+
}),
|
|
132
|
+
value: 0n,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
185
135
|
const receivingAddressBytes32 = `0x000000000000000000000000${receivingAddress.slice(2)}`;
|
|
186
136
|
const destinationEid = eids_1.CHAIN_EIDS[destinationChainId];
|
|
187
137
|
const sendParam = {
|
|
@@ -193,28 +143,20 @@ const prepareClaimRealTokensCrossChainLZ = async ({ chainId, destinationChainId,
|
|
|
193
143
|
composeMsg: '0x',
|
|
194
144
|
oftCmd: '0x',
|
|
195
145
|
};
|
|
196
|
-
const quoteFee = await publicClient.readContract({
|
|
197
|
-
address: realTokenAddress,
|
|
198
|
-
abi: first_oft_1.FIRST_OFT_ABI,
|
|
199
|
-
functionName: 'quoteSend',
|
|
200
|
-
args: [sendParam, false],
|
|
201
|
-
});
|
|
202
|
-
console.log('sendparam', sendParam);
|
|
203
|
-
console.log('quoteFee', quoteFee);
|
|
204
146
|
calls.push({
|
|
205
|
-
to:
|
|
147
|
+
to: layerZeroSponsor,
|
|
206
148
|
data: (0, viem_1.encodeFunctionData)({
|
|
207
|
-
abi:
|
|
208
|
-
functionName: '
|
|
149
|
+
abi: layer_zero_sponsor_1.LAYER_ZERO_SPONSOR_ABI,
|
|
150
|
+
functionName: 'sponsorBridge',
|
|
209
151
|
args: [
|
|
152
|
+
realTokenAddress,
|
|
210
153
|
sendParam,
|
|
211
|
-
{ nativeFee: quoteFee.nativeFee, lzTokenFee: 0n },
|
|
212
154
|
userAddress,
|
|
213
155
|
],
|
|
214
156
|
}),
|
|
215
|
-
value:
|
|
157
|
+
value: 0n,
|
|
216
158
|
});
|
|
217
159
|
return calls;
|
|
218
160
|
};
|
|
219
|
-
exports.
|
|
161
|
+
exports.prepareClaimRealTokensCrossChainBridgeLZ = prepareClaimRealTokensCrossChainBridgeLZ;
|
|
220
162
|
//# sourceMappingURL=prepare-claim-real-tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-claim-real-tokens.js","sourceRoot":"","sources":["../../../../src/calls/batch/prepare-claim-real-tokens.ts"],"names":[],"mappings":";;;AAAA,+BAAoE;AAEpE,+DAA2E;AAC3E,6DAAgE;AAChE,+FAA4F;AAC5F,iFAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"prepare-claim-real-tokens.js","sourceRoot":"","sources":["../../../../src/calls/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,CAAC;oBACF,KAAK,EAAE,EAAE;iBACV,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IAGD,IAAI,gBAAgB,GAAG,MAAM,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CAAC;YACT,EAAE,EAAE,gBAAgB;YACpB,IAAI,EAAE,IAAA,yBAAkB,EAAC;gBACvB,GAAG,EAAE,iBAAS;gBACd,YAAY,EAAE,SAAS;gBACvB,IAAI,EAAE,CAAC,gBAAgB,EAAE,MAAM,CAAC;aACjC,CAAC;YACF,KAAK,EAAE,EAAE;SACV,CAAC,CAAC;IACL,CAAC;IAGD,MAAM,uBAAuB,GAC3B,6BAA6B,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAmB,CAAC;IAG5E,MAAM,cAAc,GAAG,iBAAU,CAAC,kBAAkB,CAAC,CAAC;IAGtD,MAAM,SAAS,GAAG;QAChB,MAAM,EAAE,cAAc;QACtB,EAAE,EAAE,uBAAuB;QAC3B,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,MAAM;QACnB,YAAY,EAAE,IAAqB;QACnC,UAAU,EAAE,IAAqB;QACjC,MAAM,EAAE,IAAqB;KAC9B,CAAC;IAGF,KAAK,CAAC,IAAI,CAAC;QACT,EAAE,EAAE,gBAAgB;QACpB,IAAI,EAAE,IAAA,yBAAkB,EAAC;YACvB,GAAG,EAAE,2CAAsB;YAC3B,YAAY,EAAE,eAAe;YAC7B,IAAI,EAAE;gBACJ,gBAAgB;gBAChB,SAAS;gBACT,WAAW;aACZ;SACF,CAAC;QACF,KAAK,EAAE,EAAE;KACV,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAtLW,QAAA,wCAAwC,4CAsLnD"}
|
package/dist/cjs/calls/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotEnoughClaimableError = exports.
|
|
3
|
+
exports.NotEnoughClaimableError = exports.prepareClaimRealTokensCrossChainBridgeLZ = exports.NotEnoughFundsError = exports.prepareWithdraw = exports.prepareMarketOrderWithSetup = exports.prepareLimitOrderWithSetup = exports.withdrawFromVault = exports.depositToVault = exports.removeVault = exports.setVault = exports.approveAllForMarket = exports.setTokenAllowances = exports.setApprovalOfOpenOrdersForAll = exports.cancelOrders = exports.cancelOrder = exports.claimOrders = exports.claimOrder = exports.ZeroTakenAmountError = exports.InsufficientLiquidityError = exports.marketOrder = exports.limitOrder = exports.placeMarketMakingQuotes = exports.openMarket = void 0;
|
|
4
4
|
var open_1 = require("./market/open");
|
|
5
5
|
Object.defineProperty(exports, "openMarket", { enumerable: true, get: function () { return open_1.openMarket; } });
|
|
6
6
|
var make_1 = require("./market/make");
|
|
@@ -33,7 +33,6 @@ Object.defineProperty(exports, "prepareLimitOrderWithSetup", { enumerable: true,
|
|
|
33
33
|
Object.defineProperty(exports, "prepareMarketOrderWithSetup", { enumerable: true, get: function () { return batch_1.prepareMarketOrderWithSetup; } });
|
|
34
34
|
Object.defineProperty(exports, "prepareWithdraw", { enumerable: true, get: function () { return batch_1.prepareWithdraw; } });
|
|
35
35
|
Object.defineProperty(exports, "NotEnoughFundsError", { enumerable: true, get: function () { return batch_1.NotEnoughFundsError; } });
|
|
36
|
-
Object.defineProperty(exports, "
|
|
37
|
-
Object.defineProperty(exports, "prepareClaimRealTokensCrossChainLZ", { enumerable: true, get: function () { return batch_1.prepareClaimRealTokensCrossChainLZ; } });
|
|
36
|
+
Object.defineProperty(exports, "prepareClaimRealTokensCrossChainBridgeLZ", { enumerable: true, get: function () { return batch_1.prepareClaimRealTokensCrossChainBridgeLZ; } });
|
|
38
37
|
Object.defineProperty(exports, "NotEnoughClaimableError", { enumerable: true, get: function () { return batch_1.NotEnoughClaimableError; } });
|
|
39
38
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/calls/index.ts"],"names":[],"mappings":";;;AAAA,sCAA2C;AAAlC,kGAAA,UAAU,OAAA;AACnB,sCAAwD;AAA/C,+GAAA,uBAAuB,OAAA;AAChC,wCAA4C;AAAnC,mGAAA,UAAU,OAAA;AACnB,0CAIyB;AAHvB,qGAAA,WAAW,OAAA;AACX,oHAAA,0BAA0B,OAAA;AAC1B,8GAAA,oBAAoB,OAAA;AAEtB,wCAAyD;AAAhD,mGAAA,UAAU,OAAA;AAAE,oGAAA,WAAW,OAAA;AAChC,0CAA4D;AAAnD,qGAAA,WAAW,OAAA;AAAE,sGAAA,YAAY,OAAA;AAElC,oDAAsE;AAA7D,2HAAA,6BAA6B,OAAA;AACtC,0CAAsD;AAA7C,2GAAA,kBAAkB,OAAA;AAC3B,4CAAwD;AAA/C,6GAAA,mBAAmB,OAAA;AAE5B,iCAKiB;AAJf,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,uGAAA,cAAc,OAAA;AACd,0GAAA,iBAAiB,OAAA;AAGnB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/calls/index.ts"],"names":[],"mappings":";;;AAAA,sCAA2C;AAAlC,kGAAA,UAAU,OAAA;AACnB,sCAAwD;AAA/C,+GAAA,uBAAuB,OAAA;AAChC,wCAA4C;AAAnC,mGAAA,UAAU,OAAA;AACnB,0CAIyB;AAHvB,qGAAA,WAAW,OAAA;AACX,oHAAA,0BAA0B,OAAA;AAC1B,8GAAA,oBAAoB,OAAA;AAEtB,wCAAyD;AAAhD,mGAAA,UAAU,OAAA;AAAE,oGAAA,WAAW,OAAA;AAChC,0CAA4D;AAAnD,qGAAA,WAAW,OAAA;AAAE,sGAAA,YAAY,OAAA;AAElC,oDAAsE;AAA7D,2HAAA,6BAA6B,OAAA;AACtC,0CAAsD;AAA7C,2GAAA,kBAAkB,OAAA;AAC3B,4CAAwD;AAA/C,6GAAA,mBAAmB,OAAA;AAE5B,iCAKiB;AAJf,iGAAA,QAAQ,OAAA;AACR,oGAAA,WAAW,OAAA;AACX,uGAAA,cAAc,OAAA;AACd,0GAAA,iBAAiB,OAAA;AAGnB,iCAOiB;AANf,mHAAA,0BAA0B,OAAA;AAC1B,oHAAA,2BAA2B,OAAA;AAC3B,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,iIAAA,wCAAwC,OAAA;AACxC,gHAAA,uBAAuB,OAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ERC20_ABI = void 0;
|
|
4
|
+
exports.ERC20_ABI = [
|
|
5
|
+
{
|
|
6
|
+
inputs: [{ internalType: 'address', name: 'account', type: 'address' }],
|
|
7
|
+
name: 'balanceOf',
|
|
8
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
9
|
+
stateMutability: 'view',
|
|
10
|
+
type: 'function',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
inputs: [
|
|
14
|
+
{ internalType: 'address', name: 'owner', type: 'address' },
|
|
15
|
+
{ internalType: 'address', name: 'spender', type: 'address' },
|
|
16
|
+
],
|
|
17
|
+
name: 'allowance',
|
|
18
|
+
outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
|
|
19
|
+
stateMutability: 'view',
|
|
20
|
+
type: 'function',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
inputs: [
|
|
24
|
+
{ internalType: 'address', name: 'spender', type: 'address' },
|
|
25
|
+
{ internalType: 'uint256', name: 'amount', type: 'uint256' },
|
|
26
|
+
],
|
|
27
|
+
name: 'approve',
|
|
28
|
+
outputs: [{ internalType: 'bool', name: '', type: 'bool' }],
|
|
29
|
+
stateMutability: 'nonpayable',
|
|
30
|
+
type: 'function',
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
//# sourceMappingURL=erc20.js.map
|
|
@@ -0,0 +1 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