diff --git a/examples/piggybank/src/utils.ts b/examples/piggybank/src/utils.ts index 139a73f9..4fe09edf 100644 --- a/examples/piggybank/src/utils.ts +++ b/examples/piggybank/src/utils.ts @@ -10,6 +10,7 @@ import { InitName, ReceiveName, UpdateContractPayload, + AccountAddress, } from '@concordium/web-sdk'; export const CONTRACT_NAME = 'PiggyBank'; @@ -26,7 +27,7 @@ export const deposit = (account: string, index: bigint, subindex = 0n, amount = detectConcordiumProvider() .then((provider) => { provider - .sendTransaction(account, AccountTransactionType.Update, { + .sendTransaction(AccountAddress.fromBase58(account), AccountTransactionType.Update, { amount: CcdAmount.fromMicroCcd(amount), address: ContractAddress.create(index, subindex), receiveName: ReceiveName.fromString(`${CONTRACT_NAME}.insert`), @@ -50,7 +51,7 @@ export const smash = (account: string, index: bigint, subindex = 0n) => { detectConcordiumProvider() .then((provider) => { provider - .sendTransaction(account, AccountTransactionType.Update, { + .sendTransaction(AccountAddress.fromBase58(account), AccountTransactionType.Update, { amount: CcdAmount.fromMicroCcd(0), // This feels weird? Why do I need an amount for a non-payable receive? address: ContractAddress.create(index, subindex), receiveName: ReceiveName.fromString(`${CONTRACT_NAME}.smash`), diff --git a/packages/browser-wallet-api/src/compatibility.ts b/packages/browser-wallet-api/src/compatibility.ts index 4ffe85ab..902b5434 100644 --- a/packages/browser-wallet-api/src/compatibility.ts +++ b/packages/browser-wallet-api/src/compatibility.ts @@ -42,7 +42,9 @@ export function isGtuAmount(cand: any): cand is GtuAmount { } function sanitizeAccountAddress(accountAddress: AccountAddressSource): AccountAddress.Type { - return AccountAddress.instanceOf(accountAddress) ? accountAddress : AccountAddress.fromBase58(accountAddress); + return typeof accountAddress === 'string' + ? AccountAddress.fromBase58(accountAddress) + : AccountAddress.fromBase58(accountAddress.address); } export type SanitizedSignMessageInput = { @@ -92,10 +94,10 @@ export function sanitizeAddCIS2TokensInput( ): SanitizedAddCIS2TokensInput { const accountAddress = sanitizeAccountAddress(_accountAddress); let contractAddress: ContractAddress.Type; - if (ContractAddress.instanceOf(contractAddressSource)) { - contractAddress = contractAddressSource; - } else { + if (typeof contractAddressSource === 'bigint') { contractAddress = ContractAddress.create(contractAddressSource, contractSubindex); + } else { + contractAddress = ContractAddress.create(contractAddressSource.index, contractSubindex); } return { accountAddress, tokenIds, contractAddress }; diff --git a/packages/browser-wallet/CHANGELOG.md b/packages/browser-wallet/CHANGELOG.md index b140bf2c..b2466a00 100644 --- a/packages/browser-wallet/CHANGELOG.md +++ b/packages/browser-wallet/CHANGELOG.md @@ -8,6 +8,7 @@ - Sign message's stringification failing with new `deserializeTypeValue`. - An issue where the max contract execution energy was not rendered correctly for init contract transactions. - Updated web-sdk to fix an issue where init contract transactions were not serialized correctly. +- Errors in wallet-api from version mismatch between wallet and dApps. ## 1.1.10