From 364a93a1b10be70aabe0fb8937b3c1af610d1eba Mon Sep 17 00:00:00 2001 From: hayes-mysten <135670682+hayes-mysten@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:00:16 -0800 Subject: [PATCH] [zksend] add claimedBy property when loading assets of claimed link (#20244) ## Description Describe the changes or additions included in this PR. ## 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: --- .changeset/loud-pianos-compare.md | 5 +++++ .changeset/witty-adults-notice.md | 5 +++++ sdk/zksend/src/links/claim.ts | 2 ++ sdk/zksend/src/wallet/channel/index.ts | 7 +------ 4 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .changeset/loud-pianos-compare.md create mode 100644 .changeset/witty-adults-notice.md diff --git a/.changeset/loud-pianos-compare.md b/.changeset/loud-pianos-compare.md new file mode 100644 index 0000000000000..6f04fca2b2814 --- /dev/null +++ b/.changeset/loud-pianos-compare.md @@ -0,0 +1,5 @@ +--- +'@mysten/zksend': minor +--- + +Remove decoding spaces to `+` in zksend wallet url hashes diff --git a/.changeset/witty-adults-notice.md b/.changeset/witty-adults-notice.md new file mode 100644 index 0000000000000..d1c0b6fae3820 --- /dev/null +++ b/.changeset/witty-adults-notice.md @@ -0,0 +1,5 @@ +--- +'@mysten/zksend': minor +--- + +Add claimedBy property that is set when claimedAssets are loaded diff --git a/sdk/zksend/src/links/claim.ts b/sdk/zksend/src/links/claim.ts index 1e1d2515a5f25..932d3aa882484 100644 --- a/sdk/zksend/src/links/claim.ts +++ b/sdk/zksend/src/links/claim.ts @@ -66,6 +66,7 @@ export class ZkSendLink { creatorAddress?: string; assets?: LinkAssets; claimed?: boolean; + claimedBy?: string; bagObject?: SuiObjectData | null; #client: SuiClient; @@ -532,6 +533,7 @@ export class ZkSendLink { ? input.value : bcs.Address.parse(new Uint8Array((input.value as { Pure: number[] }).Pure)); + this.claimedBy = receiver; this.assets = getAssetsFromTransaction({ transaction: tx, address: receiver, diff --git a/sdk/zksend/src/wallet/channel/index.ts b/sdk/zksend/src/wallet/channel/index.ts index f06712d885fde..8c655342b5278 100644 --- a/sdk/zksend/src/wallet/channel/index.ts +++ b/sdk/zksend/src/wallet/channel/index.ts @@ -131,12 +131,7 @@ export class StashedHost { const parsed = new URL(url); const urlHashData = parsed.hash - ? Object.fromEntries( - [...new URLSearchParams(parsed.hash.slice(1))].map(([key, value]) => [ - key, - value.replace(/ /g, '+'), - ]), - ) + ? Object.fromEntries([...new URLSearchParams(parsed.hash.slice(1))]) : {}; const request = parse(StashedRequest, {