You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all,
I first use npm install @stellar/typescript-wallet-sdk. And when I was developing with typescript-wallet-sdk, I encountered the above error message (as mentioned in the title) while executing the code for submitting a transaction. My sample code is as follows:
const{
walletSdk,
Keypair,
AccountKeypair,
NativeAssetId,}=require("@stellar/typescript-wallet-sdk");const{ xdr }=require("@stellar/stellar-sdk");constsourcePublicKey='the from wallet address'constdestinationPublicKey='the to wallet address'constwallet=walletSdk.Wallet.TestNet();constserver=wallet.stellar().server;constsourceAccountPair=newAccountKeypair(Keypair.fromPublicKey(sourcePublicKey));consttxBuilder=awaitwallet.stellar().transaction({sourceAddress: sourceAccountPair,});consttx=txBuilder.transfer(destinationPublicKey,newNativeAssetId(),"10").build();// use 3rd party api to get the signatureconstsignature=mySignServer(tx...)tx.addDecoratedSignature(newxdr.DecoratedSignature({
signature,hint: Keypair.fromPublicKey(sourcePublicKey).signatureHint(),}));consttransactionResult=awaitserver.submitTransaction(tx);// <-- error this line
The error log:
node_modules/@stellar/typescript-wallet-sdk/lib/bundle.js:8359
throw new _errors__WEBPACK_IMPORTED_MODULE_2__.XdrWriterError(`${value} is not a ${this.structName}`);
^
XdrWriterError [TypeError]: XDR Write Error: [object Object] is not a DecoratedSignature
The relevant code from bundle.js is as follows:
classStructextends_xdr_type__WEBPACK_IMPORTED_MODULE_1__.XdrPrimitiveType{// other codes...staticwrite(value,writer){if(!(valueinstanceofthis))thrownew_errors__WEBPACK_IMPORTED_MODULE_2__.XdrWriterError(`${value} is not a ${this.structName}`);// this line is 8359}
I found that the bundle.js code includes the code from the stellar/js-xdr library, but this part of the code in js-xdr is clearly different from the one in bundle.js (the conditional statements are different).
The bundle.js file is located in the lib directory of typescript-wallet-sdk. This folder should have been generated when typescript-wallet-sdk was built and then published to npm. So, I'm wondering if it's an issue with the build process of typescript-wallet-sdk.
I suspect that the typescript-wallet-sdk library has not bundled the latest js-xdr code.
I would appreciate any advice from those with relevant experience on how to resolve this issue based on the current library. Thanks.
Here are the versions of my dependencies:
@stellar/typescript-wallet-sdk: 1.7.0
@stellar/stellar-sdk: 12.1.0
@stellar/stellar-base: 12.1.0
@stellar/js-xdr: 3.1.2
node version: 18.20.4
The text was updated successfully, but these errors were encountered:
Hi all,
I first use npm install @stellar/typescript-wallet-sdk. And when I was developing with typescript-wallet-sdk, I encountered the above error message (as mentioned in the title) while executing the code for submitting a transaction. My sample code is as follows:
The error log:
The relevant code from bundle.js is as follows:
I found that the bundle.js code includes the code from the stellar/js-xdr library, but this part of the code in js-xdr is clearly different from the one in bundle.js (the conditional statements are different).
The bundle.js file is located in the lib directory of typescript-wallet-sdk. This folder should have been generated when typescript-wallet-sdk was built and then published to npm. So, I'm wondering if it's an issue with the build process of typescript-wallet-sdk.
I suspect that the typescript-wallet-sdk library has not bundled the latest js-xdr code.
I would appreciate any advice from those with relevant experience on how to resolve this issue based on the current library. Thanks.
Here are the versions of my dependencies:
@stellar/typescript-wallet-sdk: 1.7.0
@stellar/stellar-sdk: 12.1.0
@stellar/stellar-base: 12.1.0
@stellar/js-xdr: 3.1.2
node version: 18.20.4
The text was updated successfully, but these errors were encountered: