@allbridge/bridge-core-sdk 3.15.4-alpha.1 → 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.
Files changed (52) hide show
  1. package/dist/browser/index.js +3 -3
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/cjs/index.js +4 -4
  4. package/dist/cjs/index.js.map +4 -4
  5. package/dist/esm/index.js +4 -4
  6. package/dist/esm/index.js.map +4 -4
  7. package/dist/src/services/bridge/srb/index.js +11 -10
  8. package/dist/src/services/bridge/srb/index.js.map +1 -1
  9. package/dist/src/services/bridge/utils.js +1 -1
  10. package/dist/src/services/bridge/utils.js.map +1 -1
  11. package/dist/src/services/liquidity-pool/srb/index.js +17 -14
  12. package/dist/src/services/liquidity-pool/srb/index.js.map +1 -1
  13. package/dist/src/services/models/srb/bridge-contract.d.ts +801 -0
  14. package/dist/src/services/models/srb/{bridge.js → bridge-contract.js} +49 -97
  15. package/dist/src/services/models/srb/bridge-contract.js.map +1 -0
  16. package/dist/src/services/models/srb/gas-oracle-contract.d.ts +350 -0
  17. package/dist/src/services/models/srb/gas-oracle-contract.js +87 -0
  18. package/dist/src/services/models/srb/gas-oracle-contract.js.map +1 -0
  19. package/dist/src/services/models/srb/messenger-contract.d.ts +573 -0
  20. package/dist/src/services/models/srb/messenger-contract.js +111 -0
  21. package/dist/src/services/models/srb/messenger-contract.js.map +1 -0
  22. package/dist/src/services/models/srb/pool-contract.d.ts +690 -0
  23. package/dist/src/services/models/srb/pool-contract.js +125 -0
  24. package/dist/src/services/models/srb/pool-contract.js.map +1 -0
  25. package/dist/src/services/models/srb/token-contract.d.ts +437 -160
  26. package/dist/src/services/models/srb/token-contract.js +41 -288
  27. package/dist/src/services/models/srb/token-contract.js.map +1 -1
  28. package/dist/src/services/models/srb/utils.d.ts +6 -0
  29. package/dist/src/services/models/srb/utils.js +35 -0
  30. package/dist/src/services/models/srb/utils.js.map +1 -0
  31. package/dist/src/services/token/srb/index.js +1 -1
  32. package/dist/src/services/token/srb/index.js.map +1 -1
  33. package/dist/src/utils/srb/index.d.ts +5 -6
  34. package/dist/src/utils/srb/index.js +1 -1
  35. package/dist/src/utils/srb/index.js.map +1 -1
  36. package/dist/src/version.d.ts +1 -1
  37. package/dist/src/version.js +1 -1
  38. package/package.json +2 -2
  39. package/dist/src/services/models/srb/bridge.d.ts +0 -169
  40. package/dist/src/services/models/srb/bridge.js.map +0 -1
  41. package/dist/src/services/models/srb/pool.d.ts +0 -293
  42. package/dist/src/services/models/srb/pool.js +0 -233
  43. package/dist/src/services/models/srb/pool.js.map +0 -1
  44. package/dist/src/services/utils/srb/assembled-tx.d.ts +0 -73
  45. package/dist/src/services/utils/srb/assembled-tx.js +0 -143
  46. package/dist/src/services/utils/srb/assembled-tx.js.map +0 -1
  47. package/dist/src/services/utils/srb/build-tx.d.ts +0 -48
  48. package/dist/src/services/utils/srb/build-tx.js +0 -62
  49. package/dist/src/services/utils/srb/build-tx.js.map +0 -1
  50. package/dist/src/services/utils/srb/method-options.d.ts +0 -47
  51. package/dist/src/services/utils/srb/method-options.js +0 -5
  52. package/dist/src/services/utils/srb/method-options.js.map +0 -1
