Compare commits

..
Author SHA1 Message Date
Joaquim VergesGitHubgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
3315a53653 Version Packages (#6968)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-05-07 01:57:16 -07:00
Joaquim VergesandGitHub 4e42158c7b [SDK] Handle Hedera native currency decimals for smart wallet calls (#6969) 2025-05-07 01:54:43 -07:00
Joaquim VergesandGitHub 5a069fe657 [PayEmbed] Always connect to destination chain if available (#6967) 2025-05-06 19:05:12 -07:00
Joaquim VergesandGitHub 490497c68b [Checkout] Enhance redirect handling for different payment types (#6959) 2025-05-06 19:04:41 -07:00
8 changed files with 55 additions and 22 deletions
@@ -85,17 +85,33 @@ export function CheckoutEmbed({
onPurchaseSuccess: (result) => {
if (!redirectUri) return;
const url = new URL(redirectUri);
if (result.type === "transaction") {
url.searchParams.set("txHash", result.transactionHash);
return window.open(url.toString());
}
if (result.status.status === "NOT_FOUND") {
throw new Error("Transaction not found");
}
const txHash = result.status.source?.transactionHash;
if (typeof txHash === "string") {
url.searchParams.set("txHash", txHash);
switch (result.type) {
case "crypto": {
url.searchParams.set("status", result.status.status);
if (
"source" in result.status &&
result.status.source?.transactionHash
) {
url.searchParams.set(
"txHash",
result.status.source?.transactionHash,
);
}
break;
}
case "fiat": {
url.searchParams.set("status", result.status.status);
if ("intentId" in result.status) {
url.searchParams.set("intentId", result.status.intentId);
}
break;
}
case "transaction": {
url.searchParams.set("txHash", result.transactionHash);
break;
}
}
return window.open(url.toString());
},
}}
/>
+8
View File
@@ -1,5 +1,13 @@
# thirdweb
## 5.97.2
### Patch Changes
- [#6969](https://github.com/thirdweb-dev/js/pull/6969) [`4e42158`](https://github.com/thirdweb-dev/js/commit/4e42158c7bcf6ae2dd064abaf1972a6529ae5449) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Handle hedera native currency decimal values for smart wallet calls
- [#6967](https://github.com/thirdweb-dev/js/pull/6967) [`5a069fe`](https://github.com/thirdweb-dev/js/commit/5a069fe657de66fd8f64a7d41c089e32c1930ba2) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Always connect to destination chain if available in PayEmbed
## 5.97.1
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "thirdweb",
"version": "5.97.1",
"version": "5.97.2",
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"
@@ -58,7 +58,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFT", () => {
includeOwner: true,
});
expect(nft.metadata.name).toBe("Doodle #1");
expect(nft.owner).toBe("0xbE9936FCFC50666f5425FDE4A9decC59cEF73b24");
expect(nft.owner).toBeDefined();
expect(nft).toMatchInlineSnapshot(`
{
"chainId": 1,
@@ -92,7 +92,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc721.getNFT", () => {
"name": "Doodle #1",
"uri": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/1",
},
"owner": "0xbE9936FCFC50666f5425FDE4A9decC59cEF73b24",
"owner": "0x620b70123fB810F6C653DA7644b5dD0b6312e4D8",
"tokenAddress": "0x8a90cab2b38dba80c64b7734e58ee1db38b8992e",
"tokenURI": "ipfs://QmPMc4tcBsMqLRuCQtPmPe84bpSjrC3Ky7t3JWuHXYB4aS/1",
"type": "ERC721",
@@ -271,8 +271,8 @@ function BuyScreenContent(props: BuyScreenContentProps) {
<WalletSwitcherConnectionScreen
accountAbstraction={props.connectOptions?.accountAbstraction}
appMetadata={props.connectOptions?.appMetadata}
chain={props.connectOptions?.chain}
chains={props.connectOptions?.chains}
chain={toChain || props.connectOptions?.chain}
chains={[toChain, ...(props.connectOptions?.chains || [])]}
client={props.client}
connectLocale={props.connectLocale}
isEmbed={props.isEmbed}
@@ -181,14 +181,15 @@ export function prepareExecute(args: {
if (execute) {
return execute(accountContract, transaction);
}
let value = transaction.value || 0n;
// special handling of hedera chains, decimals for native value is 8 instead of 18 when passed as contract params
if (transaction.chainId === 295 || transaction.chainId === 296) {
value = value / BigInt(10 ** 10);
}
return prepareContractCall({
contract: accountContract,
method: "function execute(address, uint256, bytes)",
params: [
transaction.to || "",
transaction.value || 0n,
transaction.data || "0x",
],
params: [transaction.to || "", value, transaction.data || "0x"],
// if gas is specified for the inner tx, use that and add 21k for the execute call on the account contract
// this avoids another estimateGas call when bundling the userOp
// and also allows for passing custom gas limits for the inner tx
@@ -215,12 +216,18 @@ export function prepareBatchExecute(args: {
if (executeBatch) {
return executeBatch(accountContract, transactions);
}
let values = transactions.map((tx) => tx.value || 0n);
const chainId = transactions[0]?.chainId;
// special handling of hedera chains, decimals for native value is 8 instead of 18 when passed as contract params
if (chainId === 295 || chainId === 296) {
values = values.map((value) => value / BigInt(10 ** 10));
}
return prepareContractCall({
contract: accountContract,
method: "function executeBatch(address[], uint256[], bytes[])",
params: [
transactions.map((tx) => tx.to || ""),
transactions.map((tx) => tx.value || 0n),
values,
transactions.map((tx) => tx.data || "0x"),
],
});
+2
View File
@@ -1,5 +1,7 @@
# @thirdweb-dev/wagmi-adapter
## 0.2.71
## 0.2.70
## 0.2.69
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wagmi-adapter",
"version": "0.2.70",
"version": "0.2.71",
"repository": {
"type": "git",
"url": "git+https://github.com/thirdweb-dev/js.git#main"