@allbridge/bridge-core-sdk 3.15.4 → 3.16.0-alpha.1
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/browser/index.js +3 -3
- package/dist/browser/index.js.map +4 -4
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +4 -4
- package/dist/src/services/bridge/srb/index.js +11 -10
- package/dist/src/services/bridge/srb/index.js.map +1 -1
- package/dist/src/services/bridge/utils.js +1 -1
- package/dist/src/services/bridge/utils.js.map +1 -1
- package/dist/src/services/liquidity-pool/srb/index.js +17 -14
- package/dist/src/services/liquidity-pool/srb/index.js.map +1 -1
- package/dist/src/services/models/srb/bridge-contract.d.ts +801 -0
- package/dist/src/services/models/srb/{bridge.js → bridge-contract.js} +49 -97
- package/dist/src/services/models/srb/bridge-contract.js.map +1 -0
- package/dist/src/services/models/srb/gas-oracle-contract.d.ts +350 -0
- package/dist/src/services/models/srb/gas-oracle-contract.js +87 -0
- package/dist/src/services/models/srb/gas-oracle-contract.js.map +1 -0
- package/dist/src/services/models/srb/messenger-contract.d.ts +573 -0
- package/dist/src/services/models/srb/messenger-contract.js +111 -0
- package/dist/src/services/models/srb/messenger-contract.js.map +1 -0
- package/dist/src/services/models/srb/pool-contract.d.ts +690 -0
- package/dist/src/services/models/srb/pool-contract.js +125 -0
- package/dist/src/services/models/srb/pool-contract.js.map +1 -0
- package/dist/src/services/models/srb/token-contract.d.ts +437 -160
- package/dist/src/services/models/srb/token-contract.js +41 -288
- package/dist/src/services/models/srb/token-contract.js.map +1 -1
- package/dist/src/services/models/srb/utils.d.ts +6 -0
- package/dist/src/services/models/srb/utils.js +35 -0
- package/dist/src/services/models/srb/utils.js.map +1 -0
- package/dist/src/services/token/srb/index.js +1 -1
- package/dist/src/services/token/srb/index.js.map +1 -1
- package/dist/src/utils/srb/index.d.ts +5 -6
- package/dist/src/utils/srb/index.js +1 -1
- package/dist/src/utils/srb/index.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +2 -2
- package/dist/src/services/models/srb/bridge.d.ts +0 -169
- package/dist/src/services/models/srb/bridge.js.map +0 -1
- package/dist/src/services/models/srb/pool.d.ts +0 -293
- package/dist/src/services/models/srb/pool.js +0 -233
- package/dist/src/services/models/srb/pool.js.map +0 -1
- package/dist/src/services/utils/srb/assembled-tx.d.ts +0 -73
- package/dist/src/services/utils/srb/assembled-tx.js +0 -143
- package/dist/src/services/utils/srb/assembled-tx.js.map +0 -1
- package/dist/src/services/utils/srb/build-tx.d.ts +0 -48
- package/dist/src/services/utils/srb/build-tx.js +0 -62
- package/dist/src/services/utils/srb/build-tx.js.map +0 -1
- package/dist/src/services/utils/srb/method-options.d.ts +0 -47
- package/dist/src/services/utils/srb/method-options.js +0 -5
- package/dist/src/services/utils/srb/method-options.js.map +0 -1
|
@@ -1,35 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
-
};
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.BridgeContract = exports.Errors =
|
|
19
|
-
const stellar_sdk_1 = require("stellar-sdk");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
__exportStar(require("../../utils/srb/assembled-tx"), exports);
|
|
23
|
-
__exportStar(require("../../utils/srb/method-options"), exports);
|
|
24
|
-
exports.networks = {
|
|
25
|
-
testnet: {
|
|
26
|
-
networkPassphrase: "Test SDF Network ; September 2015",
|
|
27
|
-
contractId: "CBSEMJH6FYPQFVZB7PAVJGSUU6G3RNU6WZHEENNU7I7FKV47W27DWGF5",
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
*/
|
|
3
|
+
exports.BridgeContract = exports.Errors = void 0;
|
|
4
|
+
const stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
5
|
+
var ContractSpec = stellar_sdk_1.contract.Spec;
|
|
6
|
+
var ContractClient = stellar_sdk_1.contract.Client;
|
|
33
7
|
exports.Errors = {
|
|
34
8
|
0: { message: "" },
|
|
35
9
|
1: { message: "" },
|
|
@@ -41,6 +15,9 @@ exports.Errors = {
|
|
|
41
15
|
7: { message: "" },
|
|
42
16
|
8: { message: "" },
|
|
43
17
|
9: { message: "" },
|
|
18
|
+
10: { message: "" },
|
|
19
|
+
11: { message: "" },
|
|
20
|
+
12: { message: "" },
|
|
44
21
|
103: { message: "" },
|
|
45
22
|
104: { message: "" },
|
|
46
23
|
105: { message: "" },
|
|
@@ -69,72 +46,13 @@ exports.Errors = {
|
|
|
69
46
|
303: { message: "" },
|
|
70
47
|
400: { message: "" },
|
|
71
48
|
};
|
|
72
|
-
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
50
|
+
class BridgeContract extends ContractClient {
|
|
73
51
|
constructor(options) {
|
|
74
|
-
|
|
75
|
-
this.parsers = {
|
|
76
|
-
swapAndBridge: (result) => {
|
|
77
|
-
if (result instanceof assembled_tx_1.Err)
|
|
78
|
-
return result;
|
|
79
|
-
return new assembled_tx_1.Ok(this.spec.funcResToNative("swap_and_bridge", result));
|
|
80
|
-
},
|
|
81
|
-
swap: (result) => {
|
|
82
|
-
if (result instanceof assembled_tx_1.Err)
|
|
83
|
-
return result;
|
|
84
|
-
return new assembled_tx_1.Ok(this.spec.funcResToNative("swap", result));
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Construct and simulate a swap_and_bridge 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.
|
|
89
|
-
*/
|
|
90
|
-
this.swapAndBridge = async ({ sender, token, amount, recipient, destination_chain_id, receive_token, nonce, gas_amount, fee_token_amount, }, options = {}) => {
|
|
91
|
-
return await build_tx_1.XDRTransactionBuilder.xdrFromSimulation({
|
|
92
|
-
method: "swap_and_bridge",
|
|
93
|
-
args: this.spec.funcArgsToScVals("swap_and_bridge", {
|
|
94
|
-
sender: new stellar_sdk_1.Address(sender),
|
|
95
|
-
token: new stellar_sdk_1.Address(token),
|
|
96
|
-
amount,
|
|
97
|
-
recipient,
|
|
98
|
-
destination_chain_id,
|
|
99
|
-
receive_token,
|
|
100
|
-
nonce,
|
|
101
|
-
gas_amount,
|
|
102
|
-
fee_token_amount,
|
|
103
|
-
}),
|
|
104
|
-
account: sender,
|
|
105
|
-
...options,
|
|
106
|
-
...this.options,
|
|
107
|
-
errorTypes: exports.Errors,
|
|
108
|
-
// @ts-expect-error
|
|
109
|
-
parseResultXdr: this.parsers.swapAndBridge,
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
/**
|
|
113
|
-
* Construct and simulate a swap 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.
|
|
114
|
-
*/
|
|
115
|
-
this.swap = async ({ sender, amount, token, receive_token, recipient, receive_amount_min, }, options = {}) => {
|
|
116
|
-
return await build_tx_1.XDRTransactionBuilder.xdrFromSimulation({
|
|
117
|
-
method: "swap",
|
|
118
|
-
args: this.spec.funcArgsToScVals("swap", {
|
|
119
|
-
sender: new stellar_sdk_1.Address(sender),
|
|
120
|
-
amount,
|
|
121
|
-
token,
|
|
122
|
-
receive_token,
|
|
123
|
-
recipient: new stellar_sdk_1.Address(recipient),
|
|
124
|
-
receive_amount_min,
|
|
125
|
-
}),
|
|
126
|
-
account: sender,
|
|
127
|
-
...options,
|
|
128
|
-
...this.options,
|
|
129
|
-
errorTypes: exports.Errors,
|
|
130
|
-
// @ts-expect-error
|
|
131
|
-
parseResultXdr: this.parsers.swap,
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
this.spec = new stellar_sdk_1.ContractSpec([
|
|
52
|
+
super(new ContractSpec([
|
|
135
53
|
"AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABAAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAAAAAAltZXNzZW5nZXIAAAAAAAATAAAAAAAAAApnYXNfb3JhY2xlAAAAAAATAAAAAAAAAAxuYXRpdmVfdG9rZW4AAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
136
54
|
"AAAAAAAAAAAAAAAPc3dhcF9hbmRfYnJpZGdlAAAAAAkAAAAAAAAABnNlbmRlcgAAAAAAEwAAAAAAAAAFdG9rZW4AAAAAAAATAAAAAAAAAAZhbW91bnQAAAAAAAoAAAAAAAAACXJlY2lwaWVudAAAAAAAA+4AAAAgAAAAAAAAABRkZXN0aW5hdGlvbl9jaGFpbl9pZAAAAAQAAAAAAAAADXJlY2VpdmVfdG9rZW4AAAAAAAPuAAAAIAAAAAAAAAAFbm9uY2UAAAAAAAAMAAAAAAAAAApnYXNfYW1vdW50AAAAAAAKAAAAAAAAABBmZWVfdG9rZW5fYW1vdW50AAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
137
|
-
"
|
|
55
|
+
"AAA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UHJpbWFyeVNpZ25hdHVyZQAAAAEuAAAAAAAAABlJbnZhbGlkU2Vjb25kYXJ5U2lnbmF0dXJlAAAAAAABLwAAAAAAAAARTm9HYXNEYXRhRm9yQ2hhaW4AAAAAAAGQ",
|
|
96
|
+
]), options);
|
|
97
|
+
this.options = options;
|
|
98
|
+
this.fromJSON = {
|
|
99
|
+
initialize: (this.txFromJSON),
|
|
100
|
+
swap_and_bridge: (this.txFromJSON),
|
|
101
|
+
receive_tokens: (this.txFromJSON),
|
|
102
|
+
swap: (this.txFromJSON),
|
|
103
|
+
stop_swap: (this.txFromJSON),
|
|
104
|
+
start_swap: (this.txFromJSON),
|
|
105
|
+
set_gas_oracle: (this.txFromJSON),
|
|
106
|
+
set_stop_authority: (this.txFromJSON),
|
|
107
|
+
set_rebalancer: (this.txFromJSON),
|
|
108
|
+
set_messenger: (this.txFromJSON),
|
|
109
|
+
set_gas_usage: (this.txFromJSON),
|
|
110
|
+
register_bridge: (this.txFromJSON),
|
|
111
|
+
add_bridge_token: (this.txFromJSON),
|
|
112
|
+
remove_bridge_token: (this.txFromJSON),
|
|
113
|
+
add_pool: (this.txFromJSON),
|
|
114
|
+
withdraw_gas_tokens: (this.txFromJSON),
|
|
115
|
+
withdraw_bridging_fee_in_tokens: (this.txFromJSON),
|
|
116
|
+
has_processed_message: (this.txFromJSON),
|
|
117
|
+
has_received_message: (this.txFromJSON),
|
|
118
|
+
get_pool_address: (this.txFromJSON),
|
|
119
|
+
get_config: (this.txFromJSON),
|
|
120
|
+
get_stop_authority: (this.txFromJSON),
|
|
121
|
+
get_transaction_cost: (this.txFromJSON),
|
|
122
|
+
get_gas_usage: (this.txFromJSON),
|
|
123
|
+
get_admin: (this.txFromJSON),
|
|
124
|
+
get_gas_oracle: (this.txFromJSON),
|
|
125
|
+
get_another_bridge: (this.txFromJSON),
|
|
126
|
+
set_admin: (this.txFromJSON),
|
|
127
|
+
upgrade: (this.txFromJSON),
|
|
128
|
+
};
|
|
177
129
|
}
|
|
178
130
|
}
|
|
179
131
|
exports.BridgeContract = BridgeContract;
|
|
180
|
-
//# sourceMappingURL=bridge.js.map
|
|
132
|
+
//# sourceMappingURL=bridge-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-contract.js","sourceRoot":"","sources":["../../../../../src/services/models/srb/bridge-contract.ts"],"names":[],"mappings":";;;AAAA,sDAAgD;AAOhD,IAAO,YAAY,GAAG,sBAAQ,CAAC,IAAI,CAAC;AACpC,IAAO,cAAc,GAAG,sBAAQ,CAAC,MAAM,CAAC;AAoE3B,QAAA,MAAM,GAAG;IACpB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACnB,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACnB,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACnB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpB,GAAG,EAAE,EAAE,OAAO,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EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YAC5C,eAAe,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YAC9C,gBAAgB,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YAC/C,mBAAmB,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YAClD,QAAQ,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YACvC,mBAAmB,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YAClD,+BAA+B,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YAC9D,qBAAqB,EAAE,CAAA,IAAI,CAAC,UAA2B,CAAA;YACvD,oBAAoB,EAAE,CAAA,IAAI,CAAC,UAA2B,CAAA;YACtD,gBAAgB,EAAE,CAAA,IAAI,CAAC,UAA0B,CAAA;YACjD,UAAU,EAAE,CAAA,IAAI,CAAC,UAA0B,CAAA;YAC3C,kBAAkB,EAAE,CAAA,IAAI,CAAC,UAA0B,CAAA;YACnD,oBAAoB,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YACnD,aAAa,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YAC5C,SAAS,EAAE,CAAA,IAAI,CAAC,UAA0B,CAAA;YAC1C,cAAc,EAAE,CAAA,IAAI,CAAC,UAA0B,CAAA;YAC/C,kBAAkB,EAAE,CAAA,IAAI,CAAC,UAAiC,CAAA;YAC1D,SAAS,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;YACxC,OAAO,EAAE,CAAA,IAAI,CAAC,UAAwB,CAAA;SACvC,CAAC;IAhCF,CAAC;CAiCF;AAnFD,wCAmFC"}
|
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { contract } from "@stellar/stellar-sdk";
|
|
3
|
+
import u128 = contract.u128;
|
|
4
|
+
import u32 = contract.u32;
|
|
5
|
+
import AssembledTransaction = contract.AssembledTransaction;
|
|
6
|
+
import Result = contract.Result;
|
|
7
|
+
import Option = contract.Option;
|
|
8
|
+
import ContractClient = contract.Client;
|
|
9
|
+
import ContractClientOptions = contract.ClientOptions;
|
|
10
|
+
export interface ChainData {
|
|
11
|
+
gas_price: u128;
|
|
12
|
+
price: u128;
|
|
13
|
+
}
|
|
14
|
+
export type Admin = readonly [string];
|
|
15
|
+
export type GasOracleAddress = readonly [string];
|
|
16
|
+
export type GasUsage = readonly [Map<u32, u128>];
|
|
17
|
+
export type NativeToken = readonly [string];
|
|
18
|
+
export type StopAuthority = readonly [string];
|
|
19
|
+
export declare const Errors: {
|
|
20
|
+
0: {
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
1: {
|
|
24
|
+
message: string;
|
|
25
|
+
};
|
|
26
|
+
2: {
|
|
27
|
+
message: string;
|
|
28
|
+
};
|
|
29
|
+
3: {
|
|
30
|
+
message: string;
|
|
31
|
+
};
|
|
32
|
+
4: {
|
|
33
|
+
message: string;
|
|
34
|
+
};
|
|
35
|
+
5: {
|
|
36
|
+
message: string;
|
|
37
|
+
};
|
|
38
|
+
6: {
|
|
39
|
+
message: string;
|
|
40
|
+
};
|
|
41
|
+
7: {
|
|
42
|
+
message: string;
|
|
43
|
+
};
|
|
44
|
+
8: {
|
|
45
|
+
message: string;
|
|
46
|
+
};
|
|
47
|
+
9: {
|
|
48
|
+
message: string;
|
|
49
|
+
};
|
|
50
|
+
10: {
|
|
51
|
+
message: string;
|
|
52
|
+
};
|
|
53
|
+
11: {
|
|
54
|
+
message: string;
|
|
55
|
+
};
|
|
56
|
+
12: {
|
|
57
|
+
message: string;
|
|
58
|
+
};
|
|
59
|
+
103: {
|
|
60
|
+
message: string;
|
|
61
|
+
};
|
|
62
|
+
104: {
|
|
63
|
+
message: string;
|
|
64
|
+
};
|
|
65
|
+
105: {
|
|
66
|
+
message: string;
|
|
67
|
+
};
|
|
68
|
+
106: {
|
|
69
|
+
message: string;
|
|
70
|
+
};
|
|
71
|
+
107: {
|
|
72
|
+
message: string;
|
|
73
|
+
};
|
|
74
|
+
108: {
|
|
75
|
+
message: string;
|
|
76
|
+
};
|
|
77
|
+
109: {
|
|
78
|
+
message: string;
|
|
79
|
+
};
|
|
80
|
+
203: {
|
|
81
|
+
message: string;
|
|
82
|
+
};
|
|
83
|
+
204: {
|
|
84
|
+
message: string;
|
|
85
|
+
};
|
|
86
|
+
205: {
|
|
87
|
+
message: string;
|
|
88
|
+
};
|
|
89
|
+
206: {
|
|
90
|
+
message: string;
|
|
91
|
+
};
|
|
92
|
+
207: {
|
|
93
|
+
message: string;
|
|
94
|
+
};
|
|
95
|
+
208: {
|
|
96
|
+
message: string;
|
|
97
|
+
};
|
|
98
|
+
209: {
|
|
99
|
+
message: string;
|
|
100
|
+
};
|
|
101
|
+
210: {
|
|
102
|
+
message: string;
|
|
103
|
+
};
|
|
104
|
+
211: {
|
|
105
|
+
message: string;
|
|
106
|
+
};
|
|
107
|
+
212: {
|
|
108
|
+
message: string;
|
|
109
|
+
};
|
|
110
|
+
214: {
|
|
111
|
+
message: string;
|
|
112
|
+
};
|
|
113
|
+
215: {
|
|
114
|
+
message: string;
|
|
115
|
+
};
|
|
116
|
+
216: {
|
|
117
|
+
message: string;
|
|
118
|
+
};
|
|
119
|
+
217: {
|
|
120
|
+
message: string;
|
|
121
|
+
};
|
|
122
|
+
218: {
|
|
123
|
+
message: string;
|
|
124
|
+
};
|
|
125
|
+
300: {
|
|
126
|
+
message: string;
|
|
127
|
+
};
|
|
128
|
+
301: {
|
|
129
|
+
message: string;
|
|
130
|
+
};
|
|
131
|
+
302: {
|
|
132
|
+
message: string;
|
|
133
|
+
};
|
|
134
|
+
303: {
|
|
135
|
+
message: string;
|
|
136
|
+
};
|
|
137
|
+
400: {
|
|
138
|
+
message: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export interface GasOracleContract {
|
|
142
|
+
/**
|
|
143
|
+
* 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.
|
|
144
|
+
*/
|
|
145
|
+
initialize: ({ admin }: {
|
|
146
|
+
admin: string;
|
|
147
|
+
}, options?: {
|
|
148
|
+
/**
|
|
149
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
150
|
+
*/
|
|
151
|
+
fee?: number;
|
|
152
|
+
/**
|
|
153
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
154
|
+
*/
|
|
155
|
+
timeoutInSeconds?: number;
|
|
156
|
+
/**
|
|
157
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
158
|
+
*/
|
|
159
|
+
simulate?: boolean;
|
|
160
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
161
|
+
/**
|
|
162
|
+
* Construct and simulate a set_price 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.
|
|
163
|
+
*/
|
|
164
|
+
set_price: ({ chain_id, price, gas_price, }: {
|
|
165
|
+
chain_id: u32;
|
|
166
|
+
price: Option<u128>;
|
|
167
|
+
gas_price: Option<u128>;
|
|
168
|
+
}, options?: {
|
|
169
|
+
/**
|
|
170
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
171
|
+
*/
|
|
172
|
+
fee?: number;
|
|
173
|
+
/**
|
|
174
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
175
|
+
*/
|
|
176
|
+
timeoutInSeconds?: number;
|
|
177
|
+
/**
|
|
178
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
179
|
+
*/
|
|
180
|
+
simulate?: boolean;
|
|
181
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
182
|
+
/**
|
|
183
|
+
* Construct and simulate a set_admin 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.
|
|
184
|
+
*/
|
|
185
|
+
set_admin: ({ new_admin }: {
|
|
186
|
+
new_admin: string;
|
|
187
|
+
}, options?: {
|
|
188
|
+
/**
|
|
189
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
190
|
+
*/
|
|
191
|
+
fee?: number;
|
|
192
|
+
/**
|
|
193
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
194
|
+
*/
|
|
195
|
+
timeoutInSeconds?: number;
|
|
196
|
+
/**
|
|
197
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
198
|
+
*/
|
|
199
|
+
simulate?: boolean;
|
|
200
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
201
|
+
/**
|
|
202
|
+
* Construct and simulate a get_gas_price 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.
|
|
203
|
+
*/
|
|
204
|
+
get_gas_price: ({ chain_id }: {
|
|
205
|
+
chain_id: u32;
|
|
206
|
+
}, options?: {
|
|
207
|
+
/**
|
|
208
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
209
|
+
*/
|
|
210
|
+
fee?: number;
|
|
211
|
+
/**
|
|
212
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
213
|
+
*/
|
|
214
|
+
timeoutInSeconds?: number;
|
|
215
|
+
/**
|
|
216
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
217
|
+
*/
|
|
218
|
+
simulate?: boolean;
|
|
219
|
+
}) => Promise<AssembledTransaction<Result<ChainData>>>;
|
|
220
|
+
/**
|
|
221
|
+
* Construct and simulate a get_price 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.
|
|
222
|
+
*/
|
|
223
|
+
get_price: ({ chain_id }: {
|
|
224
|
+
chain_id: u32;
|
|
225
|
+
}, options?: {
|
|
226
|
+
/**
|
|
227
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
228
|
+
*/
|
|
229
|
+
fee?: number;
|
|
230
|
+
/**
|
|
231
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
232
|
+
*/
|
|
233
|
+
timeoutInSeconds?: number;
|
|
234
|
+
/**
|
|
235
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
236
|
+
*/
|
|
237
|
+
simulate?: boolean;
|
|
238
|
+
}) => Promise<AssembledTransaction<Result<u128>>>;
|
|
239
|
+
/**
|
|
240
|
+
* Construct and simulate a get_gas_cost_in_native_token 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.
|
|
241
|
+
*/
|
|
242
|
+
get_gas_cost_in_native_token: ({ other_chain_id, gas_amount }: {
|
|
243
|
+
other_chain_id: u32;
|
|
244
|
+
gas_amount: u128;
|
|
245
|
+
}, options?: {
|
|
246
|
+
/**
|
|
247
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
248
|
+
*/
|
|
249
|
+
fee?: number;
|
|
250
|
+
/**
|
|
251
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
252
|
+
*/
|
|
253
|
+
timeoutInSeconds?: number;
|
|
254
|
+
/**
|
|
255
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
256
|
+
*/
|
|
257
|
+
simulate?: boolean;
|
|
258
|
+
}) => Promise<AssembledTransaction<Result<u128>>>;
|
|
259
|
+
/**
|
|
260
|
+
* Construct and simulate a get_transaction_gas_cost_in_usd 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.
|
|
261
|
+
*/
|
|
262
|
+
get_transaction_gas_cost_in_usd: ({ other_chain_id, gas_amount }: {
|
|
263
|
+
other_chain_id: u32;
|
|
264
|
+
gas_amount: u128;
|
|
265
|
+
}, options?: {
|
|
266
|
+
/**
|
|
267
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
268
|
+
*/
|
|
269
|
+
fee?: number;
|
|
270
|
+
/**
|
|
271
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
272
|
+
*/
|
|
273
|
+
timeoutInSeconds?: number;
|
|
274
|
+
/**
|
|
275
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
276
|
+
*/
|
|
277
|
+
simulate?: boolean;
|
|
278
|
+
}) => Promise<AssembledTransaction<Result<u128>>>;
|
|
279
|
+
/**
|
|
280
|
+
* Construct and simulate a crossrate 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.
|
|
281
|
+
*/
|
|
282
|
+
crossrate: ({ other_chain_id }: {
|
|
283
|
+
other_chain_id: u32;
|
|
284
|
+
}, options?: {
|
|
285
|
+
/**
|
|
286
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
287
|
+
*/
|
|
288
|
+
fee?: number;
|
|
289
|
+
/**
|
|
290
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
291
|
+
*/
|
|
292
|
+
timeoutInSeconds?: number;
|
|
293
|
+
/**
|
|
294
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
295
|
+
*/
|
|
296
|
+
simulate?: boolean;
|
|
297
|
+
}) => Promise<AssembledTransaction<Result<u128>>>;
|
|
298
|
+
/**
|
|
299
|
+
* Construct and simulate a get_admin 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.
|
|
300
|
+
*/
|
|
301
|
+
get_admin: (options?: {
|
|
302
|
+
/**
|
|
303
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
304
|
+
*/
|
|
305
|
+
fee?: number;
|
|
306
|
+
/**
|
|
307
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
308
|
+
*/
|
|
309
|
+
timeoutInSeconds?: number;
|
|
310
|
+
/**
|
|
311
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
312
|
+
*/
|
|
313
|
+
simulate?: boolean;
|
|
314
|
+
}) => Promise<AssembledTransaction<Result<string>>>;
|
|
315
|
+
/**
|
|
316
|
+
* Construct and simulate a upgrade 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.
|
|
317
|
+
*/
|
|
318
|
+
upgrade: ({ new_wasm_hash }: {
|
|
319
|
+
new_wasm_hash: Buffer;
|
|
320
|
+
}, options?: {
|
|
321
|
+
/**
|
|
322
|
+
* The fee to pay for the transaction. Default: BASE_FEE
|
|
323
|
+
*/
|
|
324
|
+
fee?: number;
|
|
325
|
+
/**
|
|
326
|
+
* The maximum amount of time to wait for the transaction to complete. Default: DEFAULT_TIMEOUT
|
|
327
|
+
*/
|
|
328
|
+
timeoutInSeconds?: number;
|
|
329
|
+
/**
|
|
330
|
+
* Whether to automatically simulate the transaction when constructing the AssembledTransaction. Default: true
|
|
331
|
+
*/
|
|
332
|
+
simulate?: boolean;
|
|
333
|
+
}) => Promise<AssembledTransaction<Result<void>>>;
|
|
334
|
+
}
|
|
335
|
+
export declare class GasOracleContract extends ContractClient {
|
|
336
|
+
readonly options: ContractClientOptions;
|
|
337
|
+
constructor(options: ContractClientOptions);
|
|
338
|
+
readonly fromJSON: {
|
|
339
|
+
initialize: (json: string) => contract.AssembledTransaction<contract.Result<void, contract.ErrorMessage>>;
|
|
340
|
+
set_price: (json: string) => contract.AssembledTransaction<contract.Result<void, contract.ErrorMessage>>;
|
|
341
|
+
set_admin: (json: string) => contract.AssembledTransaction<contract.Result<void, contract.ErrorMessage>>;
|
|
342
|
+
get_gas_price: (json: string) => contract.AssembledTransaction<contract.Result<ChainData, contract.ErrorMessage>>;
|
|
343
|
+
get_price: (json: string) => contract.AssembledTransaction<contract.Result<bigint, contract.ErrorMessage>>;
|
|
344
|
+
get_gas_cost_in_native_token: (json: string) => contract.AssembledTransaction<contract.Result<bigint, contract.ErrorMessage>>;
|
|
345
|
+
get_transaction_gas_cost_in_usd: (json: string) => contract.AssembledTransaction<contract.Result<bigint, contract.ErrorMessage>>;
|
|
346
|
+
crossrate: (json: string) => contract.AssembledTransaction<contract.Result<bigint, contract.ErrorMessage>>;
|
|
347
|
+
get_admin: (json: string) => contract.AssembledTransaction<contract.Result<string, contract.ErrorMessage>>;
|
|
348
|
+
upgrade: (json: string) => contract.AssembledTransaction<contract.Result<void, contract.ErrorMessage>>;
|
|
349
|
+
};
|
|
350
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GasOracleContract = exports.Errors = void 0;
|
|
4
|
+
const stellar_sdk_1 = require("@stellar/stellar-sdk");
|
|
5
|
+
var ContractSpec = stellar_sdk_1.contract.Spec;
|
|
6
|
+
var ContractClient = stellar_sdk_1.contract.Client;
|
|
7
|
+
exports.Errors = {
|
|
8
|
+
0: { message: "" },
|
|
9
|
+
1: { message: "" },
|
|
10
|
+
2: { message: "" },
|
|
11
|
+
3: { message: "" },
|
|
12
|
+
4: { message: "" },
|
|
13
|
+
5: { message: "" },
|
|
14
|
+
6: { message: "" },
|
|
15
|
+
7: { message: "" },
|
|
16
|
+
8: { message: "" },
|
|
17
|
+
9: { message: "" },
|
|
18
|
+
10: { message: "" },
|
|
19
|
+
11: { message: "" },
|
|
20
|
+
12: { message: "" },
|
|
21
|
+
103: { message: "" },
|
|
22
|
+
104: { message: "" },
|
|
23
|
+
105: { message: "" },
|
|
24
|
+
106: { message: "" },
|
|
25
|
+
107: { message: "" },
|
|
26
|
+
108: { message: "" },
|
|
27
|
+
109: { message: "" },
|
|
28
|
+
203: { message: "" },
|
|
29
|
+
204: { message: "" },
|
|
30
|
+
205: { message: "" },
|
|
31
|
+
206: { message: "" },
|
|
32
|
+
207: { message: "" },
|
|
33
|
+
208: { message: "" },
|
|
34
|
+
209: { message: "" },
|
|
35
|
+
210: { message: "" },
|
|
36
|
+
211: { message: "" },
|
|
37
|
+
212: { message: "" },
|
|
38
|
+
214: { message: "" },
|
|
39
|
+
215: { message: "" },
|
|
40
|
+
216: { message: "" },
|
|
41
|
+
217: { message: "" },
|
|
42
|
+
218: { message: "" },
|
|
43
|
+
300: { message: "" },
|
|
44
|
+
301: { message: "" },
|
|
45
|
+
302: { message: "" },
|
|
46
|
+
303: { message: "" },
|
|
47
|
+
400: { message: "" },
|
|
48
|
+
};
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
|
50
|
+
class GasOracleContract extends ContractClient {
|
|
51
|
+
constructor(options) {
|
|
52
|
+
super(new ContractSpec([
|
|
53
|
+
"AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAAAQAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAQAAA+kAAAPtAAAAAAAAAAM=",
|
|
54
|
+
"AAAAAAAAAAAAAAAJc2V0X3ByaWNlAAAAAAAAAwAAAAAAAAAIY2hhaW5faWQAAAAEAAAAAAAAAAVwcmljZQAAAAAAA+gAAAAKAAAAAAAAAAlnYXNfcHJpY2UAAAAAAAPoAAAACgAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
55
|
+
"AAAAAAAAAAAAAAAJc2V0X2FkbWluAAAAAAAAAQAAAAAAAAAJbmV3X2FkbWluAAAAAAAAEwAAAAEAAAPpAAAD7QAAAAAAAAAD",
|
|
56
|
+
"AAAAAAAAAAAAAAANZ2V0X2dhc19wcmljZQAAAAAAAAEAAAAAAAAACGNoYWluX2lkAAAABAAAAAEAAAPpAAAH0AAAAAlDaGFpbkRhdGEAAAAAAA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QAAAAAAMwAAAAAAAAAEkFtb3VudFRvb0xvd0ZvckZlZQAAAAAAzQAAAAAAAAAWQnJpZGdlVG9UaGVaZXJvQWRkcmVzcwAAAAAAzgAAAAAAAAAORW1wdHlSZWNpcGllbnQAAAAAAM8AAAAAAAAAE1NvdXJjZU5vdFJlZ2lzdGVyZWQAAAAA0AAAAAAAAAAVV3JvbmdEZXN0aW5hdGlvbkNoYWluAAAAAAAA0QAAAAAAAAATVW5rbm93bkFub3RoZXJDaGFpbgAAAADSAAAAAAAAABFUb2tlbnNBbHJlYWR5U2VudAAAAAAAANMAAAAAAAAAEE1lc3NhZ2VQcm9jZXNzZWQAAADUAAAAAAAAAAxOb3RFbm91Z2hGZWUAAADWAAAAAAAAAAlOb01lc3NhZ2UAAAAAAADXAAAAAAAAAA1Ob1JlY2VpdmVQb29sAAAAAAAA2AAAAAAAAAAGTm9Qb29sAAAAAADZAAAAAAAAABNVbmtub3duQW5vdGhlclRva2VuAAAAANoAAAAAAAAAD1dyb25nQnl0ZUxlbmd0aAAAAAEsAAAAAAAAAApIYXNNZXNzYWdlAAAAAAEtAAAAAAAAABdJbnZhbGlkUHJpbWFyeVNpZ25hdHVyZQAAAAEuAAAAAAAAABlJbnZhbGlkU2Vjb25kYXJ5U2lnbmF0dXJlAAAAAAABLwAAAAAAAAARTm9HYXNEYXRhRm9yQ2hhaW4AAAAAAAGQ",
|
|
70
|
+
]), options);
|
|
71
|
+
this.options = options;
|
|
72
|
+
this.fromJSON = {
|
|
73
|
+
initialize: (this.txFromJSON),
|
|
74
|
+
set_price: (this.txFromJSON),
|
|
75
|
+
set_admin: (this.txFromJSON),
|
|
76
|
+
get_gas_price: (this.txFromJSON),
|
|
77
|
+
get_price: (this.txFromJSON),
|
|
78
|
+
get_gas_cost_in_native_token: (this.txFromJSON),
|
|
79
|
+
get_transaction_gas_cost_in_usd: (this.txFromJSON),
|
|
80
|
+
crossrate: (this.txFromJSON),
|
|
81
|
+
get_admin: (this.txFromJSON),
|
|
82
|
+
upgrade: (this.txFromJSON),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.GasOracleContract = GasOracleContract;
|
|
87
|
+
//# sourceMappingURL=gas-oracle-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gas-oracle-contract.js","sourceRoot":"","sources":["../../../../../src/services/models/srb/gas-oracle-contract.ts"],"names":[],"mappings":";;;AAAA,sDAAgD;AAMhD,IAAO,YAAY,GAAG,sBAAQ,CAAC,IAAI,CAAC;AACpC,IAAO,cAAc,GAAG,sBAAQ,CAAC,MAAM,CAAC;AAa3B,QAAA,MAAM,GAAG;IACpB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,CAAC,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IAClB,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACnB,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACnB,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACnB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;IACpB,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,E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