@clawnch/clawncher-sdk 0.3.2 → 0.3.4
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/README.md +89 -0
- package/dist/bankr-fees.d.ts +216 -0
- package/dist/bankr-fees.d.ts.map +1 -0
- package/dist/bankr-fees.js +317 -0
- package/dist/bankr-fees.js.map +1 -0
- package/dist/deployer.d.ts +48 -2
- package/dist/deployer.d.ts.map +1 -1
- package/dist/deployer.js +134 -5
- package/dist/deployer.js.map +1 -1
- package/dist/errors.d.ts +2 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -0
- package/dist/errors.js.map +1 -1
- package/dist/herd-auth.d.ts +79 -0
- package/dist/herd-auth.d.ts.map +1 -0
- package/dist/herd-auth.js +188 -0
- package/dist/herd-auth.js.map +1 -0
- package/dist/herd-hal.d.ts +92 -0
- package/dist/herd-hal.d.ts.map +1 -0
- package/dist/herd-hal.js +337 -0
- package/dist/herd-hal.js.map +1 -0
- package/dist/herd-types.d.ts +479 -0
- package/dist/herd-types.d.ts.map +1 -0
- package/dist/herd-types.js +18 -0
- package/dist/herd-types.js.map +1 -0
- package/dist/herd.d.ts +223 -0
- package/dist/herd.d.ts.map +1 -0
- package/dist/herd.js +1486 -0
- package/dist/herd.js.map +1 -0
- package/dist/hummingbot-types.d.ts +702 -0
- package/dist/hummingbot-types.d.ts.map +1 -0
- package/dist/hummingbot-types.js +12 -0
- package/dist/hummingbot-types.js.map +1 -0
- package/dist/hummingbot.d.ts +747 -0
- package/dist/hummingbot.d.ts.map +1 -0
- package/dist/hummingbot.js +1478 -0
- package/dist/hummingbot.js.map +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/price.d.ts +16 -11
- package/dist/price.d.ts.map +1 -1
- package/dist/price.js +56 -25
- package/dist/price.js.map +1 -1
- package/dist/uniswap-quoter.d.ts +25 -4
- package/dist/uniswap-quoter.d.ts.map +1 -1
- package/dist/uniswap-quoter.js +52 -8
- package/dist/uniswap-quoter.js.map +1 -1
- package/dist/walletconnect-signer.d.ts +154 -0
- package/dist/walletconnect-signer.d.ts.map +1 -0
- package/dist/walletconnect-signer.js +307 -0
- package/dist/walletconnect-signer.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herd-auth.js","sourceRoot":"","sources":["../src/herd-auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA0BlC,4EAA4E;AAC5E,YAAY;AACZ,4EAA4E;AAE5E,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AACzD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAEtD,4EAA4E;AAC5E,WAAW;AACX,4EAA4E;AAE5E,MAAM,OAAO,QAAQ;IACX,UAAU,GAA0B,IAAI,CAAC;IACzC,SAAS,CAAS;IAE1B,YAAY,SAAyB,EAAE;QACrC,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;QAElF,sCAAsC;QACtC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACvB,IAAI,CAAC,UAAU,GAAG;gBAChB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,SAAS,EAAE,QAAQ;gBACnB,QAAQ,EAAE,IAAI,IAAI,EAAE,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is a JSON DSL for composing blockchain transactions
|
|
5
|
+
* and data reads. Instead of requiring users to hand-write the nested JSON,
|
|
6
|
+
* this module provides a TypeScript builder API.
|
|
7
|
+
*
|
|
8
|
+
* Use cases:
|
|
9
|
+
* - Pre-simulate any transaction before sending
|
|
10
|
+
* - Generate reusable adapters for common Clawncher operations
|
|
11
|
+
* - Validate parameter types at compile time
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const hal = new HalBuilder();
|
|
16
|
+
*
|
|
17
|
+
* // Build an ERC-20 transfer adapter
|
|
18
|
+
* const expr = hal.buildTransferAdapter({
|
|
19
|
+
* token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
20
|
+
* blockchain: 'base',
|
|
21
|
+
* decimals: 6,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Simulate it via Herd
|
|
25
|
+
* const result = await herd.simulateAction(expr, {
|
|
26
|
+
* to: '0xRecipient...',
|
|
27
|
+
* amount: '100',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
import type { HerdBlockchain, HalExpression, HalSimulationResult } from './herd-types.js';
|
|
32
|
+
export interface TransferAdapterOptions {
|
|
33
|
+
/** Token contract address */
|
|
34
|
+
token: string;
|
|
35
|
+
/** Blockchain */
|
|
36
|
+
blockchain: HerdBlockchain;
|
|
37
|
+
/** Token decimals (default: 18) */
|
|
38
|
+
decimals?: number;
|
|
39
|
+
/** Token name for metadata */
|
|
40
|
+
tokenName?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface SwapActionOptions {
|
|
43
|
+
/** Sell token address */
|
|
44
|
+
sellToken: string;
|
|
45
|
+
/** Buy token address */
|
|
46
|
+
buyToken: string;
|
|
47
|
+
/** Blockchain */
|
|
48
|
+
blockchain: HerdBlockchain;
|
|
49
|
+
/** Whether to include the approval step */
|
|
50
|
+
includeApproval?: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface ReadBalanceOptions {
|
|
53
|
+
/** Token contract address */
|
|
54
|
+
token: string;
|
|
55
|
+
/** Blockchain */
|
|
56
|
+
blockchain: HerdBlockchain;
|
|
57
|
+
}
|
|
58
|
+
export declare class HalBuilder {
|
|
59
|
+
/**
|
|
60
|
+
* Build a HAL adapter expression for an ERC-20 transfer.
|
|
61
|
+
*
|
|
62
|
+
* Parameters exposed to the user: `to` (address), `amount` (human-readable).
|
|
63
|
+
* The adapter handles decimal conversion and calldata encoding.
|
|
64
|
+
*/
|
|
65
|
+
buildTransferAdapter(options: TransferAdapterOptions): HalExpression;
|
|
66
|
+
/**
|
|
67
|
+
* Build a HAL action for a swap using 0x API.
|
|
68
|
+
*
|
|
69
|
+
* This generates an action with an optional approval step (conditional
|
|
70
|
+
* on whether the wallet has already approved the spender).
|
|
71
|
+
*/
|
|
72
|
+
buildSwapAction(options: SwapActionOptions): HalExpression;
|
|
73
|
+
/**
|
|
74
|
+
* Build a HAL read adapter for checking an ERC-20 balance.
|
|
75
|
+
*/
|
|
76
|
+
buildBalanceReader(options: ReadBalanceOptions): HalExpression;
|
|
77
|
+
/**
|
|
78
|
+
* Build a HAL read adapter for checking allowance.
|
|
79
|
+
*/
|
|
80
|
+
buildAllowanceReader(options: ReadBalanceOptions & {
|
|
81
|
+
spender?: string;
|
|
82
|
+
}): HalExpression;
|
|
83
|
+
/**
|
|
84
|
+
* Build a HAL approve adapter.
|
|
85
|
+
*/
|
|
86
|
+
buildApproveAdapter(options: TransferAdapterOptions): HalExpression;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Parse a raw HAL simulation response into typed structure.
|
|
90
|
+
*/
|
|
91
|
+
export declare function parseSimulationResult(raw: unknown): HalSimulationResult;
|
|
92
|
+
//# sourceMappingURL=herd-hal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herd-hal.d.ts","sourceRoot":"","sources":["../src/herd-hal.ts"],"names":[],"mappings":"AAAA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337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HAL Expression Builder — Programmatic construction of Herd Action Language expressions.
|
|
3
|
+
*
|
|
4
|
+
* HAL (Herd Action Language) is a JSON DSL for composing blockchain transactions
|
|
5
|
+
* and data reads. Instead of requiring users to hand-write the nested JSON,
|
|
6
|
+
* this module provides a TypeScript builder API.
|
|
7
|
+
*
|
|
8
|
+
* Use cases:
|
|
9
|
+
* - Pre-simulate any transaction before sending
|
|
10
|
+
* - Generate reusable adapters for common Clawncher operations
|
|
11
|
+
* - Validate parameter types at compile time
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const hal = new HalBuilder();
|
|
16
|
+
*
|
|
17
|
+
* // Build an ERC-20 transfer adapter
|
|
18
|
+
* const expr = hal.buildTransferAdapter({
|
|
19
|
+
* token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
|
|
20
|
+
* blockchain: 'base',
|
|
21
|
+
* decimals: 6,
|
|
22
|
+
* });
|
|
23
|
+
*
|
|
24
|
+
* // Simulate it via Herd
|
|
25
|
+
* const result = await herd.simulateAction(expr, {
|
|
26
|
+
* to: '0xRecipient...',
|
|
27
|
+
* amount: '100',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
// =========================================================================
|
|
32
|
+
// Function Signatures (4-byte selectors)
|
|
33
|
+
// =========================================================================
|
|
34
|
+
const SELECTORS = {
|
|
35
|
+
transfer: '0xa9059cbb', // transfer(address,uint256)
|
|
36
|
+
approve: '0x095ea7b3', // approve(address,uint256)
|
|
37
|
+
balanceOf: '0x70a08231', // balanceOf(address)
|
|
38
|
+
allowance: '0xdd62ed3e', // allowance(address,address)
|
|
39
|
+
totalSupply: '0x18160ddd', // totalSupply()
|
|
40
|
+
};
|
|
41
|
+
// =========================================================================
|
|
42
|
+
// HAL Expression Helpers (build individual nodes)
|
|
43
|
+
// =========================================================================
|
|
44
|
+
/**
|
|
45
|
+
* Create a ["do", ...] block — the top-level wrapper.
|
|
46
|
+
*/
|
|
47
|
+
function doBlock(...exprs) {
|
|
48
|
+
return ['do', ...exprs];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Create an ["import", module, [functions]] node.
|
|
52
|
+
*/
|
|
53
|
+
function importStdlib(module, functions) {
|
|
54
|
+
return ['import', module, functions];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create a ["define", { name, parameters, body, meta? }] node.
|
|
58
|
+
*/
|
|
59
|
+
function define(name, parameters, body, meta) {
|
|
60
|
+
const def = { name, parameters, body };
|
|
61
|
+
if (meta)
|
|
62
|
+
def.meta = meta;
|
|
63
|
+
return ['define', def];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create an ["export", ...] wrapper.
|
|
67
|
+
*/
|
|
68
|
+
function exportExpr(expr) {
|
|
69
|
+
return ['export', expr];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create a ["coerce", { type, value }] node.
|
|
73
|
+
*/
|
|
74
|
+
function coerce(type, value) {
|
|
75
|
+
return ['coerce', { type, value }];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create an ["encode-calldata", { ... }] node.
|
|
79
|
+
*/
|
|
80
|
+
function encodeCalldata(params) {
|
|
81
|
+
return [
|
|
82
|
+
'encode-calldata',
|
|
83
|
+
{
|
|
84
|
+
blockchain: params.blockchain,
|
|
85
|
+
contractAddress: params.contractAddress,
|
|
86
|
+
functionSignature: params.functionSignature,
|
|
87
|
+
args: params.args,
|
|
88
|
+
inputAbi: ['quote', params.inputAbi],
|
|
89
|
+
functionName: params.functionName,
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create a ["decimals", { value, decimals }] node.
|
|
95
|
+
*/
|
|
96
|
+
function decimalsExpr(value, decimals) {
|
|
97
|
+
return ['decimals', { value, decimals }];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create a ["write-function", <data>] node for use in batch steps.
|
|
101
|
+
*/
|
|
102
|
+
function writeFunction(data) {
|
|
103
|
+
return ['write-function', data];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create a ["read-function", { calldata, outputAbi }] node.
|
|
107
|
+
*/
|
|
108
|
+
function readFunction(calldata, outputAbi) {
|
|
109
|
+
return [
|
|
110
|
+
'read-function',
|
|
111
|
+
{
|
|
112
|
+
calldata,
|
|
113
|
+
outputAbi: ['quote', outputAbi],
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Create a batch call data return value (for write adapters).
|
|
119
|
+
*/
|
|
120
|
+
function batchCallData(payable, payableAmount, encodedCalldata) {
|
|
121
|
+
return [
|
|
122
|
+
'coerce',
|
|
123
|
+
{
|
|
124
|
+
type: {
|
|
125
|
+
payable: 'bool',
|
|
126
|
+
payableAmount: 'uint256',
|
|
127
|
+
encodedCalldata: {
|
|
128
|
+
blockchain: 'string',
|
|
129
|
+
contractAddress: 'address',
|
|
130
|
+
functionSignature: 'bytes4',
|
|
131
|
+
calldata: 'bytes',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
value: {
|
|
135
|
+
payable,
|
|
136
|
+
payableAmount,
|
|
137
|
+
encodedCalldata,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
export class HalBuilder {
|
|
143
|
+
/**
|
|
144
|
+
* Build a HAL adapter expression for an ERC-20 transfer.
|
|
145
|
+
*
|
|
146
|
+
* Parameters exposed to the user: `to` (address), `amount` (human-readable).
|
|
147
|
+
* The adapter handles decimal conversion and calldata encoding.
|
|
148
|
+
*/
|
|
149
|
+
buildTransferAdapter(options) {
|
|
150
|
+
const decimals = options.decimals ?? 18;
|
|
151
|
+
return doBlock(importStdlib('herd', ['encode-calldata', 'decimals']), exportExpr(define('transfer', [
|
|
152
|
+
{ name: 'to', type: 'address', meta: { description: 'Recipient address' } },
|
|
153
|
+
{ name: 'amount', type: 'uint256', meta: { description: 'Amount (human-readable)', decimals } },
|
|
154
|
+
], batchCallData(false, '0', encodeCalldata({
|
|
155
|
+
blockchain: options.blockchain,
|
|
156
|
+
contractAddress: options.token,
|
|
157
|
+
functionSignature: SELECTORS.transfer,
|
|
158
|
+
args: {
|
|
159
|
+
recipient: 'to',
|
|
160
|
+
value: coerce('uint256', decimalsExpr('amount', decimals)),
|
|
161
|
+
},
|
|
162
|
+
inputAbi: [
|
|
163
|
+
{ name: 'recipient', type: 'address' },
|
|
164
|
+
{ name: 'value', type: 'uint256' },
|
|
165
|
+
],
|
|
166
|
+
functionName: 'transfer',
|
|
167
|
+
})), {
|
|
168
|
+
description: `Transfer ${options.tokenName || 'tokens'}`,
|
|
169
|
+
originContract: {
|
|
170
|
+
address: options.token,
|
|
171
|
+
blockchain: options.blockchain,
|
|
172
|
+
contractName: options.tokenName || 'ERC20',
|
|
173
|
+
functionName: 'transfer',
|
|
174
|
+
},
|
|
175
|
+
})));
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Build a HAL action for a swap using 0x API.
|
|
179
|
+
*
|
|
180
|
+
* This generates an action with an optional approval step (conditional
|
|
181
|
+
* on whether the wallet has already approved the spender).
|
|
182
|
+
*/
|
|
183
|
+
buildSwapAction(options) {
|
|
184
|
+
const includeApproval = options.includeApproval !== false;
|
|
185
|
+
const swapCall = [
|
|
186
|
+
'swap',
|
|
187
|
+
{
|
|
188
|
+
blockchain: options.blockchain,
|
|
189
|
+
sellTokenAddress: options.sellToken,
|
|
190
|
+
sellTokenAmount: 'amount',
|
|
191
|
+
buyTokenAddress: options.buyToken,
|
|
192
|
+
walletAddress: ['user-wallet'],
|
|
193
|
+
divideDecimals: false,
|
|
194
|
+
},
|
|
195
|
+
];
|
|
196
|
+
const swapStep = writeFunction([
|
|
197
|
+
'getPath',
|
|
198
|
+
{
|
|
199
|
+
object: swapCall,
|
|
200
|
+
path: ['quote', ['swapSteps', 'swap']],
|
|
201
|
+
},
|
|
202
|
+
]);
|
|
203
|
+
const steps = [];
|
|
204
|
+
if (includeApproval) {
|
|
205
|
+
// Conditional approval: only add if approvalRequired is true
|
|
206
|
+
steps.push([
|
|
207
|
+
'if',
|
|
208
|
+
[
|
|
209
|
+
'getPath',
|
|
210
|
+
{
|
|
211
|
+
object: swapCall,
|
|
212
|
+
path: ['quote', ['swapSteps', 'approval', 'approvalRequired']],
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
writeFunction([
|
|
216
|
+
'getPath',
|
|
217
|
+
{
|
|
218
|
+
object: swapCall,
|
|
219
|
+
path: ['quote', ['swapSteps', 'approval']],
|
|
220
|
+
},
|
|
221
|
+
]),
|
|
222
|
+
null,
|
|
223
|
+
]);
|
|
224
|
+
}
|
|
225
|
+
steps.push(swapStep);
|
|
226
|
+
return doBlock(importStdlib('herd', ['swap', 'write-function', 'user-wallet']), importStdlib('object', ['getPath']), exportExpr(define('main', [
|
|
227
|
+
{ name: 'amount', type: 'uint256', meta: { description: 'Sell amount (human-readable)' } },
|
|
228
|
+
], [
|
|
229
|
+
define('batch0', [], steps, { isBatch: true, batchLabel: 'Swap Tokens' }),
|
|
230
|
+
])));
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Build a HAL read adapter for checking an ERC-20 balance.
|
|
234
|
+
*/
|
|
235
|
+
buildBalanceReader(options) {
|
|
236
|
+
return doBlock(importStdlib('herd', ['encode-calldata', 'read-function']), exportExpr(define('checkBalance', [
|
|
237
|
+
{ name: 'account', type: 'address', meta: { description: 'Wallet to check' } },
|
|
238
|
+
], coerce({ balance: 'uint256' }, readFunction(encodeCalldata({
|
|
239
|
+
blockchain: options.blockchain,
|
|
240
|
+
contractAddress: options.token,
|
|
241
|
+
functionSignature: SELECTORS.balanceOf,
|
|
242
|
+
args: { account: 'account' },
|
|
243
|
+
inputAbi: [{ name: 'account', type: 'address' }],
|
|
244
|
+
functionName: 'balanceOf',
|
|
245
|
+
}), [{ name: 'balance', type: 'uint256' }])), {
|
|
246
|
+
description: 'Check ERC-20 token balance',
|
|
247
|
+
originContract: {
|
|
248
|
+
address: options.token,
|
|
249
|
+
blockchain: options.blockchain,
|
|
250
|
+
contractName: 'ERC20',
|
|
251
|
+
functionName: 'balanceOf',
|
|
252
|
+
},
|
|
253
|
+
})));
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Build a HAL read adapter for checking allowance.
|
|
257
|
+
*/
|
|
258
|
+
buildAllowanceReader(options) {
|
|
259
|
+
return doBlock(importStdlib('herd', ['encode-calldata', 'read-function']), exportExpr(define('checkAllowance', [
|
|
260
|
+
{ name: 'owner', type: 'address' },
|
|
261
|
+
{ name: 'spender', type: 'address' },
|
|
262
|
+
], coerce({ remaining: 'uint256' }, readFunction(encodeCalldata({
|
|
263
|
+
blockchain: options.blockchain,
|
|
264
|
+
contractAddress: options.token,
|
|
265
|
+
functionSignature: SELECTORS.allowance,
|
|
266
|
+
args: { owner: 'owner', spender: 'spender' },
|
|
267
|
+
inputAbi: [
|
|
268
|
+
{ name: 'owner', type: 'address' },
|
|
269
|
+
{ name: 'spender', type: 'address' },
|
|
270
|
+
],
|
|
271
|
+
functionName: 'allowance',
|
|
272
|
+
}), [{ name: 'remaining', type: 'uint256' }])), {
|
|
273
|
+
description: 'Check ERC-20 token allowance',
|
|
274
|
+
originContract: {
|
|
275
|
+
address: options.token,
|
|
276
|
+
blockchain: options.blockchain,
|
|
277
|
+
contractName: 'ERC20',
|
|
278
|
+
functionName: 'allowance',
|
|
279
|
+
},
|
|
280
|
+
})));
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Build a HAL approve adapter.
|
|
284
|
+
*/
|
|
285
|
+
buildApproveAdapter(options) {
|
|
286
|
+
const decimals = options.decimals ?? 18;
|
|
287
|
+
return doBlock(importStdlib('herd', ['encode-calldata', 'decimals']), exportExpr(define('approve', [
|
|
288
|
+
{ name: 'spender', type: 'address', meta: { description: 'Spender address' } },
|
|
289
|
+
{ name: 'amount', type: 'uint256', meta: { description: 'Approval amount', decimals } },
|
|
290
|
+
], batchCallData(false, '0', encodeCalldata({
|
|
291
|
+
blockchain: options.blockchain,
|
|
292
|
+
contractAddress: options.token,
|
|
293
|
+
functionSignature: SELECTORS.approve,
|
|
294
|
+
args: {
|
|
295
|
+
spender: 'spender',
|
|
296
|
+
value: coerce('uint256', decimalsExpr('amount', decimals)),
|
|
297
|
+
},
|
|
298
|
+
inputAbi: [
|
|
299
|
+
{ name: 'spender', type: 'address' },
|
|
300
|
+
{ name: 'value', type: 'uint256' },
|
|
301
|
+
],
|
|
302
|
+
functionName: 'approve',
|
|
303
|
+
})), {
|
|
304
|
+
description: `Approve ${options.tokenName || 'token'} spending`,
|
|
305
|
+
originContract: {
|
|
306
|
+
address: options.token,
|
|
307
|
+
blockchain: options.blockchain,
|
|
308
|
+
contractName: options.tokenName || 'ERC20',
|
|
309
|
+
functionName: 'approve',
|
|
310
|
+
},
|
|
311
|
+
})));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// =========================================================================
|
|
315
|
+
// Simulation Result Parsing
|
|
316
|
+
// =========================================================================
|
|
317
|
+
/**
|
|
318
|
+
* Parse a raw HAL simulation response into typed structure.
|
|
319
|
+
*/
|
|
320
|
+
export function parseSimulationResult(raw) {
|
|
321
|
+
const data = (raw || {});
|
|
322
|
+
const oplog = (data.entries || data.oplog || []).map((entry) => ({
|
|
323
|
+
operationId: entry.operationId || '',
|
|
324
|
+
functionName: entry.functionName || '',
|
|
325
|
+
status: entry.status || 'success',
|
|
326
|
+
timestamp: entry.timestamp || entry.timestampIso || '',
|
|
327
|
+
args: entry.args,
|
|
328
|
+
result: entry.result,
|
|
329
|
+
}));
|
|
330
|
+
return {
|
|
331
|
+
success: data.executionStatus === 'completed' || data.success === true,
|
|
332
|
+
finalResult: data.finalResult ?? data.result ?? null,
|
|
333
|
+
oplog,
|
|
334
|
+
error: data.error || null,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
//# sourceMappingURL=herd-hal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"herd-hal.js","sourceRoot":"","sources":["../src/herd-hal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAWH,4EAA4E;AAC5E,yCAAyC;AACzC,4EAA4E;AAE5E,MAAM,SAAS,GAAG;IAChB,QAAQ,EAAE,YAAY,EAAU,4BAA4B;IAC5D,OAAO,EAAE,YAAY,EAAW,2BAA2B;IAC3D,SAAS,EAAE,YAAY,EAAS,qBAAqB;IACrD,SAAS,EAAE,YAAY,EAAS,6BAA6B;IAC7D,WAAW,EAAE,YAAY,EAAO,gBAAgB;CACxC,CAAC;AAEX,4EAA4E;AAC5E,kDAAkD;AAClD,4EAA4E;AAE5E;;GAEG;AACH,SAAS,OAAO,CAAC,GAAG,KAAsB;IACxC,OAAO,CAAC,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,MAAc,EAAE,SAAmB;IACvD,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CACb,IAAY,EACZ,UAAiF,EACjF,IAAa,EACb,IAA8B;IAE9B,MAAM,GAAG,GAA4B,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAChE,IAAI,IAAI;QAAE,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,SAAS,UAAU,CAAC,IAAmB;IACrC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,SAAS,MAAM,CAAC,IAAa,EAAE,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