Skip to content

Commit

Permalink
[ts sdk] bug fix on names replacement (#20577)
Browse files Browse the repository at this point in the history
## Description 

The plugin would replace things when it shouldn't! 

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
manolisliolios authored Dec 10, 2024
1 parent 91444bf commit 100207f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-frogs-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mysten/sui': patch
---

Fixes replacements on `namedPackagesPlugin` to only replace the package target if it is a mvr name.
7 changes: 5 additions & 2 deletions sdk/typescript/src/transactions/plugins/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,11 @@ export const replaceNames = (builder: TransactionDataBuilder, cache: NamedPackag
if (name.includes(NAME_SEPARATOR) && !cache.packages[name])
throw new Error(`No address found for package: ${name}`);

nameParts[0] = cache.packages[name];
tx.package = nameParts.join('::');
// Replace package name with address.
if (name.includes(NAME_SEPARATOR)) {
nameParts[0] = cache.packages[name];
tx.package = nameParts.join('::');
}

const types = tx.typeArguments;
if (!types) continue;
Expand Down

0 comments on commit 100207f

Please sign in to comment.