@cryptorubic/web3 1.1.0-alpha-stellar.16 → 1.1.0-alpha-stellar.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptorubic/web3",
3
- "version": "1.1.0-alpha-stellar.16",
3
+ "version": "1.1.0-alpha-stellar.17",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -89,21 +89,16 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
89
89
  }
90
90
  async addTrustline(tokenAddress) {
91
91
  try {
92
- const account = await this.public.getAccount(this.signer.walletAddress);
93
- const tx = new stellar_sdk_1.TransactionBuilder(account, {
94
- fee: stellar_sdk_1.BASE_FEE,
95
- networkPassphrase: stellar_sdk_1.Networks.PUBLIC
96
- })
97
- .addOperation(stellar_sdk_1.Operation.changeTrust({
98
- asset: this.convertTokenAddressToAsset(tokenAddress)
99
- }))
100
- .setTimeout(30)
101
- .build();
102
- return this.signer.sendTransaction({
103
- txOptions: {
104
- transaction: tx
105
- }
92
+ const tx = await this.encodeTrustline(tokenAddress, this.signer.walletAddress);
93
+ const { signedTxXdr } = await this.signer.wallet.signTransaction(tx, {
94
+ networkPassphrase: stellar_sdk_1.Networks.PUBLIC,
95
+ address: this.signer.walletAddress
106
96
  });
97
+ const resp = await this.public.sendTransaction(stellar_sdk_1.TransactionBuilder.fromXDR(signedTxXdr, stellar_sdk_1.Networks.PUBLIC));
98
+ if (resp.status === 'ERROR') {
99
+ throw new Error('Failed to execute transaction', { cause: resp.errorResult });
100
+ }
101
+ return resp.hash;
107
102
  }
108
103
  catch (err) {
109
104
  this.logger?.customError('FAILED TO ADD TRUSTLINE', err);