@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
|
@@ -89,21 +89,16 @@ class StellarAdapter extends abstract_adapter_1.AbstractAdapter {
|
|
|
89
89
|
}
|
|
90
90
|
async addTrustline(tokenAddress) {
|
|
91
91
|
try {
|
|
92
|
-
const
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
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);
|