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.tsdiffbeforeafterboth--- a/tests/src/rpc.load.ts
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-import usingApi, {submitTransactionAsync} from './substrate/substrate-api';
-import {IKeyringPair} from '@polkadot/types/types';
-import {Abi, BlueprintPromise as Blueprint, CodePromise, ContractPromise as Contract} from '@polkadot/api-contract';
-import {ApiPromise, Keyring} from '@polkadot/api';
-import {findUnusedAddress} from './util/helpers';
-import fs from 'fs';
-
-const value = 0;
-const gasLimit = 500000n * 1000000n;
-const endowment = '1000000000000000';
-
-/*eslint no-async-promise-executor: "off"*/
-function deployBlueprint(alice: IKeyringPair, code: CodePromise): Promise<Blueprint> {
- return new Promise<Blueprint>(async (resolve) => {
- const unsub = await code
- .createBlueprint()
- .signAndSend(alice, (result) => {
- if (result.status.isInBlock || result.status.isFinalized) {
- // here we have an additional field in the result, containing the blueprint
- resolve(result.blueprint);
- unsub();
- }
- });
- });
-}
-
-/*eslint no-async-promise-executor: "off"*/
-function deployContract(alice: IKeyringPair, blueprint: Blueprint) : Promise<any> {
- return new Promise<any>(async (resolve) => {
- const unsub = await blueprint.tx
- .new(endowment, gasLimit)
- .signAndSend(alice, (result) => {
- if (result.status.isInBlock || result.status.isFinalized) {
- unsub();
- resolve(result);
- }
- });
- });
-}
-
-async function prepareDeployer(api: ApiPromise, privateKeyWrapper: ((account: string) => IKeyringPair)) {
- // Find unused address
- const deployer = await findUnusedAddress(api, privateKeyWrapper);
-
- // Transfer balance to it
- const alice = privateKeyWrapper('//Alice');
- const amount = BigInt(endowment) + 10n**15n;
- const tx = api.tx.balances.transfer(deployer.address, amount);
- await submitTransactionAsync(alice, tx);
-
- return deployer;
-}
-
-async function deployLoadTester(api: ApiPromise, privateKeyWrapper: ((account: string) => IKeyringPair)): Promise<[Contract, IKeyringPair]> {
- const metadata = JSON.parse(fs.readFileSync('./src/load_test_sc/metadata.json').toString('utf-8'));
- const abi = new Abi(metadata);
-
- const deployer = await prepareDeployer(api, privateKeyWrapper);
-
- const wasm = fs.readFileSync('./src/load_test_sc/loadtester.wasm');
-
- const code = new CodePromise(api, abi, wasm);
-
- const blueprint = await deployBlueprint(deployer, code);
- const contract = (await deployContract(deployer, blueprint))['contract'] as Contract;
-
- return [contract, deployer];
-}
-
-async function getScData(contract: Contract, deployer: IKeyringPair) {
- const result = await contract.query.get(deployer.address, value, gasLimit);
-
- if(!result.result.isSuccess) {
- throw 'Failed to get value';
- }
- return result.result.asSuccess.data;
-}
-
-
-describe('RPC Tests', () => {
- it('Simple RPC Load Test', async () => {
- await usingApi(async api => {
- let count = 0;
- let hrTime = process.hrtime();
- let microsec1 = hrTime[0] * 1000000 + hrTime[1] / 1000;
- let rate = 0;
- const checkPoint = 1000;
-
- /* eslint no-constant-condition: "off" */
- while (true) {
- await api.rpc.system.chain();
- count++;
- process.stdout.write(`RPC reads: ${count} times at rate ${rate} r/s \r`);
-
- if (count % checkPoint == 0) {
- hrTime = process.hrtime();
- const microsec2 = hrTime[0] * 1000000 + hrTime[1] / 1000;
- rate = 1000000*checkPoint/(microsec2 - microsec1);
- microsec1 = microsec2;
- }
- }
- });
- });
-
- it('Smart Contract RPC Load Test', async () => {
- await usingApi(async (api, privateKeyWrapper) => {
-
- // Deploy smart contract
- const [contract, deployer] = await deployLoadTester(api, privateKeyWrapper);
-
- // Fill smart contract up with data
- const bob = privateKeyWrapper('//Bob');
- const tx = contract.tx.bloat(value, gasLimit, 200);
- await submitTransactionAsync(bob, tx);
-
- // Run load test
- let count = 0;
- let hrTime = process.hrtime();
- let microsec1 = hrTime[0] * 1000000 + hrTime[1] / 1000;
- let rate = 0;
- const checkPoint = 10;
-
- /* eslint no-constant-condition: "off" */
- while (true) {
- await getScData(contract, deployer);
- count++;
- process.stdout.write(`SC reads: ${count} times at rate ${rate} r/s \r`);
-
- if (count % checkPoint == 0) {
- hrTime = process.hrtime();
- const microsec2 = hrTime[0] * 1000000 + hrTime[1] / 1000;
- rate = 1000000*checkPoint/(microsec2 - microsec1);
- microsec1 = microsec2;
- }
- }
- });
- });
-
-});
tests/src/transfer_contract/metadata.jsondiffbeforeafterboth1{2 "metadataVersion": "0.1.0",3 "source": {4 "hash": "0xc6c3f47adeafe86d1674ed72c7179605787842f2f05a2d7da0dbabf3c4fa1aa8",5 "language": "ink! 3.0.0-rc3",6 "compiler": "rustc 1.52.0-nightly"7 },8 "contract": {9 "name": "nft_transfer",10 "version": "0.1.0",11 "authors": [12 "[Greg Zaitsev] <[your_email]>"13 ]14 },15 "spec": {16 "constructors": [17 {18 "args": [],19 "docs": [20 "Default Constructor",21 "",22 "Constructors can delegate to other constructors."23 ],24 "name": [25 "default"26 ],27 "selector": "0xed4b9d1b"28 }29 ],30 "docs": [],31 "events": [],32 "messages": [33 {34 "args": [35 {36 "name": "recipient",37 "type": {38 "displayName": [39 "AccountId"40 ],41 "type": 142 }43 },44 {45 "name": "collection_id",46 "type": {47 "displayName": [48 "u32"49 ],50 "type": 451 }52 },53 {54 "name": "token_id",55 "type": {56 "displayName": [57 "u32"58 ],59 "type": 460 }61 },62 {63 "name": "amount",64 "type": {65 "displayName": [66 "u128"67 ],68 "type": 569 }70 }71 ],72 "docs": [73 " Transfer one NFT token"74 ],75 "mutates": true,76 "name": [77 "transfer"78 ],79 "payable": false,80 "returnType": null,81 "selector": "0x84a15da1"82 },83 {84 "args": [85 {86 "name": "recipient",87 "type": {88 "displayName": [89 "AccountId"90 ],91 "type": 192 }93 },94 {95 "name": "collection_id",96 "type": {97 "displayName": [98 "u32"99 ],100 "type": 4101 }102 },103 {104 "name": "data",105 "type": {106 "displayName": [107 "CreateItemData"108 ],109 "type": 6110 }111 }112 ],113 "docs": [],114 "mutates": true,115 "name": [116 "create_item"117 ],118 "payable": false,119 "returnType": null,120 "selector": "0xd7c3f083"121 },122 {123 "args": [124 {125 "name": "owner",126 "type": {127 "displayName": [128 "AccountId"129 ],130 "type": 1131 }132 },133 {134 "name": "collection_id",135 "type": {136 "displayName": [137 "u32"138 ],139 "type": 4140 }141 },142 {143 "name": "data",144 "type": {145 "displayName": [146 "Vec"147 ],148 "type": 8149 }150 }151 ],152 "docs": [],153 "mutates": true,154 "name": [155 "create_multiple_items"156 ],157 "payable": false,158 "returnType": null,159 "selector": "0x15f9a1eb"160 },161 {162 "args": [163 {164 "name": "spender",165 "type": {166 "displayName": [167 "AccountId"168 ],169 "type": 1170 }171 },172 {173 "name": "collection_id",174 "type": {175 "displayName": [176 "u32"177 ],178 "type": 4179 }180 },181 {182 "name": "item_id",183 "type": {184 "displayName": [185 "u32"186 ],187 "type": 4188 }189 },190 {191 "name": "amount",192 "type": {193 "displayName": [194 "u128"195 ],196 "type": 5197 }198 }199 ],200 "docs": [],201 "mutates": true,202 "name": [203 "approve"204 ],205 "payable": false,206 "returnType": null,207 "selector": "0x681266a0"208 },209 {210 "args": [211 {212 "name": "owner",213 "type": {214 "displayName": [215 "AccountId"216 ],217 "type": 1218 }219 },220 {221 "name": "recipient",222 "type": {223 "displayName": [224 "AccountId"225 ],226 "type": 1227 }228 },229 {230 "name": "collection_id",231 "type": {232 "displayName": [233 "u32"234 ],235 "type": 4236 }237 },238 {239 "name": "item_id",240 "type": {241 "displayName": [242 "u32"243 ],244 "type": 4245 }246 },247 {248 "name": "amount",249 "type": {250 "displayName": [251 "u128"252 ],253 "type": 5254 }255 }256 ],257 "docs": [],258 "mutates": true,259 "name": [260 "transfer_from"261 ],262 "payable": false,263 "returnType": null,264 "selector": "0x0b396f18"265 },266 {267 "args": [268 {269 "name": "collection_id",270 "type": {271 "displayName": [272 "u32"273 ],274 "type": 4275 }276 },277 {278 "name": "item_id",279 "type": {280 "displayName": [281 "u32"282 ],283 "type": 4284 }285 },286 {287 "name": "data",288 "type": {289 "displayName": [290 "Vec"291 ],292 "type": 7293 }294 }295 ],296 "docs": [],297 "mutates": true,298 "name": [299 "set_variable_meta_data"300 ],301 "payable": false,302 "returnType": null,303 "selector": "0xb0b26da2"304 },305 {306 "args": [307 {308 "name": "collection_id",309 "type": {310 "displayName": [311 "u32"312 ],313 "type": 4314 }315 },316 {317 "name": "address",318 "type": {319 "displayName": [320 "AccountId"321 ],322 "type": 1323 }324 },325 {326 "name": "allowlisted",327 "type": {328 "displayName": [329 "bool"330 ],331 "type": 9332 }333 }334 ],335 "docs": [],336 "mutates": true,337 "name": [338 "toggle_allow_list"339 ],340 "payable": false,341 "returnType": null,342 "selector": "0x98574dac"343 }344 ]345 },346 "storage": {347 "struct": {348 "fields": []349 }350 },351 "types": [352 {353 "def": {354 "composite": {355 "fields": [356 {357 "type": 2,358 "typeName": "[u8; 32]"359 }360 ]361 }362 },363 "path": [364 "ink_env",365 "types",366 "AccountId"367 ]368 },369 {370 "def": {371 "array": {372 "len": 32,373 "type": 3374 }375 }376 },377 {378 "def": {379 "primitive": "u8"380 }381 },382 {383 "def": {384 "primitive": "u32"385 }386 },387 {388 "def": {389 "primitive": "u128"390 }391 },392 {393 "def": {394 "variant": {395 "variants": [396 {397 "fields": [398 {399 "name": "const_data",400 "type": 7,401 "typeName": "Vec<u8>"402 },403 {404 "name": "variable_data",405 "type": 7,406 "typeName": "Vec<u8>"407 }408 ],409 "name": "Nft"410 },411 {412 "fields": [413 {414 "name": "value",415 "type": 5,416 "typeName": "u128"417 }418 ],419 "name": "Fungible"420 },421 {422 "fields": [423 {424 "name": "const_data",425 "type": 7,426 "typeName": "Vec<u8>"427 },428 {429 "name": "variable_data",430 "type": 7,431 "typeName": "Vec<u8>"432 },433 {434 "name": "pieces",435 "type": 5,436 "typeName": "u128"437 }438 ],439 "name": "ReFungible"440 }441 ]442 }443 },444 "path": [445 "nft_transfer",446 "CreateItemData"447 ]448 },449 {450 "def": {451 "sequence": {452 "type": 3453 }454 }455 },456 {457 "def": {458 "sequence": {459 "type": 6460 }461 }462 },463 {464 "def": {465 "primitive": "bool"466 }467 }468 ]469}tests/src/transfer_contract/nft_transfer.wasmdiffbeforeafterbothbinary blob — no preview