Skip to content

Commit

Permalink
Merge pull request #155 from perawallet/fix/base64-arbitrary-data-for…
Browse files Browse the repository at this point in the history
…-mobile

v1.3.3
  • Loading branch information
yigitguler authored Sep 27, 2023
2 parents 4e70907 + 08374aa commit 054b66b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.3.2",
"version": "1.3.3",
"name": "@perawallet/connect",
"description": "JavaScript SDK for integrating Pera Wallet to web applications.",
"main": "dist/index.js",
Expand Down
10 changes: 8 additions & 2 deletions src/PeraWalletConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ class PeraWalletConnect {
signer,
chainId
}: {
data: PeraWalletArbitraryData[];
// Converted Uin8Array data to base64
data: {data: string; message: string;}[];
signer: string;
chainId: AlgorandChainIDs;
}) {
Expand Down Expand Up @@ -469,8 +470,13 @@ class PeraWalletConnect {
});
}

const b64encodedData = data.map((item) => ({
...item,
data: Buffer.from(item.data).toString('base64')
}));

// Pera Mobile Wallet flow
return this.signDataWithMobile({data, signer, chainId});
return this.signDataWithMobile({data: b64encodedData, signer, chainId});
}
}

Expand Down

0 comments on commit 054b66b

Please sign in to comment.