@huma-finance/soroban-huma-config 0.0.8-beta.2
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 +54 -0
- package/dist/cjs/index.d.ts +451 -0
- package/dist/cjs/index.js +94 -0
- package/dist/esm/index.d.ts +451 -0
- package/dist/esm/index.js +76 -0
- package/dist/esm/package.json +1 -0
- package/dist/scripts/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/scripts/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/scripts/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +451 -0
- package/package.json +25 -0
- package/scripts/build.mjs +37 -0
- package/scripts/tsconfig.cjs.json +7 -0
- package/scripts/tsconfig.esm.json +7 -0
- package/scripts/tsconfig.types.json +8 -0
- package/src/index.ts +560 -0
- package/tsconfig.json +14 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# tb-humaConfig JS
|
|
2
|
+
|
|
3
|
+
JS library for interacting with [Soroban](https://soroban.stellar.org/) smart contract `tb-humaConfig` via Soroban RPC.
|
|
4
|
+
|
|
5
|
+
This library was automatically generated by Soroban CLI using a command similar to:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
soroban contract bindings ts \
|
|
9
|
+
--rpc-url https://soroban-testnet.stellar.org:443 \
|
|
10
|
+
--network-passphrase "Test SDF Network ; September 2015" \
|
|
11
|
+
--contract-id CD6E7GFRHBQ627ZXK5YNMQFBBLFCXBBEU6VYXBSQ77CYOYQC5UV3HS76 \
|
|
12
|
+
--output-dir ./path/to/tb-humaConfig
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The network passphrase and contract ID are exported from [index.ts](./src/index.ts) in the `networks` constant. If you are the one who generated this library and you know that this contract is also deployed to other networks, feel free to update `networks` with other valid options. This will help your contract consumers use this library more easily.
|
|
16
|
+
|
|
17
|
+
# To publish or not to publish
|
|
18
|
+
|
|
19
|
+
This library is suitable for publishing to NPM. You can publish it to NPM using the `npm publish` command.
|
|
20
|
+
|
|
21
|
+
But you don't need to publish this library to NPM to use it. You can add it to your project's `package.json` using a file path:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"tb-humaConfig": "./path/to/this/folder"
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
However, we've actually encountered [frustration](https://github.com/stellar/soroban-example-dapp/pull/117#discussion_r1232873560) using local libraries with NPM in this way. Though it seems a bit messy, we suggest generating the library directly to your `node_modules` folder automatically after each install by using a `postinstall` script. We've had the least trouble with this approach. NPM will automatically remove what it sees as erroneous directories during the `install` step, and then regenerate them when it gets to your `postinstall` step, which will keep the library up-to-date with your contract.
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
"scripts": {
|
|
33
|
+
"postinstall": "soroban contract bindings ts --rpc-url https://soroban-testnet.stellar.org:443 --network-passphrase \"Test SDF Network ; September 2015\" --id CD6E7GFRHBQ627ZXK5YNMQFBBLFCXBBEU6VYXBSQ77CYOYQC5UV3HS76 --name tb-humaConfig"
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Obviously you need to adjust the above command based on the actual command you used to generate the library.
|
|
38
|
+
|
|
39
|
+
# Use it
|
|
40
|
+
|
|
41
|
+
Now that you have your library up-to-date and added to your project, you can import it in a file and see inline documentation for all of its exported methods:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
import { Contract, networks } from "tb-humaConfig"
|
|
45
|
+
|
|
46
|
+
const contract = new Contract({
|
|
47
|
+
...networks.futurenet, // for example; check which networks this library exports
|
|
48
|
+
rpcUrl: '...', // use your own, or find one for testing at https://soroban.stellar.org/docs/reference/rpc#public-rpc-providers
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
contract.|
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
As long as your editor is configured to show JavaScript/TypeScript documentation, you can pause your typing at that `|` to get a list of all exports and inline-documentation for each. It exports a separate [async](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) function for each method in the smart contract, with documentation for each generated from the comments the contract's author included in the original source code.
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { AssembledTransaction, ContractClient, ContractClientOptions } from '@stellar/stellar-sdk/lib/contract_client/index.js';
|
|
2
|
+
import type { u32 } from '@stellar/stellar-sdk/lib/contract_client';
|
|
3
|
+
export * from '@stellar/stellar-sdk';
|
|
4
|
+
export * from '@stellar/stellar-sdk/lib/contract_client/index.js';
|
|
5
|
+
export * from '@stellar/stellar-sdk/lib/rust_types/index.js';
|
|
6
|
+
export declare const networks: {
|
|
7
|
+
readonly testnet: {
|
|
8
|
+
readonly networkPassphrase: "Test SDF Network ; September 2015";
|
|
9
|
+
readonly contractId: "CD6E7GFRHBQ627ZXK5YNMQFBBLFCXBBEU6VYXBSQ77CYOYQC5UV3HS76";
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const Errors: {
|
|
13
|
+
1: {
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
2: {
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
3: {
|
|
20
|
+
message: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export type HumaConfigDataKey = {
|
|
24
|
+
tag: 'HumaOwner';
|
|
25
|
+
values: void;
|
|
26
|
+
} | {
|
|
27
|
+
tag: 'HumaTreasury';
|
|
28
|
+
values: void;
|
|
29
|
+
} | {
|
|
30
|
+
tag: 'Sentinel';
|
|
31
|
+
values: void;
|
|
32
|
+
} | {
|
|
33
|
+
tag: 'ProtocolFeeInBps';
|
|
34
|
+
values: void;
|
|
35
|
+
} | {
|
|
36
|
+
tag: 'IsPaused';
|
|
37
|
+
values: void;
|
|
38
|
+
} | {
|
|
39
|
+
tag: 'Pauser';
|
|
40
|
+
values: readonly [string];
|
|
41
|
+
} | {
|
|
42
|
+
tag: 'ValidLiquidityAsset';
|
|
43
|
+
values: readonly [string];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The Huma protocol has been initialized.
|
|
47
|
+
* # Fields
|
|
48
|
+
* * `huma_owner` - The address of the Huma owner account.
|
|
49
|
+
* * `huma_treasury` - The address of the Huma treasury account.
|
|
50
|
+
* * `sentinel` - The address of the Sentinel service account.
|
|
51
|
+
*/
|
|
52
|
+
export interface ProtocolInitializedEvent {
|
|
53
|
+
huma_owner: string;
|
|
54
|
+
huma_treasury: string;
|
|
55
|
+
sentinel: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The Huma protocol has been paused.
|
|
59
|
+
* # Fields
|
|
60
|
+
* * `paused` - Whether the protocol is paused. The value acts as a placeholder only to get around
|
|
61
|
+
* the restriction that `contracttype` doesn't allow empty structs. The value is always `true`.
|
|
62
|
+
*/
|
|
63
|
+
export interface ProtocolPausedEvent {
|
|
64
|
+
paused: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The Huma protocol has been unpaused.
|
|
68
|
+
* # Fields
|
|
69
|
+
* * `paused` - Whether the protocol is paused. The value acts as a placeholder only to get around
|
|
70
|
+
* the restriction that `contractype` doesn't allow empty structs. The value is always `false`.
|
|
71
|
+
*/
|
|
72
|
+
export interface ProtocolUnpausedEvent {
|
|
73
|
+
paused: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The treasury address for the Huma protocol has changed.
|
|
77
|
+
* # Fields
|
|
78
|
+
* * `treasury` - The address of the new Huma treasury.
|
|
79
|
+
*/
|
|
80
|
+
export interface HumaTreasuryChangedEvent {
|
|
81
|
+
treasury: string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A pauser has been added. A pauser is someone who can pause the protocol.
|
|
85
|
+
* # Fields
|
|
86
|
+
* * `pauser` - The address of the pauser being added.
|
|
87
|
+
*/
|
|
88
|
+
export interface PauserAddedEvent {
|
|
89
|
+
pauser: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* A pauser has been removed.
|
|
93
|
+
* # Fields
|
|
94
|
+
* * `pauser` - The address of the pauser being removed.
|
|
95
|
+
*/
|
|
96
|
+
export interface PauserRemovedEvent {
|
|
97
|
+
pauser: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* New underlying asset supported by the protocol is added.
|
|
101
|
+
* # Fields
|
|
102
|
+
* * `asset` - The address of the liquidity asset being added.
|
|
103
|
+
*/
|
|
104
|
+
export interface LiquidityAssetAddedEvent {
|
|
105
|
+
asset: string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Remove the asset that is no longer supported by the protocol.
|
|
109
|
+
* # Fields
|
|
110
|
+
* * `asset` - The address of the liquidity asset being removed.
|
|
111
|
+
*/
|
|
112
|
+
export interface LiquidityAssetRemovedEvent {
|
|
113
|
+
asset: string;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The account for the Sentinel Service has been changed.
|
|
117
|
+
* # Fields
|
|
118
|
+
* * `account` - The address of the new Sentinel Service.
|
|
119
|
+
*/
|
|
120
|
+
export interface SentinelServiceAccountChangedEvent {
|
|
121
|
+
account: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The protocol fee has been changed.
|
|
125
|
+
* # Fields
|
|
126
|
+
* * `old_fee_bps` - The old protocol fee in bps.
|
|
127
|
+
* * `new_fee_bps` - The new protocol fee in bps.
|
|
128
|
+
*/
|
|
129
|
+
export interface ProtocolFeeChangedEvent {
|
|
130
|
+
new_fee_bps: u32;
|
|
131
|
+
old_fee_bps: u32;
|
|
132
|
+
}
|
|
133
|
+
export interface Client {
|
|
134
|
+
/**
|
|
135
|
+
* Construct and simulate a initialize transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
136
|
+
*/
|
|
137
|
+
initialize: ({ huma_owner, huma_treasury, sentinel, }: {
|
|
138
|
+
huma_owner: string;
|
|
139
|
+
huma_treasury: string;
|
|
140
|
+
sentinel: string;
|
|
141
|
+
}, options?: {
|
|
142
|
+
/**
|
|
143
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
144
|
+
*/
|
|
145
|
+
fee?: number;
|
|
146
|
+
/**
|
|
147
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
148
|
+
*/
|
|
149
|
+
timeoutInSeconds?: number;
|
|
150
|
+
/**
|
|
151
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
152
|
+
*/
|
|
153
|
+
simulate?: boolean;
|
|
154
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
155
|
+
/**
|
|
156
|
+
* Construct and simulate a get_huma_owner transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
157
|
+
*/
|
|
158
|
+
get_huma_owner: (options?: {
|
|
159
|
+
/**
|
|
160
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
161
|
+
*/
|
|
162
|
+
fee?: number;
|
|
163
|
+
/**
|
|
164
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
165
|
+
*/
|
|
166
|
+
timeoutInSeconds?: number;
|
|
167
|
+
/**
|
|
168
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
169
|
+
*/
|
|
170
|
+
simulate?: boolean;
|
|
171
|
+
}) => Promise<AssembledTransaction<string>>;
|
|
172
|
+
/**
|
|
173
|
+
* Construct and simulate a get_huma_treasury transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
174
|
+
*/
|
|
175
|
+
get_huma_treasury: (options?: {
|
|
176
|
+
/**
|
|
177
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
178
|
+
*/
|
|
179
|
+
fee?: number;
|
|
180
|
+
/**
|
|
181
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
182
|
+
*/
|
|
183
|
+
timeoutInSeconds?: number;
|
|
184
|
+
/**
|
|
185
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
186
|
+
*/
|
|
187
|
+
simulate?: boolean;
|
|
188
|
+
}) => Promise<AssembledTransaction<string>>;
|
|
189
|
+
/**
|
|
190
|
+
* Construct and simulate a set_huma_treasury transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
191
|
+
*/
|
|
192
|
+
set_huma_treasury: ({ addr }: {
|
|
193
|
+
addr: string;
|
|
194
|
+
}, options?: {
|
|
195
|
+
/**
|
|
196
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
197
|
+
*/
|
|
198
|
+
fee?: number;
|
|
199
|
+
/**
|
|
200
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
201
|
+
*/
|
|
202
|
+
timeoutInSeconds?: number;
|
|
203
|
+
/**
|
|
204
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
205
|
+
*/
|
|
206
|
+
simulate?: boolean;
|
|
207
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
208
|
+
/**
|
|
209
|
+
* Construct and simulate a get_sentinel transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
210
|
+
*/
|
|
211
|
+
get_sentinel: (options?: {
|
|
212
|
+
/**
|
|
213
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
214
|
+
*/
|
|
215
|
+
fee?: number;
|
|
216
|
+
/**
|
|
217
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
218
|
+
*/
|
|
219
|
+
timeoutInSeconds?: number;
|
|
220
|
+
/**
|
|
221
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
222
|
+
*/
|
|
223
|
+
simulate?: boolean;
|
|
224
|
+
}) => Promise<AssembledTransaction<string>>;
|
|
225
|
+
/**
|
|
226
|
+
* Construct and simulate a set_sentinel transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
227
|
+
*/
|
|
228
|
+
set_sentinel: ({ addr }: {
|
|
229
|
+
addr: string;
|
|
230
|
+
}, options?: {
|
|
231
|
+
/**
|
|
232
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
233
|
+
*/
|
|
234
|
+
fee?: number;
|
|
235
|
+
/**
|
|
236
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
237
|
+
*/
|
|
238
|
+
timeoutInSeconds?: number;
|
|
239
|
+
/**
|
|
240
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
241
|
+
*/
|
|
242
|
+
simulate?: boolean;
|
|
243
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
244
|
+
/**
|
|
245
|
+
* Construct and simulate a is_protocol_paused transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
246
|
+
*/
|
|
247
|
+
is_protocol_paused: (options?: {
|
|
248
|
+
/**
|
|
249
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
250
|
+
*/
|
|
251
|
+
fee?: number;
|
|
252
|
+
/**
|
|
253
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
254
|
+
*/
|
|
255
|
+
timeoutInSeconds?: number;
|
|
256
|
+
/**
|
|
257
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
258
|
+
*/
|
|
259
|
+
simulate?: boolean;
|
|
260
|
+
}) => Promise<AssembledTransaction<boolean>>;
|
|
261
|
+
/**
|
|
262
|
+
* Construct and simulate a pause_protocol transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
263
|
+
*/
|
|
264
|
+
pause_protocol: ({ caller }: {
|
|
265
|
+
caller: string;
|
|
266
|
+
}, options?: {
|
|
267
|
+
/**
|
|
268
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
269
|
+
*/
|
|
270
|
+
fee?: number;
|
|
271
|
+
/**
|
|
272
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
273
|
+
*/
|
|
274
|
+
timeoutInSeconds?: number;
|
|
275
|
+
/**
|
|
276
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
277
|
+
*/
|
|
278
|
+
simulate?: boolean;
|
|
279
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
280
|
+
/**
|
|
281
|
+
* Construct and simulate a unpause_protocol transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
282
|
+
*/
|
|
283
|
+
unpause_protocol: (options?: {
|
|
284
|
+
/**
|
|
285
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
286
|
+
*/
|
|
287
|
+
fee?: number;
|
|
288
|
+
/**
|
|
289
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
290
|
+
*/
|
|
291
|
+
timeoutInSeconds?: number;
|
|
292
|
+
/**
|
|
293
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
294
|
+
*/
|
|
295
|
+
simulate?: boolean;
|
|
296
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
297
|
+
/**
|
|
298
|
+
* Construct and simulate a is_pauser transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
299
|
+
*/
|
|
300
|
+
is_pauser: ({ addr }: {
|
|
301
|
+
addr: string;
|
|
302
|
+
}, options?: {
|
|
303
|
+
/**
|
|
304
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
305
|
+
*/
|
|
306
|
+
fee?: number;
|
|
307
|
+
/**
|
|
308
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
309
|
+
*/
|
|
310
|
+
timeoutInSeconds?: number;
|
|
311
|
+
/**
|
|
312
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
313
|
+
*/
|
|
314
|
+
simulate?: boolean;
|
|
315
|
+
}) => Promise<AssembledTransaction<boolean>>;
|
|
316
|
+
/**
|
|
317
|
+
* Construct and simulate a add_pauser transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
318
|
+
*/
|
|
319
|
+
add_pauser: ({ addr }: {
|
|
320
|
+
addr: string;
|
|
321
|
+
}, options?: {
|
|
322
|
+
/**
|
|
323
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
324
|
+
*/
|
|
325
|
+
fee?: number;
|
|
326
|
+
/**
|
|
327
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
328
|
+
*/
|
|
329
|
+
timeoutInSeconds?: number;
|
|
330
|
+
/**
|
|
331
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
332
|
+
*/
|
|
333
|
+
simulate?: boolean;
|
|
334
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
335
|
+
/**
|
|
336
|
+
* Construct and simulate a remove_pauser transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
337
|
+
*/
|
|
338
|
+
remove_pauser: ({ addr }: {
|
|
339
|
+
addr: string;
|
|
340
|
+
}, options?: {
|
|
341
|
+
/**
|
|
342
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
343
|
+
*/
|
|
344
|
+
fee?: number;
|
|
345
|
+
/**
|
|
346
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
347
|
+
*/
|
|
348
|
+
timeoutInSeconds?: number;
|
|
349
|
+
/**
|
|
350
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
351
|
+
*/
|
|
352
|
+
simulate?: boolean;
|
|
353
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
354
|
+
/**
|
|
355
|
+
* Construct and simulate a is_asset_valid transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
356
|
+
*/
|
|
357
|
+
is_asset_valid: ({ addr }: {
|
|
358
|
+
addr: string;
|
|
359
|
+
}, options?: {
|
|
360
|
+
/**
|
|
361
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
362
|
+
*/
|
|
363
|
+
fee?: number;
|
|
364
|
+
/**
|
|
365
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
366
|
+
*/
|
|
367
|
+
timeoutInSeconds?: number;
|
|
368
|
+
/**
|
|
369
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
370
|
+
*/
|
|
371
|
+
simulate?: boolean;
|
|
372
|
+
}) => Promise<AssembledTransaction<boolean>>;
|
|
373
|
+
/**
|
|
374
|
+
* Construct and simulate a set_liquidity_asset transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
375
|
+
*/
|
|
376
|
+
set_liquidity_asset: ({ addr, valid }: {
|
|
377
|
+
addr: string;
|
|
378
|
+
valid: boolean;
|
|
379
|
+
}, options?: {
|
|
380
|
+
/**
|
|
381
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
382
|
+
*/
|
|
383
|
+
fee?: number;
|
|
384
|
+
/**
|
|
385
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
386
|
+
*/
|
|
387
|
+
timeoutInSeconds?: number;
|
|
388
|
+
/**
|
|
389
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
390
|
+
*/
|
|
391
|
+
simulate?: boolean;
|
|
392
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
393
|
+
/**
|
|
394
|
+
* Construct and simulate a get_protocol_fee_bps transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
395
|
+
*/
|
|
396
|
+
get_protocol_fee_bps: (options?: {
|
|
397
|
+
/**
|
|
398
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
399
|
+
*/
|
|
400
|
+
fee?: number;
|
|
401
|
+
/**
|
|
402
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
403
|
+
*/
|
|
404
|
+
timeoutInSeconds?: number;
|
|
405
|
+
/**
|
|
406
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
407
|
+
*/
|
|
408
|
+
simulate?: boolean;
|
|
409
|
+
}) => Promise<AssembledTransaction<u32>>;
|
|
410
|
+
/**
|
|
411
|
+
* Construct and simulate a set_protocol_fee_bps transaction. Returns an `AssembledTransaction` object which will have a `result` field containing the result of the simulation. If this transaction changes contract state, you will need to call `signAndSend()` on the returned object.
|
|
412
|
+
*/
|
|
413
|
+
set_protocol_fee_bps: ({ fee_bps }: {
|
|
414
|
+
fee_bps: u32;
|
|
415
|
+
}, options?: {
|
|
416
|
+
/**
|
|
417
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
418
|
+
*/
|
|
419
|
+
fee?: number;
|
|
420
|
+
/**
|
|
421
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
422
|
+
*/
|
|
423
|
+
timeoutInSeconds?: number;
|
|
424
|
+
/**
|
|
425
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
426
|
+
*/
|
|
427
|
+
simulate?: boolean;
|
|
428
|
+
}) => Promise<AssembledTransaction<null>>;
|
|
429
|
+
}
|
|
430
|
+
export declare class Client extends ContractClient {
|
|
431
|
+
readonly options: ContractClientOptions;
|
|
432
|
+
constructor(options: ContractClientOptions);
|
|
433
|
+
readonly fromJSON: {
|
|
434
|
+
initialize: (json: string) => AssembledTransaction<null>;
|
|
435
|
+
get_huma_owner: (json: string) => AssembledTransaction<string>;
|
|
436
|
+
get_huma_treasury: (json: string) => AssembledTransaction<string>;
|
|
437
|
+
set_huma_treasury: (json: string) => AssembledTransaction<null>;
|
|
438
|
+
get_sentinel: (json: string) => AssembledTransaction<string>;
|
|
439
|
+
set_sentinel: (json: string) => AssembledTransaction<null>;
|
|
440
|
+
is_protocol_paused: (json: string) => AssembledTransaction<boolean>;
|
|
441
|
+
pause_protocol: (json: string) => AssembledTransaction<null>;
|
|
442
|
+
unpause_protocol: (json: string) => AssembledTransaction<null>;
|
|
443
|
+
is_pauser: (json: string) => AssembledTransaction<boolean>;
|
|
444
|
+
add_pauser: (json: string) => AssembledTransaction<null>;
|
|
445
|
+
remove_pauser: (json: string) => AssembledTransaction<null>;
|
|
446
|
+
is_asset_valid: (json: string) => AssembledTransaction<boolean>;
|
|
447
|
+
set_liquidity_asset: (json: string) => AssembledTransaction<null>;
|
|
448
|
+
get_protocol_fee_bps: (json: string) => AssembledTransaction<number>;
|
|
449
|
+
set_protocol_fee_bps: (json: string) => AssembledTransaction<null>;
|
|
450
|
+
};
|
|
451
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.Client = exports.Errors = exports.networks = void 0;
|
|
18
|
+
const stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
19
|
+
const buffer_1 = require("buffer");
|
|
20
|
+
const index_js_1 = require("@stellar/stellar-sdk/lib/contract_client/index.js");
|
|
21
|
+
__exportStar(require("@stellar/stellar-sdk"), exports);
|
|
22
|
+
__exportStar(require("@stellar/stellar-sdk/lib/contract_client/index.js"), exports);
|
|
23
|
+
__exportStar(require("@stellar/stellar-sdk/lib/rust_types/index.js"), exports);
|
|
24
|
+
if (typeof window !== 'undefined') {
|
|
25
|
+
//@ts-ignore Buffer exists
|
|
26
|
+
window.Buffer = window.Buffer || buffer_1.Buffer;
|
|
27
|
+
}
|
|
28
|
+
exports.networks = {
|
|
29
|
+
testnet: {
|
|
30
|
+
networkPassphrase: 'Test SDF Network ; September 2015',
|
|
31
|
+
contractId: 'CD6E7GFRHBQ627ZXK5YNMQFBBLFCXBBEU6VYXBSQ77CYOYQC5UV3HS76',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
exports.Errors = {
|
|
35
|
+
1: { message: '' },
|
|
36
|
+
2: { message: '' },
|
|
37
|
+
3: { message: '' },
|
|
38
|
+
};
|
|
39
|
+
class Client extends index_js_1.ContractClient {
|
|
40
|
+
options;
|
|
41
|
+
constructor(options) {
|
|
42
|
+
super(new stellar_sdk_1.ContractSpec([
|
|
43
|
+
'AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAAAwAAAAAAAAAKaHVtYV9vd25lcgAAAAAAEwAAAAAAAAANaHVtYV90cmVhc3VyeQAAAAAAABMAAAAAAAAACHNlbnRpbmVsAAAAEwAAAAA=',
|
|
44
|
+
'AAAAAAAAAAAAAAAOZ2V0X2h1bWFfb3duZXIAAAAAAAAAAAABAAAAEw==',
|
|
45
|
+
'AAAAAAAAAAAAAAARZ2V0X2h1bWFfdHJlYXN1cnkAAAAAAAAAAAAAAQAAABM=',
|
|
46
|
+
'AAAAAAAAAAAAAAARc2V0X2h1bWFfdHJlYXN1cnkAAAAAAAABAAAAAAAAAARhZGRyAAAAEwAAAAA=',
|
|
47
|
+
'AAAAAAAAAAAAAAAMZ2V0X3NlbnRpbmVsAAAAAAAAAAEAAAAT',
|
|
48
|
+
'AAAAAAAAAAAAAAAMc2V0X3NlbnRpbmVsAAAAAQAAAAAAAAAEYWRkcgAAABMAAAAA',
|
|
49
|
+
'AAAAAAAAAAAAAAASaXNfcHJvdG9jb2xfcGF1c2VkAAAAAAAAAAAAAQAAAAE=',
|
|
50
|
+
'AAAAAAAAAAAAAAAOcGF1c2VfcHJvdG9jb2wAAAAAAAEAAAAAAAAABmNhbGxlcgAAAAAAEwAAAAA=',
|
|
51
|
+
'AAAAAAAAAAAAAAAQdW5wYXVzZV9wcm90b2NvbAAAAAAAAAAA',
|
|
52
|
+
'AAAAAAAAAAAAAAAJaXNfcGF1c2VyAAAAAAAAAQAAAAAAAAAEYWRkcgAAABMAAAABAAAAAQ==',
|
|
53
|
+
'AAAAAAAAAAAAAAAKYWRkX3BhdXNlcgAAAAAAAQAAAAAAAAAEYWRkcgAAABMAAAAA',
|
|
54
|
+
'AAAAAAAAAA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kFscmVhZHlJbml0aWFsaXplZAAAAAAAAQAAAAAAAAAgQXV0aG9yaXplZENvbnRyYWN0Q2FsbGVyUmVxdWlyZWQAAABP',
|
|
72
|
+
]), options);
|
|
73
|
+
this.options = options;
|
|
74
|
+
}
|
|
75
|
+
fromJSON = {
|
|
76
|
+
initialize: (this.txFromJSON),
|
|
77
|
+
get_huma_owner: (this.txFromJSON),
|
|
78
|
+
get_huma_treasury: (this.txFromJSON),
|
|
79
|
+
set_huma_treasury: (this.txFromJSON),
|
|
80
|
+
get_sentinel: (this.txFromJSON),
|
|
81
|
+
set_sentinel: (this.txFromJSON),
|
|
82
|
+
is_protocol_paused: (this.txFromJSON),
|
|
83
|
+
pause_protocol: (this.txFromJSON),
|
|
84
|
+
unpause_protocol: (this.txFromJSON),
|
|
85
|
+
is_pauser: (this.txFromJSON),
|
|
86
|
+
add_pauser: (this.txFromJSON),
|
|
87
|
+
remove_pauser: (this.txFromJSON),
|
|
88
|
+
is_asset_valid: (this.txFromJSON),
|
|
89
|
+
set_liquidity_asset: (this.txFromJSON),
|
|
90
|
+
get_protocol_fee_bps: (this.txFromJSON),
|
|
91
|
+
set_protocol_fee_bps: (this.txFromJSON),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
exports.Client = Client;
|