Skip to content

Commit

Permalink
Fix package and module renames in migration guide (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Jan 3, 2024
1 parent 3791309 commit 68795b9
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions docs/migration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**This library is deprecated in favor of `stellar-sdk`.**
**This library is deprecated in favor of `@stellar/stellar-sdk`.**

## Migrating to `stellar-sdk`
## Migrating to `@stellar/stellar-sdk`

This migration guide is focused towards former users of `soroban-client`, but you can refer to the [full migration guide](https://gist.github.com/Shaptic/5ce4f16d9cce7118f391fbde398c2f30/) for more details.

Expand All @@ -22,7 +22,7 @@ const s = SorobanClient.Server("...");
const r: SorobanClient.SorobanRpc.GetTransactionResponse = s.getTransaction("...");

// after:
import { SorobanRpc } from 'soroban-client';
import { SorobanRpc } from '@stellar/stellar-sdk';

const s = SorobanRpc.Server("...");
const r: SorobanRpc.Api.GetTransactionResponse = s.getTransaction("...");
Expand All @@ -35,7 +35,7 @@ import {
Account,
TransactionBuilder,
SorobanDataBuilder
} from 'stellar-sdk';
} from '@stellar/stellar-sdk';
```

(If you've ever imported and used `stellar-base` directly, then this distinction should be clear: anything found in `stellar-base` lives in the top-level module.)
Expand Down Expand Up @@ -93,23 +93,23 @@ import {
Operation,
scValToNative,
SorobanRpc
} from 'stellar-sdk';
const { Api, assembleTransaction } = SorobanRpc;
} from '@stellar/stellar-sdk';
const { Api, Server, assembleTransaction } = SorobanRpc;

const s = SorobanRpc.Server('https://horizon-testnet.stellar.org');
const s = Server('https://soroban-testnet.stellar.org');
const kp = Keypair.random();

async function main() {
return s.getAccount(kp.publicKey()).then(account => {
const tx = new TransactionBuilder(account, { fee: BASE_FEE })
.addOperation(c.call("hello", scValToNative("world")))
.setNetworkPassphrase(Networks.FUTURENET)
.addOperation(c.call("hello", nativeToScVal("world")))
.setNetworkPassphrase(Networks.TESTNET)
.setTimeout(30)
.build();

let sim: Api.SimulateTransactionResult;
sim = await s.simulateTransaction(tx);
const readyTx = assembleTransaction(tx, Networks.FUTURENET, sim);
const readyTx = assembleTransaction(tx, sim);
readyTx.sign(kp);

return s.submitTransaction(readyTx);
Expand Down

0 comments on commit 68795b9

Please sign in to comment.