Skip to content

Commit

Permalink
fmt ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrell-code committed Jan 12, 2022
1 parent ec42bbc commit 593d3ca
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions ts-tests/tests/test-claim-account-eip712.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ describeWithAcala("Acala RPC (Claim Account Eip712)", (context) => {

alice = new Signer(context.provider, alice_keyring.address, signingKey);

signer = new Wallet(
"0x0123456789012345678901234567890123456789012345678901234567890123"
);
signer = new Wallet("0x0123456789012345678901234567890123456789012345678901234567890123");
});

it("claim evm account", async function () {
Expand All @@ -40,37 +38,34 @@ describeWithAcala("Acala RPC (Claim Account Eip712)", (context) => {
};

const types = {
Transaction: [
{ name: "substrateAddress", type: "bytes" },
],
Transaction: [{ name: "substrateAddress", type: "bytes" }],
};

const keyring = new Keyring({type: 'sr25519', ss58Format: +context.provider.api.consts.system.ss58Prefix});
const alice_addr = await alice.getSubstrateAddress();
const string_addr = keyring.decodeAddress(alice_addr);
const keyring = new Keyring({ type: "sr25519", ss58Format: +context.provider.api.consts.system.ss58Prefix });
const alice_addr = await alice.getSubstrateAddress();
const public_key = keyring.decodeAddress(alice_addr);

// The data to sign
const value = {
substrateAddress: string_addr,
substrateAddress: public_key,
};

const signature = await signer._signTypedData(domain, types, value);
const tx = context.provider.api.tx.evmAccounts.claimAccount(await signer.getAddress(), signature);

const tx = context.provider.api.tx.evmAccounts.claimAccount(await signer.getAddress(), signature);

await new Promise(async (resolve) => {
await new Promise(async (resolve) => {
tx.signAndSend(await alice.getSubstrateAddress(), (result) => {
if (result.status.isFinalized || result.status.isInBlock) {
resolve(undefined);
}
});
});
});

let current_block_number = (await context.provider.api.query.system.number()).toNumber();
let block_hash = await context.provider.api.rpc.chain.getBlockHash(current_block_number);
const result = await context.provider.api.derive.tx.events(block_hash);

let event = result.events.filter(item => context.provider.api.events.evmAccounts.ClaimAccount.is(item.event));
let event = result.events.filter((item) => context.provider.api.events.evmAccounts.ClaimAccount.is(item.event));
expect(event.length).to.equal(1);
});
});

0 comments on commit 593d3ca

Please sign in to comment.