@1stdex/first-sdk 1.0.4 → 1.0.5
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/approval/order.js +10 -16
- package/dist/cjs/calls/approval/order.js.map +1 -1
- package/dist/cjs/calls/approval/token.js +31 -104
- package/dist/cjs/calls/approval/token.js.map +1 -1
- package/dist/esm/calls/approval/order.js +26 -45
- package/dist/esm/calls/approval/order.js.map +1 -1
- package/dist/esm/calls/approval/token.js +44 -129
- package/dist/esm/calls/approval/token.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/calls/approval/order.d.ts +23 -36
- package/dist/types/calls/approval/order.d.ts.map +1 -1
- package/dist/types/calls/approval/token.d.ts +16 -18
- package/dist/types/calls/approval/token.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -4,17 +4,15 @@ exports.approveControllerAsOrderOperator = exports.setOrderOperatorApproval = vo
|
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const chain_1 = require("../../constants/chain-configs/chain");
|
|
6
6
|
const addresses_1 = require("../../constants/chain-configs/addresses");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
throw new Error('Account is not found');
|
|
10
|
-
}
|
|
7
|
+
const build_transaction_1 = require("../../utils/build-transaction");
|
|
8
|
+
const setOrderOperatorApproval = async ({ chainId, userAddress, operator, approved, options, }) => {
|
|
11
9
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
12
10
|
chain: chain_1.CHAIN_MAP[chainId],
|
|
13
11
|
transport: options?.rpcUrl ? (0, viem_1.http)(options.rpcUrl) : (0, viem_1.http)(),
|
|
14
12
|
});
|
|
15
|
-
|
|
16
|
-
account: walletClient.account,
|
|
13
|
+
return (0, build_transaction_1.buildTransaction)(publicClient, {
|
|
17
14
|
chain: chain_1.CHAIN_MAP[chainId],
|
|
15
|
+
account: userAddress,
|
|
18
16
|
address: addresses_1.CONTRACT_ADDRESSES[chainId].BookManager,
|
|
19
17
|
abi: [
|
|
20
18
|
{
|
|
@@ -38,21 +36,17 @@ const setOrderOperatorApproval = async ({ chainId, walletClient, operator, appro
|
|
|
38
36
|
],
|
|
39
37
|
functionName: 'setOrderOperator',
|
|
40
38
|
args: [operator, approved],
|
|
41
|
-
});
|
|
42
|
-
return walletClient.writeContract(request);
|
|
39
|
+
}, options?.gasLimit);
|
|
43
40
|
};
|
|
44
41
|
exports.setOrderOperatorApproval = setOrderOperatorApproval;
|
|
45
|
-
const approveControllerAsOrderOperator = async ({ chainId,
|
|
46
|
-
|
|
42
|
+
const approveControllerAsOrderOperator = async ({ chainId, userAddress, options, }) => {
|
|
43
|
+
return (0, exports.setOrderOperatorApproval)({
|
|
47
44
|
chainId,
|
|
48
|
-
|
|
45
|
+
userAddress,
|
|
49
46
|
operator: addresses_1.CONTRACT_ADDRESSES[chainId].Controller,
|
|
50
47
|
approved: true,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
params.options = options;
|
|
54
|
-
}
|
|
55
|
-
return (0, exports.setOrderOperatorApproval)(params);
|
|
48
|
+
...(options && { options }),
|
|
49
|
+
});
|
|
56
50
|
};
|
|
57
51
|
exports.approveControllerAsOrderOperator = approveControllerAsOrderOperator;
|
|
58
52
|
//# sourceMappingURL=order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../../src/calls/approval/order.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../../src/calls/approval/order.ts"],"names":[],"mappings":";;;AAAA,+BAAgD;AAEhD,+DAA2E;AAE3E,uEAA6E;AAC7E,qEAAiE;AAwB1D,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAC7C,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,GAOR,EAAwB,EAAE;IACzB,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;QACtC,KAA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 const apis_1 = require("../../entities/currency/apis");
|
|
|
7
7
|
const allowance_1 = require("../../entities/currency/apis/allowance");
|
|
8
8
|
const addresses_1 = require("../../constants/chain-configs/addresses");
|
|
9
9
|
const vault_1 = require("../../views/vault");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
throw new Error('Account is not found');
|
|
13
|
-
}
|
|
10
|
+
const build_transaction_1 = require("../../utils/build-transaction");
|
|
11
|
+
const setTokenAllowances = async ({ chainId, userAddress, tokenAddress, options, }) => {
|
|
14
12
|
const publicClient = (0, viem_1.createPublicClient)({
|
|
15
13
|
chain: chain_1.CHAIN_MAP[chainId],
|
|
16
14
|
transport: options?.rpcUrl ? (0, viem_1.http)(options.rpcUrl) : (0, viem_1.http)(),
|
|
@@ -29,9 +27,9 @@ const setTokenAllowances = async ({ chainId, walletClient, tokenAddress, options
|
|
|
29
27
|
const oneMillionTokens = 10n ** BigInt(currency.decimals) * 1000000n;
|
|
30
28
|
const threshold = maxValue - oneMillionTokens;
|
|
31
29
|
const [tokenToControllerAllowance, vaultToControllerAllowance, vaultToBookManagerAllowance,] = await Promise.all([
|
|
32
|
-
(0, allowance_1.fetchAllowance)(publicClient, tokenAddress,
|
|
33
|
-
(0, allowance_1.fetchAllowance)(publicClient, vault.address,
|
|
34
|
-
(0, allowance_1.fetchAllowance)(publicClient, vault.address,
|
|
30
|
+
(0, allowance_1.fetchAllowance)(publicClient, tokenAddress, userAddress, controllerAddress),
|
|
31
|
+
(0, allowance_1.fetchAllowance)(publicClient, vault.address, userAddress, controllerAddress),
|
|
32
|
+
(0, allowance_1.fetchAllowance)(publicClient, vault.address, userAddress, bookManagerAddress),
|
|
35
33
|
]);
|
|
36
34
|
const approvalAbi = [
|
|
37
35
|
{
|
|
@@ -59,109 +57,38 @@ const setTokenAllowances = async ({ chainId, walletClient, tokenAddress, options
|
|
|
59
57
|
type: 'function',
|
|
60
58
|
},
|
|
61
59
|
];
|
|
62
|
-
const
|
|
60
|
+
const transactions = [];
|
|
63
61
|
if (tokenToControllerAllowance < threshold) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
args: [controllerAddress, maxValue],
|
|
73
|
-
});
|
|
74
|
-
hash = await walletClient.writeContract(request);
|
|
75
|
-
}
|
|
76
|
-
catch (error) {
|
|
77
|
-
if (error.message?.includes('Nonce provided for the transaction is lower than the current nonce')) {
|
|
78
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
79
|
-
const { request } = await publicClient.simulateContract({
|
|
80
|
-
account: walletClient.account,
|
|
81
|
-
chain: chain_1.CHAIN_MAP[chainId],
|
|
82
|
-
address: tokenAddress,
|
|
83
|
-
abi: approvalAbi,
|
|
84
|
-
functionName: 'approve',
|
|
85
|
-
args: [controllerAddress, maxValue],
|
|
86
|
-
});
|
|
87
|
-
hash = await walletClient.writeContract(request);
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
transactionHashes.push(hash);
|
|
94
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
95
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
62
|
+
transactions.push(await (0, build_transaction_1.buildTransaction)(publicClient, {
|
|
63
|
+
chain: chain_1.CHAIN_MAP[chainId],
|
|
64
|
+
account: userAddress,
|
|
65
|
+
address: tokenAddress,
|
|
66
|
+
abi: approvalAbi,
|
|
67
|
+
functionName: 'approve',
|
|
68
|
+
args: [controllerAddress, maxValue],
|
|
69
|
+
}, options?.gasLimit));
|
|
96
70
|
}
|
|
97
71
|
if (vaultToControllerAllowance < threshold) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
args: [controllerAddress, maxValue],
|
|
107
|
-
});
|
|
108
|
-
hash = await walletClient.writeContract(request);
|
|
109
|
-
}
|
|
110
|
-
catch (error) {
|
|
111
|
-
if (error.message?.includes('Nonce provided for the transaction is lower than the current nonce')) {
|
|
112
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
113
|
-
const { request } = await publicClient.simulateContract({
|
|
114
|
-
account: walletClient.account,
|
|
115
|
-
chain: chain_1.CHAIN_MAP[chainId],
|
|
116
|
-
address: vault.address,
|
|
117
|
-
abi: approvalAbi,
|
|
118
|
-
functionName: 'approve',
|
|
119
|
-
args: [controllerAddress, maxValue],
|
|
120
|
-
});
|
|
121
|
-
hash = await walletClient.writeContract(request);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
transactionHashes.push(hash);
|
|
128
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
129
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
72
|
+
transactions.push(await (0, build_transaction_1.buildTransaction)(publicClient, {
|
|
73
|
+
chain: chain_1.CHAIN_MAP[chainId],
|
|
74
|
+
account: userAddress,
|
|
75
|
+
address: vault.address,
|
|
76
|
+
abi: approvalAbi,
|
|
77
|
+
functionName: 'approve',
|
|
78
|
+
args: [controllerAddress, maxValue],
|
|
79
|
+
}, options?.gasLimit));
|
|
130
80
|
}
|
|
131
81
|
if (vaultToBookManagerAllowance < threshold) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
args: [bookManagerAddress, maxValue],
|
|
141
|
-
});
|
|
142
|
-
hash = await walletClient.writeContract(request);
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
if (error.message?.includes('Nonce provided for the transaction is lower than the current nonce')) {
|
|
146
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
147
|
-
const { request } = await publicClient.simulateContract({
|
|
148
|
-
account: walletClient.account,
|
|
149
|
-
chain: chain_1.CHAIN_MAP[chainId],
|
|
150
|
-
address: vault.address,
|
|
151
|
-
abi: approvalAbi,
|
|
152
|
-
functionName: 'approve',
|
|
153
|
-
args: [bookManagerAddress, maxValue],
|
|
154
|
-
});
|
|
155
|
-
hash = await walletClient.writeContract(request);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
throw error;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
transactionHashes.push(hash);
|
|
162
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
82
|
+
transactions.push(await (0, build_transaction_1.buildTransaction)(publicClient, {
|
|
83
|
+
chain: chain_1.CHAIN_MAP[chainId],
|
|
84
|
+
account: userAddress,
|
|
85
|
+
address: vault.address,
|
|
86
|
+
abi: approvalAbi,
|
|
87
|
+
functionName: 'approve',
|
|
88
|
+
args: [bookManagerAddress, maxValue],
|
|
89
|
+
}, options?.gasLimit));
|
|
163
90
|
}
|
|
164
|
-
return
|
|
91
|
+
return transactions;
|
|
165
92
|
};
|
|
166
93
|
exports.setTokenAllowances = setTokenAllowances;
|
|
167
94
|
//# sourceMappingURL=token.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../src/calls/approval/token.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../src/calls/approval/token.ts"],"names":[],"mappings":";;;AAAA,+BAAgD;AAEhD,+DAA2E;AAE3E,uDAA6D;AAC7D,sEAAwE;AACxE,uEAA6E;AAC7E,6CAA6C;AAC7C,qEAAiE;AAgC1D,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,OAAO,EACP,WAAW,EACX,YAAY,EACZ,OAAO,GAMR,EAA0B,EAAE;IAC3B,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;QACtC,KAAK,EAAE,iBAAS,CAAC,OAAO,CAAC;QACzB,SAAS,EAAE,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A,oCAAgB,EACpB,YAAY,EACZ;YACE,KAAK,EAAE,iBAAS,CAAC,OAAO,CAAC;YACzB,OAAO,EAAE,WAAW;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,GAAG,EAAE,WAAW;YAChB,YAAY,EAAE,SAAS;YACvB,IAAI,EAAE,CAAC,kBAAkB,EAAE,QAAQ,CAAC;SACrC,EACD,OAAO,EAAE,QAAQ,CAClB,CACF,CAAC;IACJ,CAAC;IAGD,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AA5IW,QAAA,kBAAkB,sBA4I7B"}
|
|
@@ -1,46 +1,37 @@
|
|
|
1
1
|
import { createPublicClient, http } from 'viem';
|
|
2
2
|
import { CHAIN_MAP } from '../../constants/chain-configs/chain';
|
|
3
3
|
import { CONTRACT_ADDRESSES } from '../../constants/chain-configs/addresses';
|
|
4
|
+
import { buildTransaction } from '../../utils/build-transaction';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
* Sets the order operator approval for the specified operator address on the given chain.
|
|
6
|
+
* Prepares a transaction to set the order operator approval for the specified operator address on the given chain.
|
|
7
7
|
*
|
|
8
8
|
* @param {CHAIN_IDS} chainId The chain ID.
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {`0x${string}`} userAddress The user address.
|
|
10
10
|
* @param {`0x${string}`} operator The operator address to approve or revoke.
|
|
11
11
|
* @param {boolean} approved Whether to approve or revoke the operator.
|
|
12
12
|
* @param {Object} [options] Optional parameters for setting approval.
|
|
13
|
-
* @param {string} options.rpcUrl The RPC URL to use for
|
|
14
|
-
* @returns {Promise
|
|
13
|
+
* @param {string} options.rpcUrl The RPC URL to use for building the transaction.
|
|
14
|
+
* @returns {Promise<Transaction>} Promise resolving to the transaction object.
|
|
15
15
|
* @example
|
|
16
16
|
* import { setOrderOperatorApproval } from '@clober/v2-sdk'
|
|
17
|
-
* import { mnemonicToAccount } from 'viem/accounts'
|
|
18
17
|
*
|
|
19
|
-
* const
|
|
20
|
-
* chain: arbitrumSepolia,
|
|
21
|
-
* account: mnemonicToAccount('legal ...'),
|
|
22
|
-
* transport: http(),
|
|
23
|
-
* })
|
|
24
|
-
*
|
|
25
|
-
* const hash = await setOrderOperatorApproval({
|
|
18
|
+
* const transaction = await setOrderOperatorApproval({
|
|
26
19
|
* chainId: 421614,
|
|
27
|
-
*
|
|
20
|
+
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
|
|
28
21
|
* operator: '0x1234567890123456789012345678901234567890',
|
|
29
22
|
* approved: true
|
|
30
23
|
* })
|
|
24
|
+
*
|
|
25
|
+
* const hash = await walletClient.sendTransaction(transaction)
|
|
31
26
|
*/
|
|
32
|
-
export const setOrderOperatorApproval = async ({ chainId,
|
|
33
|
-
if (!walletClient.account) {
|
|
34
|
-
throw new Error('Account is not found');
|
|
35
|
-
}
|
|
27
|
+
export const setOrderOperatorApproval = async ({ chainId, userAddress, operator, approved, options, }) => {
|
|
36
28
|
const publicClient = createPublicClient({
|
|
37
29
|
chain: CHAIN_MAP[chainId],
|
|
38
30
|
transport: options?.rpcUrl ? http(options.rpcUrl) : http(),
|
|
39
31
|
});
|
|
40
|
-
|
|
41
|
-
const { request } = await publicClient.simulateContract({
|
|
42
|
-
account: walletClient.account,
|
|
32
|
+
return buildTransaction(publicClient, {
|
|
43
33
|
chain: CHAIN_MAP[chainId],
|
|
34
|
+
account: userAddress,
|
|
44
35
|
address: CONTRACT_ADDRESSES[chainId].BookManager,
|
|
45
36
|
abi: [
|
|
46
37
|
{
|
|
@@ -64,44 +55,34 @@ export const setOrderOperatorApproval = async ({ chainId, walletClient, operator
|
|
|
64
55
|
],
|
|
65
56
|
functionName: 'setOrderOperator',
|
|
66
57
|
args: [operator, approved],
|
|
67
|
-
});
|
|
68
|
-
return walletClient.writeContract(request);
|
|
58
|
+
}, options?.gasLimit);
|
|
69
59
|
};
|
|
70
60
|
/**
|
|
71
|
-
*
|
|
72
|
-
* Approves the controller as an order operator for the specified chain.
|
|
61
|
+
* Prepares a transaction to approve the controller as an order operator for the specified chain.
|
|
73
62
|
* This is a convenience function that delegates to `setOrderOperatorApproval`.
|
|
74
63
|
*
|
|
75
64
|
* @param {CHAIN_IDS} chainId The chain ID.
|
|
76
|
-
* @param {
|
|
65
|
+
* @param {`0x${string}`} userAddress The user address.
|
|
77
66
|
* @param {Object} [options] Optional parameters for setting approval.
|
|
78
|
-
* @param {string} options.rpcUrl The RPC URL to use for
|
|
79
|
-
* @returns {Promise
|
|
67
|
+
* @param {string} options.rpcUrl The RPC URL to use for building the transaction.
|
|
68
|
+
* @returns {Promise<Transaction>} Promise resolving to the transaction object.
|
|
80
69
|
* @example
|
|
81
70
|
* import { approveControllerAsOrderOperator } from '@clober/v2-sdk'
|
|
82
|
-
* import { mnemonicToAccount } from 'viem/accounts'
|
|
83
71
|
*
|
|
84
|
-
* const
|
|
85
|
-
* chain: arbitrumSepolia,
|
|
86
|
-
* account: mnemonicToAccount('legal ...'),
|
|
87
|
-
* transport: http(),
|
|
88
|
-
* })
|
|
89
|
-
*
|
|
90
|
-
* const hash = await approveControllerAsOrderOperator({
|
|
72
|
+
* const transaction = await approveControllerAsOrderOperator({
|
|
91
73
|
* chainId: 421614,
|
|
92
|
-
*
|
|
74
|
+
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69'
|
|
93
75
|
* })
|
|
76
|
+
*
|
|
77
|
+
* const hash = await walletClient.sendTransaction(transaction)
|
|
94
78
|
*/
|
|
95
|
-
export const approveControllerAsOrderOperator = async ({ chainId,
|
|
96
|
-
|
|
79
|
+
export const approveControllerAsOrderOperator = async ({ chainId, userAddress, options, }) => {
|
|
80
|
+
return setOrderOperatorApproval({
|
|
97
81
|
chainId,
|
|
98
|
-
|
|
82
|
+
userAddress,
|
|
99
83
|
operator: CONTRACT_ADDRESSES[chainId].Controller,
|
|
100
84
|
approved: true,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
params.options = options;
|
|
104
|
-
}
|
|
105
|
-
return setOrderOperatorApproval(params);
|
|
85
|
+
...(options && { options }),
|
|
86
|
+
});
|
|
106
87
|
};
|
|
107
88
|
//# sourceMappingURL=order.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../../src/calls/approval/order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"order.js","sourceRoot":"","sources":["../../../../src/calls/approval/order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAa,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAAE,EAC7C,OAAO,EACP,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,OAAO,GAOR,EAAwB,EAAE;IACzB,MAAM,YAAY,GAAG,kBAAkB,CAAC;QACtC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC;QACzB,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;KAC3D,CAAC,CAAC;IAEH,OAAO,gBAAgB,CACrB,YAAY,EACZ;QACE,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC;QACzB,OAAO,EAAE,WAAW;QACpB,OAAO,EAAE,kBAAkB,CAAC,OAAO,CAAE,CAAC,WAAW;QACjD,GAAG,EAAE;YACH;gBACE,MAAM,EAAE;oBACN;wBACE,YAAY,EAAE,SAAS;wBACvB,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,SAAS;qBAChB;oBACD;wBACE,YAAY,EAAE,MAAM;wBACpB,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,MAAM;qBACb;iBACF;gBACD,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,EAAE;gBACX,eAAe,EAAE,YAAY;gBAC7B,IAAI,EAAE,UAAU;aACjB;SACO;QACV,YAAY,EAAE,kBAAkB;QAChC,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;KAC3B,EACD,OAAO,EAAE,QAAQ,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,KAAK,EAAE,EACrD,OAAO,EACP,WAAW,EACX,OAAO,GAKR,EAAwB,EAAE;IACzB,OAAO,wBAAwB,CAAC;QAC9B,OAAO;QACP,WAAW;QACX,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAE,CAAC,UAAU;QACjD,QAAQ,EAAE,IAAI;QACd,GAAG,CAAC,OAAO,IAAI,EAAE,OAAO,EAAE,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -4,41 +4,38 @@ import { fetchCurrency } from '../../entities/currency/apis';
|
|
|
4
4
|
import { fetchAllowance } from '../../entities/currency/apis/allowance';
|
|
5
5
|
import { CONTRACT_ADDRESSES } from '../../constants/chain-configs/addresses';
|
|
6
6
|
import { getVault } from '../../views/vault';
|
|
7
|
+
import { buildTransaction } from '../../utils/build-transaction';
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
* Sets maximum allowance for a token and its vault to the respective contracts.
|
|
9
|
+
* Prepares approval transactions for a token and its vault.
|
|
10
10
|
* This includes:
|
|
11
11
|
* - Max allowance for the token to controller
|
|
12
12
|
* - Max allowance for the token's vault to controller
|
|
13
13
|
* - Max allowance for the token's vault to book manager
|
|
14
14
|
*
|
|
15
|
-
* Only
|
|
15
|
+
* Only includes approvals where current allowance is below threshold (max - 1 million tokens).
|
|
16
16
|
*
|
|
17
17
|
* @param {CHAIN_IDS} chainId The chain ID.
|
|
18
|
-
* @param {
|
|
18
|
+
* @param {`0x${string}`} userAddress The user address.
|
|
19
19
|
* @param {`0x${string}`} tokenAddress The token address.
|
|
20
20
|
* @param options
|
|
21
21
|
* @param options.rpcUrl The RPC URL of the blockchain.
|
|
22
|
-
* @returns {Promise
|
|
22
|
+
* @returns {Promise<Transaction[]>} Promise resolving to array of approval transactions. Empty array if no approvals needed.
|
|
23
23
|
* @example
|
|
24
24
|
* import { setTokenAllowances } from '@clober/v2-sdk'
|
|
25
25
|
*
|
|
26
|
-
* const
|
|
27
|
-
* chain: arbitrumSepolia,
|
|
28
|
-
* account: mnemonicToAccount('legal ...'),
|
|
29
|
-
* transport: http(),
|
|
30
|
-
* })
|
|
31
|
-
*
|
|
32
|
-
* const hashes = await setTokenAllowances({
|
|
26
|
+
* const transactions = await setTokenAllowances({
|
|
33
27
|
* chainId: 421614,
|
|
34
|
-
*
|
|
28
|
+
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
|
|
35
29
|
* tokenAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
36
30
|
* })
|
|
31
|
+
*
|
|
32
|
+
* // Send transactions sequentially
|
|
33
|
+
* for (const tx of transactions) {
|
|
34
|
+
* const hash = await walletClient.sendTransaction(tx)
|
|
35
|
+
* await publicClient.waitForTransactionReceipt({ hash })
|
|
36
|
+
* }
|
|
37
37
|
*/
|
|
38
|
-
export const setTokenAllowances = async ({ chainId,
|
|
39
|
-
if (!walletClient.account) {
|
|
40
|
-
throw new Error('Account is not found');
|
|
41
|
-
}
|
|
38
|
+
export const setTokenAllowances = async ({ chainId, userAddress, tokenAddress, options, }) => {
|
|
42
39
|
const publicClient = createPublicClient({
|
|
43
40
|
chain: CHAIN_MAP[chainId],
|
|
44
41
|
transport: options?.rpcUrl ? http(options.rpcUrl) : http(),
|
|
@@ -60,9 +57,9 @@ export const setTokenAllowances = async ({ chainId, walletClient, tokenAddress,
|
|
|
60
57
|
const threshold = maxValue - oneMillionTokens;
|
|
61
58
|
// Check current allowances
|
|
62
59
|
const [tokenToControllerAllowance, vaultToControllerAllowance, vaultToBookManagerAllowance,] = await Promise.all([
|
|
63
|
-
fetchAllowance(publicClient, tokenAddress,
|
|
64
|
-
fetchAllowance(publicClient, vault.address,
|
|
65
|
-
fetchAllowance(publicClient, vault.address,
|
|
60
|
+
fetchAllowance(publicClient, tokenAddress, userAddress, controllerAddress),
|
|
61
|
+
fetchAllowance(publicClient, vault.address, userAddress, controllerAddress),
|
|
62
|
+
fetchAllowance(publicClient, vault.address, userAddress, bookManagerAddress),
|
|
66
63
|
]);
|
|
67
64
|
const approvalAbi = [
|
|
68
65
|
{
|
|
@@ -90,123 +87,41 @@ export const setTokenAllowances = async ({ chainId, walletClient, tokenAddress,
|
|
|
90
87
|
type: 'function',
|
|
91
88
|
},
|
|
92
89
|
];
|
|
93
|
-
const
|
|
90
|
+
const transactions = [];
|
|
94
91
|
// Approve token to controller if needed
|
|
95
92
|
if (tokenToControllerAllowance < threshold) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
functionName: 'approve',
|
|
105
|
-
args: [controllerAddress, maxValue],
|
|
106
|
-
});
|
|
107
|
-
hash = await walletClient.writeContract(request);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
if (error.message?.includes('Nonce provided for the transaction is lower than the current nonce')) {
|
|
111
|
-
// Wait 2 seconds and retry once
|
|
112
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
113
|
-
const { request } = await publicClient.simulateContract({
|
|
114
|
-
account: walletClient.account,
|
|
115
|
-
chain: CHAIN_MAP[chainId],
|
|
116
|
-
address: tokenAddress,
|
|
117
|
-
abi: approvalAbi,
|
|
118
|
-
functionName: 'approve',
|
|
119
|
-
args: [controllerAddress, maxValue],
|
|
120
|
-
});
|
|
121
|
-
hash = await walletClient.writeContract(request);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
transactionHashes.push(hash);
|
|
128
|
-
// Wait for transaction confirmation to ensure nonce is updated
|
|
129
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
130
|
-
// Wait 1 second before proceeding (to avoid nonce issues)
|
|
131
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
93
|
+
transactions.push(await buildTransaction(publicClient, {
|
|
94
|
+
chain: CHAIN_MAP[chainId],
|
|
95
|
+
account: userAddress,
|
|
96
|
+
address: tokenAddress,
|
|
97
|
+
abi: approvalAbi,
|
|
98
|
+
functionName: 'approve',
|
|
99
|
+
args: [controllerAddress, maxValue],
|
|
100
|
+
}, options?.gasLimit));
|
|
132
101
|
}
|
|
133
102
|
// Approve vault to controller if needed
|
|
134
103
|
if (vaultToControllerAllowance < threshold) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
functionName: 'approve',
|
|
144
|
-
args: [controllerAddress, maxValue],
|
|
145
|
-
});
|
|
146
|
-
hash = await walletClient.writeContract(request);
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
if (error.message?.includes('Nonce provided for the transaction is lower than the current nonce')) {
|
|
150
|
-
// Wait 2 seconds and retry once
|
|
151
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
152
|
-
const { request } = await publicClient.simulateContract({
|
|
153
|
-
account: walletClient.account,
|
|
154
|
-
chain: CHAIN_MAP[chainId],
|
|
155
|
-
address: vault.address,
|
|
156
|
-
abi: approvalAbi,
|
|
157
|
-
functionName: 'approve',
|
|
158
|
-
args: [controllerAddress, maxValue],
|
|
159
|
-
});
|
|
160
|
-
hash = await walletClient.writeContract(request);
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
throw error;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
transactionHashes.push(hash);
|
|
167
|
-
// Wait for transaction confirmation to ensure nonce is updated
|
|
168
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
169
|
-
// Wait 1 second before proceeding (to avoid nonce issues)
|
|
170
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
104
|
+
transactions.push(await buildTransaction(publicClient, {
|
|
105
|
+
chain: CHAIN_MAP[chainId],
|
|
106
|
+
account: userAddress,
|
|
107
|
+
address: vault.address,
|
|
108
|
+
abi: approvalAbi,
|
|
109
|
+
functionName: 'approve',
|
|
110
|
+
args: [controllerAddress, maxValue],
|
|
111
|
+
}, options?.gasLimit));
|
|
171
112
|
}
|
|
172
113
|
// Approve vault to book manager if needed
|
|
173
114
|
if (vaultToBookManagerAllowance < threshold) {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
functionName: 'approve',
|
|
183
|
-
args: [bookManagerAddress, maxValue],
|
|
184
|
-
});
|
|
185
|
-
hash = await walletClient.writeContract(request);
|
|
186
|
-
}
|
|
187
|
-
catch (error) {
|
|
188
|
-
if (error.message?.includes('Nonce provided for the transaction is lower than the current nonce')) {
|
|
189
|
-
// Wait 2 seconds and retry once
|
|
190
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
191
|
-
const { request } = await publicClient.simulateContract({
|
|
192
|
-
account: walletClient.account,
|
|
193
|
-
chain: CHAIN_MAP[chainId],
|
|
194
|
-
address: vault.address,
|
|
195
|
-
abi: approvalAbi,
|
|
196
|
-
functionName: 'approve',
|
|
197
|
-
args: [bookManagerAddress, maxValue],
|
|
198
|
-
});
|
|
199
|
-
hash = await walletClient.writeContract(request);
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
throw error;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
transactionHashes.push(hash);
|
|
206
|
-
// Wait for transaction confirmation to ensure nonce is updated
|
|
207
|
-
await publicClient.waitForTransactionReceipt({ hash });
|
|
115
|
+
transactions.push(await buildTransaction(publicClient, {
|
|
116
|
+
chain: CHAIN_MAP[chainId],
|
|
117
|
+
account: userAddress,
|
|
118
|
+
address: vault.address,
|
|
119
|
+
abi: approvalAbi,
|
|
120
|
+
functionName: 'approve',
|
|
121
|
+
args: [bookManagerAddress, maxValue],
|
|
122
|
+
}, options?.gasLimit));
|
|
208
123
|
}
|
|
209
|
-
// Return all
|
|
210
|
-
return
|
|
124
|
+
// Return all transactions - caller should send sequentially with proper nonce management
|
|
125
|
+
return transactions;
|
|
211
126
|
};
|
|
212
127
|
//# sourceMappingURL=token.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../src/calls/approval/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../src/calls/approval/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAa,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,OAAO,EACP,WAAW,EACX,YAAY,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