Skip to content

Commit

Permalink
use encoded address for comparisson with redeem event
Browse files Browse the repository at this point in the history
  • Loading branch information
gianfra-t committed Apr 23, 2024
1 parent 6c66e55 commit 52bdfb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/services/polkadot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { EventListener } from './eventListener';
import { EventStatus } from '../../components/GenericEvent';
import { WalletAccount } from '@talismn/connect-wallets';


export const ASSET_ISSUER_RAW = `0x${Keypair.fromPublicKey(ASSET_ISSUER).rawPublicKey().toString('hex')}`;

export async function executeSpacewalkRedeem(
Expand Down
5 changes: 3 additions & 2 deletions src/services/polkadot/spacewalk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SpacewalkPrimitivesVaultId } from '@polkadot/types/lookup';
import { Buffer } from 'buffer';
import { ISubmittableResult } from '@polkadot/types/types';
import { WalletAccount } from '@talismn/connect-wallets';
import {getAddressForFormat} from '../../helpers/addressFormatter';

export function extractAssetFromWrapped(wrapped: any) {
if (wrapped.Stellar === 'StellarNative') {
Expand Down Expand Up @@ -81,7 +82,7 @@ export class VaultService {

const release = await this.api!.mutex.lock(walletAccount.address);
const nonce = await this.api!.api.rpc.system.accountNextIndex(walletAccount.address);
console.log(`Nonce for ${walletAccount.address} is ${nonce.toString()}`);
console.log(`Nonce for ${getAddressForFormat(walletAccount.address, this.api!.ss58Format)} is ${nonce.toString()}`);

return new Promise<SpacewalkRedeemRequestEvent>((resolve, reject) =>
this.api!.api.tx.redeem.requestRedeem(amount, stellarPkBytes, this.vaultId!)
Expand Down Expand Up @@ -112,7 +113,7 @@ export class VaultService {
const event = redeemEvents
.map((event) => parseEventRedeemRequest(event))
.filter((event) => {
return event.redeemer === walletAccount.address;
return event.redeemer === getAddressForFormat(walletAccount.address, this.api!.ss58Format);
});

if (event.length == 0) {
Expand Down

0 comments on commit 52bdfb7

Please sign in to comment.