11import { SorobanContextType } from '@soroban-react/core'
22
33import { Sign } from 'crypto'
4- import * as SorobanClient from 'soroban-client'
5- import { SorobanRpc } from 'soroban-client'
4+ import * as StellarSdk from 'stellar-sdk'
5+
6+ import { SorobanRpc } from 'stellar-sdk'
67
78import type { Tx , Transaction , TxResponse } from './types'
89
@@ -29,7 +30,7 @@ export async function signAndSendTransaction({
2930
3031 // preflight and add the footprint !
3132 if ( ! skipAddingFootprint ) {
32- txn = await server . prepareTransaction ( txn , networkPassphrase )
33+ txn = await server . prepareTransaction ( txn )
3334 if ( ! txn ) {
3435 throw new Error ( 'No transaction after adding footprint' )
3536 }
@@ -42,8 +43,8 @@ export async function signAndSendTransaction({
4243 // if (auth_len > 1) {
4344 // throw new NotImplementedError("Multiple auths not yet supported");
4445 // } else if (auth_len == 1) {
45- // // TODO: figure out how to fix with new SorobanClient
46- // // const auth = SorobanClient .xdr.SorobanAuthorizationEntry.fromXDR(auths![0]!, 'base64')
46+ // // TODO: figure out how to fix with new StellarSdk
47+ // // const auth = StellarSdk .xdr.SorobanAuthorizationEntry.fromXDR(auths![0]!, 'base64')
4748 // // if (auth.addressWithNonce() !== undefined) {
4849 // // throw new NotImplementedError(
4950 // // `This transaction needs to be signed by ${auth.addressWithNonce()
@@ -55,21 +56,19 @@ export async function signAndSendTransaction({
5556 let signed = ''
5657 if ( secretKey ) {
5758 // User as set a secretKey, txn will be signed using the secretKey
58- const keypair = SorobanClient . Keypair . fromSecret ( secretKey )
59+ const keypair = StellarSdk . Keypair . fromSecret ( secretKey )
5960 txn . sign ( keypair )
6061 signed = txn . toXDR ( )
6162 } else if ( sorobanContext . activeConnector ) {
6263 // User has not set a secretKey, txn will be signed using the Connector (wallet) provided in the sorobanContext
63- signed = await sorobanContext . activeConnector . signTransaction ( txn . toXDR ( ) , {
64- networkPassphrase,
65- } )
64+ signed = await sorobanContext . activeConnector . signTransaction ( txn . toXDR ( ) )
6665 } else {
6766 throw new Error (
6867 'signAndSendTransaction: no secretKey, neither active Connector'
6968 )
7069 }
7170
72- const transactionToSubmit = SorobanClient . TransactionBuilder . fromXDR (
71+ const transactionToSubmit = StellarSdk . TransactionBuilder . fromXDR (
7372 signed ,
7473 networkPassphrase
7574 )
@@ -89,7 +88,7 @@ export async function sendTx({
8988} : {
9089 tx : Tx
9190 secondsToWait : number
92- server : SorobanClient . Server
91+ server : StellarSdk . SorobanRpc . Server
9392} ) : Promise < TxResponse > {
9493 const sendTransactionResponse = await server . sendTransaction ( tx )
9594 let getTransactionResponse = await server . getTransaction (
@@ -116,7 +115,7 @@ export async function sendTx({
116115 }
117116
118117 if (
119- getTransactionResponse . status === SorobanRpc . GetTransactionStatus . NOT_FOUND
118+ getTransactionResponse . status === SorobanRpc . Api . GetTransactionStatus . NOT_FOUND
120119 ) {
121120 console . error (
122121 `Waited ${ secondsToWait } seconds for transaction to complete, but it did not. ` +
0 commit comments