git.delta.rocks / unique-network / refs/commits / 861b9092fa33

difftreelog

NFTPAR-94: SIT: Balances can be transferred using smart contract.

sotmorskiy2020-10-02parent: #154381a.patch.diff
in: master

18 files changed

addedtests/ink-types-node-runtime/.gitignorediffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/Cargo.tomldiffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/LICENSEdiffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/README.mddiffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/examples/calls/.gitignorediffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/examples/calls/.ink/abi_gen/Cargo.tomldiffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/examples/calls/.ink/abi_gen/main.rsdiffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/examples/calls/Cargo.tomldiffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/examples/calls/lib.rsdiffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/src/calls.rsdiffbeforeafterboth

no changes

addedtests/ink-types-node-runtime/src/lib.rsdiffbeforeafterboth

no changes

addedtests/src/balance-transfer-contract/calls.wasmdiffbeforeafterboth

binary blob — no preview

addedtests/src/balance-transfer-contract/metadata.jsondiffbeforeafterboth

no changes

addedtests/src/contracts.test.tsdiffbeforeafterboth

no changes

deletedtests/src/deploy-flipper.test.tsdiffbeforeafterboth

no changes

addedtests/src/substrate/get-balance.tsdiffbeforeafterboth

no changes

modifiedtests/src/substrate/privateKey.tsdiffbeforeafterboth
1import { Keyring } from "@polkadot/api";1import { Keyring } from "@polkadot/api";
2import { IKeyringPair } from "@polkadot/types/types";
23
3export default function privateKey(account: string) {4export default function privateKey(account: string): IKeyringPair {
4 const keyring = new Keyring({ type: 'sr25519' });5 const keyring = new Keyring({ type: 'sr25519' });
5 6
6 return keyring.addFromUri(account);7 return keyring.addFromUri(account);
modifiedtests/src/transfer.test.tsdiffbeforeafterboth
1import createSubstrateApi from "./substrate/substrate-api";
2import { Keyring, ApiPromise } from "@polkadot/api";
3import {AccountInfo} from "@polkadot/types/interfaces/system";
4import { expect } from "chai";1import { expect } from "chai";
5import usingApi from "./substrate/substrate-api";2import usingApi from "./substrate/substrate-api";
6import promisifySubstrate from "./substrate/promisify-substrate";3import promisifySubstrate from "./substrate/promisify-substrate";
7import waitNewBlocks from "./substrate/wait-new-blocks";4import waitNewBlocks from "./substrate/wait-new-blocks";
8import { alicesPublicKey, bobsPublicKey } from "./accounts";5import { alicesPublicKey, bobsPublicKey } from "./accounts";
9import privateKey from "./substrate/privateKey";6import privateKey from "./substrate/privateKey";
10
11async function getBalance(api: ApiPromise, accounts: string[]): Promise<bigint[]> {7import getBalance from "./substrate/get-balance";
12 const balance = promisifySubstrate(api, (accounts: string[]) => api.query.system.account.multi(accounts));
13 const responce = await balance(accounts) as unknown as AccountInfo[];
14 return responce.map(r => r.data.free.toBigInt().valueOf());
15}
168
17describe('Transfer', () => {9describe('Transfer', () => {
18 it('Balance transfers', async () => {10 it('Balance transfers', async () => {