difftreelog
Move old contracts to .oudated
in: master
17 files changed
tests/src/.outdated/balance-transfer-contract/calls.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/.outdated/balance-transfer-contract/metadata.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/.outdated/balance-transfer-contract/metadata.json
@@ -0,0 +1,96 @@
+{
+ "registry": {
+ "strings": [
+ "Storage",
+ "calls",
+ "__ink_private",
+ "__ink_storage",
+ "new",
+ "balance_transfer",
+ "dest",
+ "AccountId",
+ "value",
+ "Balance"
+ ],
+ "types": [
+ {
+ "id": {
+ "custom.name": 1,
+ "custom.namespace": [
+ 2,
+ 2,
+ 3,
+ 4
+ ],
+ "custom.params": []
+ },
+ "def": {
+ "struct.fields": []
+ }
+ },
+ {
+ "id": {
+ "array.len": 32,
+ "array.type": 3
+ },
+ "def": "builtin"
+ },
+ {
+ "id": "u8",
+ "def": "builtin"
+ },
+ {
+ "id": "u128",
+ "def": "builtin"
+ }
+ ]
+ },
+ "storage": {
+ "struct.type": 1,
+ "struct.fields": []
+ },
+ "contract": {
+ "name": 2,
+ "constructors": [
+ {
+ "name": 5,
+ "selector": "[\"0x5E\",\"0xBD\",\"0x88\",\"0xD6\"]",
+ "args": [],
+ "docs": []
+ }
+ ],
+ "messages": [
+ {
+ "name": 6,
+ "selector": "[\"0xEC\",\"0x9F\",\"0xA4\",\"0xF0\"]",
+ "mutates": false,
+ "args": [
+ {
+ "name": 7,
+ "type": {
+ "ty": 2,
+ "display_name": [
+ 8
+ ]
+ }
+ },
+ {
+ "name": 9,
+ "type": {
+ "ty": 4,
+ "display_name": [
+ 10
+ ]
+ }
+ }
+ ],
+ "return_type": null,
+ "docs": [
+ "Dispatches a `transfer` call to the Balances srml module"
+ ]
+ }
+ ],
+ "events": [],
+ "docs": []
+ }
+}
\ No newline at end of file
tests/src/.outdated/flipper/flipper.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/.outdated/flipper/metadata.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/.outdated/flipper/metadata.json
@@ -0,0 +1,110 @@
+{
+ "metadataVersion": "0.1.0",
+ "source": {
+ "hash": "0x5b02ceadaacee8408d3c6496394847092c099bcb897221dbe8d22c16d372fa17",
+ "language": "ink! 3.0.0-rc2",
+ "compiler": "rustc 1.51.0-nightly"
+ },
+ "contract": {
+ "name": "flipper",
+ "version": "0.1.0",
+ "authors": [
+ "[your_name] <[your_email]>"
+ ]
+ },
+ "spec": {
+ "constructors": [
+ {
+ "args": [
+ {
+ "name": "init_value",
+ "type": {
+ "displayName": [
+ "bool"
+ ],
+ "type": 1
+ }
+ }
+ ],
+ "docs": [
+ " Constructor that initializes the `bool` value to the given `init_value`."
+ ],
+ "name": [
+ "new"
+ ],
+ "selector": "0xd183512b"
+ },
+ {
+ "args": [],
+ "docs": [
+ " Constructor that initializes the `bool` value to `false`.",
+ "",
+ " Constructors can delegate to other constructors."
+ ],
+ "name": [
+ "default"
+ ],
+ "selector": "0x6a3712e2"
+ }
+ ],
+ "docs": [],
+ "events": [],
+ "messages": [
+ {
+ "args": [],
+ "docs": [
+ " A message that can be called on instantiated contracts.",
+ " This one flips the value of the stored `bool` from `true`",
+ " to `false` and vice versa."
+ ],
+ "mutates": true,
+ "name": [
+ "flip"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0xc096a5f3"
+ },
+ {
+ "args": [],
+ "docs": [
+ " Simply returns the current value of our `bool`."
+ ],
+ "mutates": false,
+ "name": [
+ "get"
+ ],
+ "payable": false,
+ "returnType": {
+ "displayName": [
+ "bool"
+ ],
+ "type": 1
+ },
+ "selector": "0x1e5ca456"
+ }
+ ]
+ },
+ "storage": {
+ "struct": {
+ "fields": [
+ {
+ "layout": {
+ "cell": {
+ "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
+ "ty": 1
+ }
+ },
+ "name": "value"
+ }
+ ]
+ }
+ },
+ "types": [
+ {
+ "def": {
+ "primitive": "bool"
+ }
+ }
+ ]
+}
\ No newline at end of file
tests/src/.outdated/load_test_sc/loadtester.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/.outdated/load_test_sc/metadata.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/.outdated/load_test_sc/metadata.json
@@ -0,0 +1,125 @@
+{
+ "metadataVersion": "0.1.0",
+ "source": {
+ "hash": "0x168cc3cba9657ad3950fb506e568751f99b90fb097685107f6101675662a8303",
+ "language": "ink! 3.0.0-rc2",
+ "compiler": "rustc 1.49.0-nightly"
+ },
+ "contract": {
+ "name": "loadtester",
+ "version": "0.1.0",
+ "authors": [
+ "[your_name] <[your_email]>"
+ ]
+ },
+ "spec": {
+ "constructors": [
+ {
+ "args": [],
+ "docs": [],
+ "name": [
+ "new"
+ ],
+ "selector": "0xd183512b"
+ }
+ ],
+ "docs": [],
+ "events": [],
+ "messages": [
+ {
+ "args": [
+ {
+ "name": "count",
+ "type": {
+ "displayName": [
+ "u64"
+ ],
+ "type": 2
+ }
+ }
+ ],
+ "docs": [],
+ "mutates": true,
+ "name": [
+ "bloat"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0x49891c2a"
+ },
+ {
+ "args": [],
+ "docs": [],
+ "mutates": false,
+ "name": [
+ "get"
+ ],
+ "payable": false,
+ "returnType": {
+ "displayName": [
+ "u128"
+ ],
+ "type": 3
+ },
+ "selector": "0x1e5ca456"
+ }
+ ]
+ },
+ "storage": {
+ "struct": {
+ "fields": [
+ {
+ "layout": {
+ "struct": {
+ "fields": [
+ {
+ "layout": {
+ "cell": {
+ "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
+ "ty": 1
+ }
+ },
+ "name": "len"
+ },
+ {
+ "layout": {
+ "array": {
+ "cellsPerElem": 1,
+ "layout": {
+ "cell": {
+ "key": "0x0000000001000000000000000000000000000000000000000000000000000000",
+ "ty": 2
+ }
+ },
+ "len": 4294967295,
+ "offset": "0x0100000000000000000000000000000000000000000000000000000000000000"
+ }
+ },
+ "name": "elems"
+ }
+ ]
+ }
+ },
+ "name": "vector"
+ }
+ ]
+ }
+ },
+ "types": [
+ {
+ "def": {
+ "primitive": "u32"
+ }
+ },
+ {
+ "def": {
+ "primitive": "u64"
+ }
+ },
+ {
+ "def": {
+ "primitive": "u128"
+ }
+ }
+ ]
+}
\ No newline at end of file
tests/src/.outdated/transfer_contract/metadata.jsondiffbeforeafterboth--- /dev/null
+++ b/tests/src/.outdated/transfer_contract/metadata.json
@@ -0,0 +1,469 @@
+{
+ "metadataVersion": "0.1.0",
+ "source": {
+ "hash": "0xc6c3f47adeafe86d1674ed72c7179605787842f2f05a2d7da0dbabf3c4fa1aa8",
+ "language": "ink! 3.0.0-rc3",
+ "compiler": "rustc 1.52.0-nightly"
+ },
+ "contract": {
+ "name": "nft_transfer",
+ "version": "0.1.0",
+ "authors": [
+ "[Greg Zaitsev] <[your_email]>"
+ ]
+ },
+ "spec": {
+ "constructors": [
+ {
+ "args": [],
+ "docs": [
+ "Default Constructor",
+ "",
+ "Constructors can delegate to other constructors."
+ ],
+ "name": [
+ "default"
+ ],
+ "selector": "0xed4b9d1b"
+ }
+ ],
+ "docs": [],
+ "events": [],
+ "messages": [
+ {
+ "args": [
+ {
+ "name": "recipient",
+ "type": {
+ "displayName": [
+ "AccountId"
+ ],
+ "type": 1
+ }
+ },
+ {
+ "name": "collection_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "token_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "amount",
+ "type": {
+ "displayName": [
+ "u128"
+ ],
+ "type": 5
+ }
+ }
+ ],
+ "docs": [
+ " Transfer one NFT token"
+ ],
+ "mutates": true,
+ "name": [
+ "transfer"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0x84a15da1"
+ },
+ {
+ "args": [
+ {
+ "name": "recipient",
+ "type": {
+ "displayName": [
+ "AccountId"
+ ],
+ "type": 1
+ }
+ },
+ {
+ "name": "collection_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "data",
+ "type": {
+ "displayName": [
+ "CreateItemData"
+ ],
+ "type": 6
+ }
+ }
+ ],
+ "docs": [],
+ "mutates": true,
+ "name": [
+ "create_item"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0xd7c3f083"
+ },
+ {
+ "args": [
+ {
+ "name": "owner",
+ "type": {
+ "displayName": [
+ "AccountId"
+ ],
+ "type": 1
+ }
+ },
+ {
+ "name": "collection_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "data",
+ "type": {
+ "displayName": [
+ "Vec"
+ ],
+ "type": 8
+ }
+ }
+ ],
+ "docs": [],
+ "mutates": true,
+ "name": [
+ "create_multiple_items"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0x15f9a1eb"
+ },
+ {
+ "args": [
+ {
+ "name": "spender",
+ "type": {
+ "displayName": [
+ "AccountId"
+ ],
+ "type": 1
+ }
+ },
+ {
+ "name": "collection_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "item_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "amount",
+ "type": {
+ "displayName": [
+ "u128"
+ ],
+ "type": 5
+ }
+ }
+ ],
+ "docs": [],
+ "mutates": true,
+ "name": [
+ "approve"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0x681266a0"
+ },
+ {
+ "args": [
+ {
+ "name": "owner",
+ "type": {
+ "displayName": [
+ "AccountId"
+ ],
+ "type": 1
+ }
+ },
+ {
+ "name": "recipient",
+ "type": {
+ "displayName": [
+ "AccountId"
+ ],
+ "type": 1
+ }
+ },
+ {
+ "name": "collection_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "item_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "amount",
+ "type": {
+ "displayName": [
+ "u128"
+ ],
+ "type": 5
+ }
+ }
+ ],
+ "docs": [],
+ "mutates": true,
+ "name": [
+ "transfer_from"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0x0b396f18"
+ },
+ {
+ "args": [
+ {
+ "name": "collection_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "item_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "data",
+ "type": {
+ "displayName": [
+ "Vec"
+ ],
+ "type": 7
+ }
+ }
+ ],
+ "docs": [],
+ "mutates": true,
+ "name": [
+ "set_variable_meta_data"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0xb0b26da2"
+ },
+ {
+ "args": [
+ {
+ "name": "collection_id",
+ "type": {
+ "displayName": [
+ "u32"
+ ],
+ "type": 4
+ }
+ },
+ {
+ "name": "address",
+ "type": {
+ "displayName": [
+ "AccountId"
+ ],
+ "type": 1
+ }
+ },
+ {
+ "name": "allowlisted",
+ "type": {
+ "displayName": [
+ "bool"
+ ],
+ "type": 9
+ }
+ }
+ ],
+ "docs": [],
+ "mutates": true,
+ "name": [
+ "toggle_allow_list"
+ ],
+ "payable": false,
+ "returnType": null,
+ "selector": "0x98574dac"
+ }
+ ]
+ },
+ "storage": {
+ "struct": {
+ "fields": []
+ }
+ },
+ "types": [
+ {
+ "def": {
+ "composite": {
+ "fields": [
+ {
+ "type": 2,
+ "typeName": "[u8; 32]"
+ }
+ ]
+ }
+ },
+ "path": [
+ "ink_env",
+ "types",
+ "AccountId"
+ ]
+ },
+ {
+ "def": {
+ "array": {
+ "len": 32,
+ "type": 3
+ }
+ }
+ },
+ {
+ "def": {
+ "primitive": "u8"
+ }
+ },
+ {
+ "def": {
+ "primitive": "u32"
+ }
+ },
+ {
+ "def": {
+ "primitive": "u128"
+ }
+ },
+ {
+ "def": {
+ "variant": {
+ "variants": [
+ {
+ "fields": [
+ {
+ "name": "const_data",
+ "type": 7,
+ "typeName": "Vec<u8>"
+ },
+ {
+ "name": "variable_data",
+ "type": 7,
+ "typeName": "Vec<u8>"
+ }
+ ],
+ "name": "Nft"
+ },
+ {
+ "fields": [
+ {
+ "name": "value",
+ "type": 5,
+ "typeName": "u128"
+ }
+ ],
+ "name": "Fungible"
+ },
+ {
+ "fields": [
+ {
+ "name": "const_data",
+ "type": 7,
+ "typeName": "Vec<u8>"
+ },
+ {
+ "name": "variable_data",
+ "type": 7,
+ "typeName": "Vec<u8>"
+ },
+ {
+ "name": "pieces",
+ "type": 5,
+ "typeName": "u128"
+ }
+ ],
+ "name": "ReFungible"
+ }
+ ]
+ }
+ },
+ "path": [
+ "nft_transfer",
+ "CreateItemData"
+ ]
+ },
+ {
+ "def": {
+ "sequence": {
+ "type": 3
+ }
+ }
+ },
+ {
+ "def": {
+ "sequence": {
+ "type": 6
+ }
+ }
+ },
+ {
+ "def": {
+ "primitive": "bool"
+ }
+ }
+ ]
+}
\ No newline at end of file
tests/src/.outdated/transfer_contract/nft_transfer.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/balance-transfer-contract/calls.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/balance-transfer-contract/metadata.jsondiffbeforeafterboth--- a/tests/src/balance-transfer-contract/metadata.json
+++ /dev/null
@@ -1,96 +0,0 @@
-{
- "registry": {
- "strings": [
- "Storage",
- "calls",
- "__ink_private",
- "__ink_storage",
- "new",
- "balance_transfer",
- "dest",
- "AccountId",
- "value",
- "Balance"
- ],
- "types": [
- {
- "id": {
- "custom.name": 1,
- "custom.namespace": [
- 2,
- 2,
- 3,
- 4
- ],
- "custom.params": []
- },
- "def": {
- "struct.fields": []
- }
- },
- {
- "id": {
- "array.len": 32,
- "array.type": 3
- },
- "def": "builtin"
- },
- {
- "id": "u8",
- "def": "builtin"
- },
- {
- "id": "u128",
- "def": "builtin"
- }
- ]
- },
- "storage": {
- "struct.type": 1,
- "struct.fields": []
- },
- "contract": {
- "name": 2,
- "constructors": [
- {
- "name": 5,
- "selector": "[\"0x5E\",\"0xBD\",\"0x88\",\"0xD6\"]",
- "args": [],
- "docs": []
- }
- ],
- "messages": [
- {
- "name": 6,
- "selector": "[\"0xEC\",\"0x9F\",\"0xA4\",\"0xF0\"]",
- "mutates": false,
- "args": [
- {
- "name": 7,
- "type": {
- "ty": 2,
- "display_name": [
- 8
- ]
- }
- },
- {
- "name": 9,
- "type": {
- "ty": 4,
- "display_name": [
- 10
- ]
- }
- }
- ],
- "return_type": null,
- "docs": [
- "Dispatches a `transfer` call to the Balances srml module"
- ]
- }
- ],
- "events": [],
- "docs": []
- }
-}
\ No newline at end of file
tests/src/flipper/flipper.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/flipper/metadata.jsondiffbeforeafterboth--- a/tests/src/flipper/metadata.json
+++ /dev/null
@@ -1,110 +0,0 @@
-{
- "metadataVersion": "0.1.0",
- "source": {
- "hash": "0x5b02ceadaacee8408d3c6496394847092c099bcb897221dbe8d22c16d372fa17",
- "language": "ink! 3.0.0-rc2",
- "compiler": "rustc 1.51.0-nightly"
- },
- "contract": {
- "name": "flipper",
- "version": "0.1.0",
- "authors": [
- "[your_name] <[your_email]>"
- ]
- },
- "spec": {
- "constructors": [
- {
- "args": [
- {
- "name": "init_value",
- "type": {
- "displayName": [
- "bool"
- ],
- "type": 1
- }
- }
- ],
- "docs": [
- " Constructor that initializes the `bool` value to the given `init_value`."
- ],
- "name": [
- "new"
- ],
- "selector": "0xd183512b"
- },
- {
- "args": [],
- "docs": [
- " Constructor that initializes the `bool` value to `false`.",
- "",
- " Constructors can delegate to other constructors."
- ],
- "name": [
- "default"
- ],
- "selector": "0x6a3712e2"
- }
- ],
- "docs": [],
- "events": [],
- "messages": [
- {
- "args": [],
- "docs": [
- " A message that can be called on instantiated contracts.",
- " This one flips the value of the stored `bool` from `true`",
- " to `false` and vice versa."
- ],
- "mutates": true,
- "name": [
- "flip"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0xc096a5f3"
- },
- {
- "args": [],
- "docs": [
- " Simply returns the current value of our `bool`."
- ],
- "mutates": false,
- "name": [
- "get"
- ],
- "payable": false,
- "returnType": {
- "displayName": [
- "bool"
- ],
- "type": 1
- },
- "selector": "0x1e5ca456"
- }
- ]
- },
- "storage": {
- "struct": {
- "fields": [
- {
- "layout": {
- "cell": {
- "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
- "ty": 1
- }
- },
- "name": "value"
- }
- ]
- }
- },
- "types": [
- {
- "def": {
- "primitive": "bool"
- }
- }
- ]
-}
\ No newline at end of file
tests/src/load_test_sc/loadtester.wasmdiffbeforeafterbothbinary blob — no preview
tests/src/load_test_sc/metadata.jsondiffbeforeafterboth--- a/tests/src/load_test_sc/metadata.json
+++ /dev/null
@@ -1,125 +0,0 @@
-{
- "metadataVersion": "0.1.0",
- "source": {
- "hash": "0x168cc3cba9657ad3950fb506e568751f99b90fb097685107f6101675662a8303",
- "language": "ink! 3.0.0-rc2",
- "compiler": "rustc 1.49.0-nightly"
- },
- "contract": {
- "name": "loadtester",
- "version": "0.1.0",
- "authors": [
- "[your_name] <[your_email]>"
- ]
- },
- "spec": {
- "constructors": [
- {
- "args": [],
- "docs": [],
- "name": [
- "new"
- ],
- "selector": "0xd183512b"
- }
- ],
- "docs": [],
- "events": [],
- "messages": [
- {
- "args": [
- {
- "name": "count",
- "type": {
- "displayName": [
- "u64"
- ],
- "type": 2
- }
- }
- ],
- "docs": [],
- "mutates": true,
- "name": [
- "bloat"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0x49891c2a"
- },
- {
- "args": [],
- "docs": [],
- "mutates": false,
- "name": [
- "get"
- ],
- "payable": false,
- "returnType": {
- "displayName": [
- "u128"
- ],
- "type": 3
- },
- "selector": "0x1e5ca456"
- }
- ]
- },
- "storage": {
- "struct": {
- "fields": [
- {
- "layout": {
- "struct": {
- "fields": [
- {
- "layout": {
- "cell": {
- "key": "0x0000000000000000000000000000000000000000000000000000000000000000",
- "ty": 1
- }
- },
- "name": "len"
- },
- {
- "layout": {
- "array": {
- "cellsPerElem": 1,
- "layout": {
- "cell": {
- "key": "0x0000000001000000000000000000000000000000000000000000000000000000",
- "ty": 2
- }
- },
- "len": 4294967295,
- "offset": "0x0100000000000000000000000000000000000000000000000000000000000000"
- }
- },
- "name": "elems"
- }
- ]
- }
- },
- "name": "vector"
- }
- ]
- }
- },
- "types": [
- {
- "def": {
- "primitive": "u32"
- }
- },
- {
- "def": {
- "primitive": "u64"
- }
- },
- {
- "def": {
- "primitive": "u128"
- }
- }
- ]
-}
\ No newline at end of file
tests/src/rpc.load.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import usingApi, {submitTransactionAsync} from './substrate/substrate-api';18import {IKeyringPair} from '@polkadot/types/types';19import {Abi, BlueprintPromise as Blueprint, CodePromise, ContractPromise as Contract} from '@polkadot/api-contract';20import {ApiPromise, Keyring} from '@polkadot/api';21import {findUnusedAddress} from './util/helpers';22import fs from 'fs';2324const value = 0;25const gasLimit = 500000n * 1000000n;26const endowment = '1000000000000000';2728/*eslint no-async-promise-executor: "off"*/29function deployBlueprint(alice: IKeyringPair, code: CodePromise): Promise<Blueprint> {30 return new Promise<Blueprint>(async (resolve) => {31 const unsub = await code32 .createBlueprint()33 .signAndSend(alice, (result) => {34 if (result.status.isInBlock || result.status.isFinalized) {35 // here we have an additional field in the result, containing the blueprint36 resolve(result.blueprint);37 unsub();38 }39 });40 });41}4243/*eslint no-async-promise-executor: "off"*/44function deployContract(alice: IKeyringPair, blueprint: Blueprint) : Promise<any> {45 return new Promise<any>(async (resolve) => {46 const unsub = await blueprint.tx47 .new(endowment, gasLimit)48 .signAndSend(alice, (result) => {49 if (result.status.isInBlock || result.status.isFinalized) {50 unsub();51 resolve(result);52 }53 });54 });55}5657async function prepareDeployer(api: ApiPromise, privateKeyWrapper: ((account: string) => IKeyringPair)) {58 // Find unused address59 const deployer = await findUnusedAddress(api, privateKeyWrapper);6061 // Transfer balance to it62 const alice = privateKeyWrapper('//Alice');63 const amount = BigInt(endowment) + 10n**15n;64 const tx = api.tx.balances.transfer(deployer.address, amount);65 await submitTransactionAsync(alice, tx);6667 return deployer;68}6970async function deployLoadTester(api: ApiPromise, privateKeyWrapper: ((account: string) => IKeyringPair)): Promise<[Contract, IKeyringPair]> {71 const metadata = JSON.parse(fs.readFileSync('./src/load_test_sc/metadata.json').toString('utf-8'));72 const abi = new Abi(metadata);7374 const deployer = await prepareDeployer(api, privateKeyWrapper);7576 const wasm = fs.readFileSync('./src/load_test_sc/loadtester.wasm');7778 const code = new CodePromise(api, abi, wasm);7980 const blueprint = await deployBlueprint(deployer, code);81 const contract = (await deployContract(deployer, blueprint))['contract'] as Contract;8283 return [contract, deployer];84}8586async function getScData(contract: Contract, deployer: IKeyringPair) {87 const result = await contract.query.get(deployer.address, value, gasLimit);8889 if(!result.result.isSuccess) {90 throw 'Failed to get value';91 }92 return result.result.asSuccess.data;93}949596describe('RPC Tests', () => {97 it('Simple RPC Load Test', async () => {98 await usingApi(async api => {99 let count = 0;100 let hrTime = process.hrtime();101 let microsec1 = hrTime[0] * 1000000 + hrTime[1] / 1000;102 let rate = 0;103 const checkPoint = 1000;104105 /* eslint no-constant-condition: "off" */106 while (true) {107 await api.rpc.system.chain();108 count++;109 process.stdout.write(`RPC reads: ${count} times at rate ${rate} r/s \r`);110111 if (count % checkPoint == 0) {112 hrTime = process.hrtime();113 const microsec2 = hrTime[0] * 1000000 + hrTime[1] / 1000;114 rate = 1000000*checkPoint/(microsec2 - microsec1);115 microsec1 = microsec2;116 }117 }118 });119 });120121 it('Smart Contract RPC Load Test', async () => {122 await usingApi(async (api, privateKeyWrapper) => {123124 // Deploy smart contract125 const [contract, deployer] = await deployLoadTester(api, privateKeyWrapper);126127 // Fill smart contract up with data128 const bob = privateKeyWrapper('//Bob');129 const tx = contract.tx.bloat(value, gasLimit, 200);130 await submitTransactionAsync(bob, tx);131132 // Run load test133 let count = 0;134 let hrTime = process.hrtime();135 let microsec1 = hrTime[0] * 1000000 + hrTime[1] / 1000;136 let rate = 0;137 const checkPoint = 10;138139 /* eslint no-constant-condition: "off" */140 while (true) {141 await getScData(contract, deployer);142 count++;143 process.stdout.write(`SC reads: ${count} times at rate ${rate} r/s \r`);144145 if (count % checkPoint == 0) {146 hrTime = process.hrtime();147 const microsec2 = hrTime[0] * 1000000 + hrTime[1] / 1000;148 rate = 1000000*checkPoint/(microsec2 - microsec1);149 microsec1 = microsec2;150 }151 }152 });153 });154155});tests/src/transfer_contract/metadata.jsondiffbeforeafterboth--- a/tests/src/transfer_contract/metadata.json
+++ /dev/null
@@ -1,469 +0,0 @@
-{
- "metadataVersion": "0.1.0",
- "source": {
- "hash": "0xc6c3f47adeafe86d1674ed72c7179605787842f2f05a2d7da0dbabf3c4fa1aa8",
- "language": "ink! 3.0.0-rc3",
- "compiler": "rustc 1.52.0-nightly"
- },
- "contract": {
- "name": "nft_transfer",
- "version": "0.1.0",
- "authors": [
- "[Greg Zaitsev] <[your_email]>"
- ]
- },
- "spec": {
- "constructors": [
- {
- "args": [],
- "docs": [
- "Default Constructor",
- "",
- "Constructors can delegate to other constructors."
- ],
- "name": [
- "default"
- ],
- "selector": "0xed4b9d1b"
- }
- ],
- "docs": [],
- "events": [],
- "messages": [
- {
- "args": [
- {
- "name": "recipient",
- "type": {
- "displayName": [
- "AccountId"
- ],
- "type": 1
- }
- },
- {
- "name": "collection_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "token_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "amount",
- "type": {
- "displayName": [
- "u128"
- ],
- "type": 5
- }
- }
- ],
- "docs": [
- " Transfer one NFT token"
- ],
- "mutates": true,
- "name": [
- "transfer"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0x84a15da1"
- },
- {
- "args": [
- {
- "name": "recipient",
- "type": {
- "displayName": [
- "AccountId"
- ],
- "type": 1
- }
- },
- {
- "name": "collection_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "data",
- "type": {
- "displayName": [
- "CreateItemData"
- ],
- "type": 6
- }
- }
- ],
- "docs": [],
- "mutates": true,
- "name": [
- "create_item"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0xd7c3f083"
- },
- {
- "args": [
- {
- "name": "owner",
- "type": {
- "displayName": [
- "AccountId"
- ],
- "type": 1
- }
- },
- {
- "name": "collection_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "data",
- "type": {
- "displayName": [
- "Vec"
- ],
- "type": 8
- }
- }
- ],
- "docs": [],
- "mutates": true,
- "name": [
- "create_multiple_items"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0x15f9a1eb"
- },
- {
- "args": [
- {
- "name": "spender",
- "type": {
- "displayName": [
- "AccountId"
- ],
- "type": 1
- }
- },
- {
- "name": "collection_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "item_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "amount",
- "type": {
- "displayName": [
- "u128"
- ],
- "type": 5
- }
- }
- ],
- "docs": [],
- "mutates": true,
- "name": [
- "approve"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0x681266a0"
- },
- {
- "args": [
- {
- "name": "owner",
- "type": {
- "displayName": [
- "AccountId"
- ],
- "type": 1
- }
- },
- {
- "name": "recipient",
- "type": {
- "displayName": [
- "AccountId"
- ],
- "type": 1
- }
- },
- {
- "name": "collection_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "item_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "amount",
- "type": {
- "displayName": [
- "u128"
- ],
- "type": 5
- }
- }
- ],
- "docs": [],
- "mutates": true,
- "name": [
- "transfer_from"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0x0b396f18"
- },
- {
- "args": [
- {
- "name": "collection_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "item_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "data",
- "type": {
- "displayName": [
- "Vec"
- ],
- "type": 7
- }
- }
- ],
- "docs": [],
- "mutates": true,
- "name": [
- "set_variable_meta_data"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0xb0b26da2"
- },
- {
- "args": [
- {
- "name": "collection_id",
- "type": {
- "displayName": [
- "u32"
- ],
- "type": 4
- }
- },
- {
- "name": "address",
- "type": {
- "displayName": [
- "AccountId"
- ],
- "type": 1
- }
- },
- {
- "name": "allowlisted",
- "type": {
- "displayName": [
- "bool"
- ],
- "type": 9
- }
- }
- ],
- "docs": [],
- "mutates": true,
- "name": [
- "toggle_allow_list"
- ],
- "payable": false,
- "returnType": null,
- "selector": "0x98574dac"
- }
- ]
- },
- "storage": {
- "struct": {
- "fields": []
- }
- },
- "types": [
- {
- "def": {
- "composite": {
- "fields": [
- {
- "type": 2,
- "typeName": "[u8; 32]"
- }
- ]
- }
- },
- "path": [
- "ink_env",
- "types",
- "AccountId"
- ]
- },
- {
- "def": {
- "array": {
- "len": 32,
- "type": 3
- }
- }
- },
- {
- "def": {
- "primitive": "u8"
- }
- },
- {
- "def": {
- "primitive": "u32"
- }
- },
- {
- "def": {
- "primitive": "u128"
- }
- },
- {
- "def": {
- "variant": {
- "variants": [
- {
- "fields": [
- {
- "name": "const_data",
- "type": 7,
- "typeName": "Vec<u8>"
- },
- {
- "name": "variable_data",
- "type": 7,
- "typeName": "Vec<u8>"
- }
- ],
- "name": "Nft"
- },
- {
- "fields": [
- {
- "name": "value",
- "type": 5,
- "typeName": "u128"
- }
- ],
- "name": "Fungible"
- },
- {
- "fields": [
- {
- "name": "const_data",
- "type": 7,
- "typeName": "Vec<u8>"
- },
- {
- "name": "variable_data",
- "type": 7,
- "typeName": "Vec<u8>"
- },
- {
- "name": "pieces",
- "type": 5,
- "typeName": "u128"
- }
- ],
- "name": "ReFungible"
- }
- ]
- }
- },
- "path": [
- "nft_transfer",
- "CreateItemData"
- ]
- },
- {
- "def": {
- "sequence": {
- "type": 3
- }
- }
- },
- {
- "def": {
- "sequence": {
- "type": 6
- }
- }
- },
- {
- "def": {
- "primitive": "bool"
- }
- }
- ]
-}
\ No newline at end of file
tests/src/transfer_contract/nft_transfer.wasmdiffbeforeafterbothbinary blob — no preview