@@ -1,233 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.PoolContract = exports.Errors = exports.networks = void 0;
19
- const stellar_sdk_1 = require("stellar-sdk");
20
- const assembled_tx_1 = require("../../utils/srb/assembled-tx");
21
- const build_tx_1 = require("../../utils/srb/build-tx");
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: "CAAIJH55UJZXY7YZ3QQJ5S43KAY4ACEU5EBNS6NLUKJXRQEU2ZC36MUR",
28
- },
29
- };
30
- /**
31
-
32
- */
33
- exports.Errors = {
34
- 0: { message: "" },
35
- 1: { message: "" },
36
- 2: { message: "" },
37
- 3: { message: "" },
38
- 4: { message: "" },
39
- 5: { message: "" },
40
- 6: { message: "" },
41
- 7: { message: "" },
42
- 8: { message: "" },
43
- 9: { message: "" },
44
- 103: { message: "" },
45
- 104: { message: "" },
46
- 105: { message: "" },
47
- 106: { message: "" },
48
- 107: { message: "" },
49
- 108: { message: "" },
50
- 109: { message: "" },
51
- 203: { message: "" },
52
- 204: { message: "" },
53
- 205: { message: "" },
54
- 206: { message: "" },
55
- 207: { message: "" },
56
- 208: { message: "" },
57
- 209: { message: "" },
58
- 210: { message: "" },
59
- 211: { message: "" },
60
- 212: { message: "" },
61
- 214: { message: "" },
62
- 215: { message: "" },
63
- 216: { message: "" },
64
- 217: { message: "" },
65
- 218: { message: "" },
66
- 300: { message: "" },
67
- 301: { message: "" },
68
- 302: { message: "" },
69
- 303: { message: "" },
70
- 400: { message: "" },
71
- };
72
- class PoolContract {
73
- constructor(options) {
74
- this.options = options;
75
- this.parsers = {
76
- deposit: (result) => {
77
- if (result instanceof assembled_tx_1.Err)
78
- return result;
79
- return new assembled_tx_1.Ok(this.spec.funcResToNative("deposit", result));
80
- },
81
- withdraw: (result) => {
82
- if (result instanceof assembled_tx_1.Err)
83
- return result;
84
- return new assembled_tx_1.Ok(this.spec.funcResToNative("withdraw", result));
85
- },
86
- claimRewards: (result) => {
87
- if (result instanceof assembled_tx_1.Err)
88
- return result;
89
- return new assembled_tx_1.Ok(this.spec.funcResToNative("claim_rewards", result));
90
- },
91
- getPool: (result) => {
92
- if (result instanceof assembled_tx_1.Err)
93
- return result;
94
- return new assembled_tx_1.Ok(this.spec.funcResToNative("get_pool", result));
95
- },
96
- getUserDeposit: (result) => {
97
- if (result instanceof assembled_tx_1.Err)
98
- return result;
99
- return new assembled_tx_1.Ok(this.spec.funcResToNative("get_user_deposit", result));
100
- },
101
- };
102
- /**
103
- * Construct and simulate a deposit 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.
104
- */
105
- this.depositXdr = async ({ sender, amount }, options = {}) => {
106
- return await build_tx_1.XDRTransactionBuilder.xdrFromSimulation({
107
- method: "deposit",
108
- args: this.spec.funcArgsToScVals("deposit", {
109
- sender: new stellar_sdk_1.Address(sender),
110
- amount,
111
- }),
112
- account: sender,
113
- ...options,
114
- ...this.options,
115
- errorTypes: exports.Errors,
116
- // @ts-expect-error
117
- parseResultXdr: this.parsers.deposit,
118
- });
119
- };
120
- /**
121
- * Construct and simulate a withdraw 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.
122
- */
123
- this.withdrawXdr = async ({ sender, amount_lp }, options = {}) => {
124
- return await build_tx_1.XDRTransactionBuilder.xdrFromSimulation({
125
- method: "withdraw",
126
- args: this.spec.funcArgsToScVals("withdraw", {
127
- sender: new stellar_sdk_1.Address(sender),
128
- amount_lp,
129
- }),
130
- account: sender,
131
- ...options,
132
- ...this.options,
133
- errorTypes: exports.Errors,
134
- // @ts-expect-error
135
- parseResultXdr: this.parsers.withdraw,
136
- });
137
- };
138
- /**
139
- * Construct and simulate a claim_rewards 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.
140
- */
141
- this.claimRewardsXdr = async ({ sender }, options = {}) => {
142
- return await build_tx_1.XDRTransactionBuilder.xdrFromSimulation({
143
- method: "claim_rewards",
144
- args: this.spec.funcArgsToScVals("claim_rewards", {
145
- sender: new stellar_sdk_1.Address(sender),
146
- }),
147
- account: sender,
148
- ...options,
149
- ...this.options,
150
- errorTypes: exports.Errors,
151
- // @ts-expect-error
152
- parseResultXdr: this.parsers.claimRewards,
153
- });
154
- };
155
- /**
156
- * Construct and simulate a get_pool 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
- this.getPool = async (options = {}) => {
159
- return await assembled_tx_1.AssembledTransaction.fromSimulation({
160
- method: "get_pool",
161
- args: this.spec.funcArgsToScVals("get_pool", {}),
162
- ...options,
163
- ...this.options,
164
- errorTypes: exports.Errors,
165
- // @ts-expect-error
166
- parseResultXdr: this.parsers.getPool,
167
- });
168
- };
169
- /**
170
- * Construct and simulate a get_user_deposit 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.
171
- */
172
- this.getUserDeposit = async ({ user }, options = {}) => {
173
- return await assembled_tx_1.AssembledTransaction.fromSimulation({
174
- method: "get_user_deposit",
175
- args: this.spec.funcArgsToScVals("get_user_deposit", {
176
- user: new stellar_sdk_1.Address(user),
177
- }),
178
- ...options,
179
- ...this.options,
180
- errorTypes: exports.Errors,
181
- // @ts-expect-error
182
- parseResultXdr: this.parsers.getUserDeposit,
183
- });
184
- };
185
- this.spec = new stellar_sdk_1.ContractSpec([
186
- "AAAAAAAAAAAAAAAKaW5pdGlhbGl6ZQAAAAAABwAAAAAAAAAFYWRtaW4AAAAAAAATAAAAAAAAAAZicmlkZ2UAAAAAABMAAAAAAAAAAWEAAAAAAAAKAAAAAAAAAAV0b2tlbgAAAAAAABMAAAAAAAAADGZlZV9zaGFyZV9icAAAAAo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9G,kGAAkG;YAClG,8LAA8L;YAC9L,0LAA0L;YAC1L,0FAA0F;YAC1F,0FAA0F;YAC1F,kGAAkG;YAClG,kGAAkG;YAClG,8DAA8D;YAC9D,kIAAkI;YAClI,0hBAA0hB;YAC1hB,8GAA8G;YAC9G,8EAA8E;YAC9E,8DAA8D;YAC9D,0EAA0E;YAC1E,0EAA0E;YAC1E,kEAAkE;YAClE,0EAA0E;YAC1E,k8CAAk8C;SACn8C,CAAC,CAAC;IACL,CAAC;CAsJF;AAtMD,oCAsMC"}
@@ -1,73 +0,0 @@
1
- import type { Transaction } from "stellar-sdk";
2
- import { Account, Address, SorobanRpc, xdr } from "stellar-sdk";
3
- import type { ClassOptions, MethodOptions } from "./method-options";
4
- export type Tx = Transaction;
5
- export declare class ExpiredStateError extends Error {
6
- }
7
- export type u32 = number;
8
- export type i32 = number;
9
- export type u64 = bigint;
10
- export type i64 = bigint;
11
- export type u128 = bigint;
12
- export type i128 = bigint;
13
- export type u256 = bigint;
14
- export type i256 = bigint;
15
- export type Option<T> = T | undefined;
16
- export type Typepoint = bigint;
17
- export type Duration = bigint;
18
- export { Address };
19
- export interface Error_ {
20
- message: string;
21
- }
22
- export interface Result<T, E extends Error_> {
23
- unwrap(): T;
24
- unwrapErr(): E;
25
- isOk(): boolean;
26
- isErr(): boolean;
27
- }
28
- export declare class Ok<T, E extends Error_ = Error_> implements Result<T, E> {
29
- readonly value: T;
30
- constructor(value: T);
31
- unwrapErr(): E;
32
- unwrap(): T;
33
- isOk(): boolean;
34
- isErr(): boolean;
35
- }
36
- export declare class Err<E extends Error_ = Error_> implements Result<any, E> {
37
- readonly error: E;
38
- constructor(error: E);
39
- unwrapErr(): E;
40
- unwrap(): never;
41
- isOk(): boolean;
42
- isErr(): boolean;
43
- }
44
- export declare const contractErrorPattern: RegExp;
45
- type AssembledTransactionOptions<T = string> = MethodOptions & ClassOptions & {
46
- method: string;
47
- args?: any[];
48
- parseResultXdr: (xdr: string | xdr.ScVal | Err) => T;
49
- };
50
- export declare const NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
51
- export declare class AssembledTransaction<T> {
52
- options: AssembledTransactionOptions<T>;
53
- raw: Tx;
54
- private simulation?;
55
- private simulationResult?;
56
- private simulationTransactionData?;
57
- private server;
58
- private constructor();
59
- static fromSimulation<T>(options: AssembledTransactionOptions<T>): Promise<AssembledTransaction<T>>;
60
- simulate: () => Promise<this>;
61
- get simulationData(): {
62
- result: SorobanRpc.Api.SimulateHostFunctionResult;
63
- transactionData: xdr.SorobanTransactionData;
64
- };
65
- get result(): T;
66
- parseError(errorMessage: string): Err | undefined;
67
- /**
68
- * Get account details from the Soroban network for the publicKey currently
69
- * selected in user's wallet. If not connected to Freighter, use placeholder
70
- * null account.
71
- */
72
- getAccount: () => Account;
73
- }
@@ -1,143 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AssembledTransaction = exports.NULL_ACCOUNT = exports.contractErrorPattern = exports.Err = exports.Ok = exports.Address = exports.ExpiredStateError = void 0;
4
- const stellar_sdk_1 = require("stellar-sdk");
5
- Object.defineProperty(exports, "Address", { enumerable: true, get: function () { return stellar_sdk_1.Address; } });
6
- class ExpiredStateError extends Error {
7
- }
8
- exports.ExpiredStateError = ExpiredStateError;
9
- class Ok {
10
- constructor(value) {
11
- this.value = value;
12
- }
13
- unwrapErr() {
14
- throw new Error("No error");
15
- }
16
- unwrap() {
17
- return "value" in this.value ? this.value.value : this.value;
18
- }
19
- isOk() {
20
- return true;
21
- }
22
- isErr() {
23
- return !this.isOk();
24
- }
25
- }
26
- exports.Ok = Ok;
27
- class Err {
28
- constructor(error) {
29
- this.error = error;
30
- }
31
- unwrapErr() {
32
- return "error" in this.error ? this.error.error : this.error;
33
- }
34
- unwrap() {
35
- throw new Error(this.error.message);
36
- }
37
- isOk() {
38
- return false;
39
- }
40
- isErr() {
41
- return !this.isOk();
42
- }
43
- }
44
- exports.Err = Err;
45
- exports.contractErrorPattern = /Error\(Contract, #(\d+)\)/;
46
- exports.NULL_ACCOUNT = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
47
- class AssembledTransaction {
48
- constructor(options) {
49
- this.options = options;
50
- this.simulate = async () => {
51
- this.simulation = await this.server.simulateTransaction(this.raw);
52
- if (stellar_sdk_1.SorobanRpc.Api.isSimulationSuccess(this.simulation)) {
53
- this.raw = stellar_sdk_1.SorobanRpc.assembleTransaction(this.raw, this.simulation).build();
54
- }
55
- return this;
56
- };
57
- /**
58
- * Get account details from the Soroban network for the publicKey currently
59
- * selected in user's wallet. If not connected to Freighter, use placeholder
60
- * null account.
61
- */
62
- this.getAccount = () => {
63
- // const publicKey = await this.getPublicKey();
64
- // return publicKey
65
- // ? await this.server.getAccount(publicKey)
66
- // : new Account(NULL_ACCOUNT, '0')
67
- return new stellar_sdk_1.Account(exports.NULL_ACCOUNT, "0");
68
- };
69
- this.server = new stellar_sdk_1.SorobanRpc.Server(this.options.rpcUrl, {
70
- allowHttp: this.options.rpcUrl.startsWith("http://"),
71
- });
72
- }
73
- static async fromSimulation(options) {
74
- const tx = new AssembledTransaction(options);
75
- const contract = new stellar_sdk_1.Contract(options.contractId);
76
- tx.raw = new stellar_sdk_1.TransactionBuilder(tx.getAccount(), {
77
- fee: options.fee?.toString(10) ?? stellar_sdk_1.BASE_FEE,
78
- networkPassphrase: options.networkPassphrase,
79
- })
80
- .addOperation(contract.call(options.method, ...(options.args ?? [])))
81
- .setTimeout(stellar_sdk_1.TimeoutInfinite)
82
- .build();
83
- return await tx.simulate();
84
- }
85
- get simulationData() {
86
- if (this.simulationResult && this.simulationTransactionData) {
87
- return {
88
- result: this.simulationResult,
89
- transactionData: this.simulationTransactionData,
90
- };
91
- }
92
- // else, we know we just did the simulation on this machine
93
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
94
- const simulation = this.simulation;
95
- if (stellar_sdk_1.SorobanRpc.Api.isSimulationError(simulation)) {
96
- throw new Error(`Transaction simulation failed: "${simulation.error}"`);
97
- }
98
- // if (SorobanRpc.Api.isSimulationRestore(simulation)) {
99
- // throw new ExpiredStateError(
100
- // `You need to restore some contract state before you can invoke this method. ${JSON.stringify(
101
- // simulation,
102
- // null,
103
- // 2
104
- // )}`
105
- // );
106
- // }
107
- if (!simulation.result) {
108
- throw new Error(`Expected an invocation simulation, but got no 'result' field. Simulation: ${JSON.stringify(simulation, null, 2)}`);
109
- }
110
- // add to object for serialization & deserialization
111
- this.simulationResult = simulation.result;
112
- this.simulationTransactionData = simulation.transactionData.build();
113
- return {
114
- result: this.simulationResult,
115
- transactionData: this.simulationTransactionData,
116
- };
117
- }
118
- get result() {
119
- try {
120
- return this.options.parseResultXdr(this.simulationData.result.retval);
121
- }
122
- catch (e) {
123
- // @ts-expect-error
124
- const err = this.parseError(e.toString());
125
- if (err)
126
- return err;
127
- throw e;
128
- }
129
- }
130
- parseError(errorMessage) {
131
- if (!this.options.errorTypes)
132
- return;
133
- const match = errorMessage.match(exports.contractErrorPattern);
134
- if (!match)
135
- return;
136
- const i = parseInt(match[1], 10);
137
- const err = this.options.errorTypes[i];
138
- if (err.message)
139
- return new Err(err);
140
- }
141
- }
142
- exports.AssembledTransaction = AssembledTransaction;
143
- //# sourceMappingURL=assembled-tx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assembled-tx.js","sourceRoot":"","sources":["../../../../../src/services/utils/srb/assembled-tx.ts"],"names":[],"mappings":";;;AAEA,6CASqB;AAkBZ,wFAzBP,qBAAO,OAyBO;AAbhB,MAAa,iBAAkB,SAAQ,KAAK;CAAG;AAA/C,8CAA+C;AA2B/C,MAAa,EAAE;IACb,YAAqB,KAAQ;QAAR,UAAK,GAAL,KAAK,CAAG;IAAG,CAAC;IACjC,SAAS;QACP,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;IAC9B,CAAC;IACD,MAAM;QACJ,O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AO,CAAC,UAAU;YAAE,OAAO;QACrC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,4BAAoB,CAAC,CAAC;QACvD,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,GAAG,CAAC,OAAO;YAAE,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;CAcF;AAtHD,oDAsHC"}
@@ -1,48 +0,0 @@
1
- import type { Transaction } from "stellar-sdk";
2
- import { Address, xdr } from "stellar-sdk";
3
- import type { ClassOptions, MethodOptions } from "./method-options";
4
- export type Tx = Transaction;
5
- export type u32 = number;
6
- export type i32 = number;
7
- export type u64 = bigint;
8
- export type i64 = bigint;
9
- export type u128 = bigint;
10
- export type i128 = bigint;
11
- export type u256 = bigint;
12
- export type i256 = bigint;
13
- export type Option<T> = T | undefined;
14
- export type Typepoint = bigint;
15
- export type Duration = bigint;
16
- export { Address };
17
- export interface Error_ {
18
- message: string;
19
- }
20
- export interface Result<T, E extends Error_> {
21
- unwrap(): T;
22
- unwrapErr(): E;
23
- isOk(): boolean;
24
- isErr(): boolean;
25
- }
26
- export declare class Err<E extends Error_ = Error_> implements Result<any, E> {
27
- readonly error: E;
28
- constructor(error: E);
29
- unwrapErr(): E;
30
- unwrap(): never;
31
- isOk(): boolean;
32
- isErr(): boolean;
33
- }
34
- type XDRTransactionBuilderOptions<T = string> = MethodOptions & ClassOptions & {
35
- method: string;
36
- args?: any[];
37
- parseResultXdr: (xdr: string | xdr.ScVal | Err) => T;
38
- account: string;
39
- };
40
- export declare class XDRTransactionBuilder<T> {
41
- options: XDRTransactionBuilderOptions<T>;
42
- raw: Tx;
43
- private simulation?;
44
- private server;
45
- private constructor();
46
- static xdrFromSimulation<T>(options: XDRTransactionBuilderOptions<T>): Promise<string>;
47
- simulate: () => Promise<this>;
48
- }
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.XDRTransactionBuilder = exports.Err = exports.Address = void 0;
4
- const stellar_sdk_1 = require("stellar-sdk");
5
- Object.defineProperty(exports, "Address", { enumerable: true, get: function () { return stellar_sdk_1.Address; } });
6
- class Err {
7
- constructor(error) {
8
- this.error = error;
9
- }
10
- unwrapErr() {
11
- return this.error;
12
- }
13
- unwrap() {
14
- throw new Error(this.error.message);
15
- }
16
- isOk() {
17
- return false;
18
- }
19
- isErr() {
20
- return !this.isOk();
21
- }
22
- }
23
- exports.Err = Err;
24
- class XDRTransactionBuilder {
25
- constructor(options) {
26
- this.options = options;
27
- this.simulate = async () => {
28
- this.simulation = await this.server.simulateTransaction(this.raw);
29
- if (stellar_sdk_1.SorobanRpc.Api.isSimulationSuccess(this.simulation)) {
30
- this.raw = stellar_sdk_1.SorobanRpc.assembleTransaction(this.raw, this.simulation).build();
31
- }
32
- return this;
33
- };
34
- this.server = new stellar_sdk_1.SorobanRpc.Server(this.options.rpcUrl, {
35
- allowHttp: this.options.rpcUrl.startsWith("http://"),
36
- });
37
- }
38
- static async xdrFromSimulation(options) {
39
- const tx = new XDRTransactionBuilder(options);
40
- const contract = new stellar_sdk_1.Contract(options.contractId);
41
- tx.raw = new stellar_sdk_1.TransactionBuilder(await tx.server.getAccount(options.account), {
42
- fee: options.fee?.toString(10) ?? stellar_sdk_1.BASE_FEE,
43
- networkPassphrase: options.networkPassphrase,
44
- })
45
- .addOperation(contract.call(options.method, ...(options.args ?? [])))
46
- .setTimeout(stellar_sdk_1.TimeoutInfinite)
47
- .build();
48
- const assembledTransaction = await tx.simulate();
49
- const op = assembledTransaction.raw.operations[0];
50
- assembledTransaction.raw = new stellar_sdk_1.TransactionBuilder(await tx.server.getAccount(options.account), {
51
- fee: assembledTransaction.raw.fee,
52
- networkPassphrase: options.networkPassphrase,
53
- })
54
- .setTimeout(stellar_sdk_1.TimeoutInfinite)
55
- .addOperation(stellar_sdk_1.Operation.invokeHostFunction({ ...op, auth: op.auth ?? [] }))
56
- .build();
57
- await assembledTransaction.simulate();
58
- return assembledTransaction.raw.toXDR();
59
- }
60
- }
61
- exports.XDRTransactionBuilder = XDRTransactionBuilder;
62
- //# sourceMappingURL=build-tx.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-tx.js","sourceRoot":"","sources":["../../../../../src/services/utils/srb/build-tx.ts"],"names":[],"mappings":";;;AACA,6CASqB;AAgBZ,wFAxBP,qBAAO,OAwBO;AAiBhB,MAAa,GAAG;IACd,YAAqB,KAAQ;QAAR,UAAK,GAAL,KAAK,CAAG;IAAG,CAAC;IAEjC,SAAS;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,IAAI;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;CACF;AAlBD,kBAkBC;AAUD,MAAa,qBAAqB;IAMhC,YAA2B,OAAwC;QAAxC,YAAO,GAAP,OAAO,CAAiC;QAiCnE,aAAQ,GAAG,KAAK,IAAmB,EAAE;YACnC,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAElE,IAAI,wBAAU,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;gBACvD,IAAI,CAAC,GAAG,GAAG,wBAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,CAAC;aAC9E;YAED,OAAO,IAAI,CAAC;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;aACC,UAAU,CAAC,6BAAe,CAAC;aAC3B,YAAY,CAAC,uBAAS,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC;aAC1E,KAAK,EAAE,CAAC;QAEX,MAAM,oBAAoB,CAAC,QAAQ,EAAE,CAAC;QACtC,OAAO,oBAAoB,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC;CAWF;AAhDD,sDAgDC"}
@@ -1,47 +0,0 @@
1
- declare let responseTypes: "simulated" | "full" | undefined;
2
- export type ResponseTypes = typeof responseTypes;
3
- export type XDR_BASE64 = string;
4
- export interface Wallet {
5
- isConnected: () => Promise<boolean>;
6
- isAllowed: () => Promise<boolean>;
7
- getUserInfo: () => Promise<{
8
- publicKey?: string;
9
- }>;
10
- signTransaction: (tx: XDR_BASE64, opts?: {
11
- network?: string;
12
- networkPassphrase?: string;
13
- accountToSign?: string;
14
- }) => Promise<XDR_BASE64>;
15
- signAuthEntry: (entryXdr: XDR_BASE64, opts?: {
16
- accountToSign?: string;
17
- }) => Promise<XDR_BASE64>;
18
- }
19
- export interface ClassOptions {
20
- contractId: string;
21
- networkPassphrase: string;
22
- rpcUrl: string;
23
- errorTypes?: Record<number, {
24
- message: string;
25
- }>;
26
- /**
27
- * A Wallet interface, such as Freighter, that has the methods `isConnected`, `isAllowed`, `getUserInfo`, and `signTransaction`. If not provided, will attempt to import and use Freighter. Example:
28
- *
29
- * @example
30
- * ```ts
31
- * import freighter from "@stellar/freighter-api";
32
- * import { Contract } from "token";
33
- * const contract = new Contract({
34
- * …,
35
- * wallet: freighter,
36
- * })
37
- * ```
38
- */
39
- wallet?: Wallet;
40
- }
41
- export interface MethodOptions {
42
- /**
43
- * The fee to pay for the transaction. Default: soroban-sdk's BASE_FEE ('100')
44
- */
45
- fee?: number;
46
- }
47
- export {};
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // defined this way so typeahead shows full union, not named alias
4
- let responseTypes;
5
- //# sourceMappingURL=method-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"method-options.js","sourceRoot":"","sources":["../../../../../src/services/utils/srb/method-options.ts"],"names":[],"mappings":";;AAAA,kEAAkE;AAClE,IAAI,aAA+C,CAAC"}