Skip to content

Commit

Permalink
fix: handle BigInt serialization for ecosystem wallets (#4756)
Browse files Browse the repository at this point in the history
## Problem solved

Short description of the bug fixed or feature added

<!-- start pr-codex -->

---

## PR-Codex overview
The focus of this PR is to handle biging serialization for ecosystem wallets.

### Detailed summary
- Updated `signTypedData`, `signMessage`, and `signTransaction` functions to use `stringify` for serialization
- Improved handling of payload data in ecosystem wallets

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
  • Loading branch information
joaquim-verges committed Sep 23, 2024
1 parent 1133ccc commit 33936b3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/proud-eggs-rule.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Handle biging serialization for ecosystem wallets
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ThirdwebClient } from "../../../../../client/client.js";
import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
import { getClientFetch } from "../../../../../utils/fetch.js";
import { stringify } from "../../../../../utils/json.js";
import type { Ecosystem } from "../../types.js";
import { getAuthToken } from "../get-auth-token.js";

Expand Down Expand Up @@ -28,7 +29,7 @@ export async function signMessage({
"x-thirdweb-client-id": client.clientId,
Authorization: `Bearer embedded-wallet-token:${authToken}`,
},
body: JSON.stringify({
body: stringify({
messagePayload: {
message,
isRaw,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ThirdwebClient } from "../../../../../client/client.js";
import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
import type { Hex } from "../../../../../utils/encoding/hex.js";
import { getClientFetch } from "../../../../../utils/fetch.js";
import { stringify } from "../../../../../utils/json.js";
import type { Ecosystem } from "../../types.js";
import { getAuthToken } from "../get-auth-token.js";

Expand All @@ -27,7 +28,7 @@ export async function signTransaction({
"x-thirdweb-client-id": client.clientId,
Authorization: `Bearer embedded-wallet-token:${authToken}`,
},
body: JSON.stringify({
body: stringify({
transactionPayload: payload,
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { TypedDataDefinition } from "viem";
import type { ThirdwebClient } from "../../../../../client/client.js";
import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
import { getClientFetch } from "../../../../../utils/fetch.js";
import { stringify } from "../../../../../utils/json.js";
import type { Ecosystem } from "../../types.js";
import { getAuthToken } from "../get-auth-token.js";

Expand Down Expand Up @@ -30,7 +31,7 @@ export async function signTypedData<
"x-thirdweb-client-id": client.clientId,
Authorization: `Bearer embedded-wallet-token:${authToken}`,
},
body: JSON.stringify({
body: stringify({
...payload,
}),
},
Expand Down

0 comments on commit 33936b3

Please sign in to comment.