From 2699dc5bccfe6de2c91f3797990fdb91ed15a5d8 Mon Sep 17 00:00:00 2001 From: Spencer Ofwiti Date: Thu, 13 May 2021 12:17:59 +0300 Subject: [PATCH] Update ABI files. --- src/app/_eth/accountIndex.ts | 8 ++--- ...ccountRegistry.json => AccountsIndex.json} | 35 ++++--------------- ...AddressDeclarator.json => Declarator.json} | 26 +++++++++----- src/assets/js/block-sync/data/ERC20.json | 20 ++++++----- 4 files changed, 41 insertions(+), 48 deletions(-) rename src/assets/js/block-sync/data/{AccountRegistry.json => AccountsIndex.json} (55%) rename src/assets/js/block-sync/data/{AddressDeclarator.json => Declarator.json} (56%) diff --git a/src/app/_eth/accountIndex.ts b/src/app/_eth/accountIndex.ts index 85dd55b..7654255 100644 --- a/src/app/_eth/accountIndex.ts +++ b/src/app/_eth/accountIndex.ts @@ -1,7 +1,7 @@ import { environment } from '@src/environments/environment'; import Web3 from 'web3'; -const abi: Array = require('@src/assets/js/block-sync/data/AccountRegistry.json'); +const abi: Array = require('@src/assets/js/block-sync/data/AccountsIndex.json'); const web3: Web3 = new Web3(environment.web3Provider); export class AccountIndex { @@ -20,11 +20,11 @@ export class AccountIndex { } public async totalAccounts(): Promise { - return await this.contract.methods.count().call(); + return await this.contract.methods.entryCount().call(); } public async haveAccount(address: string): Promise { - return (await this.contract.methods.accountIndex(address).call()) !== 0; + return (await this.contract.methods.have(address).call()) !== 0; } public async last(numberOfAccounts: number): Promise> { @@ -35,7 +35,7 @@ export class AccountIndex { } const accounts: Array = []; for (let i = count - 1; i > lowest; i--) { - const account: string = await this.contract.methods.accounts(i).call(); + const account: string = await this.contract.methods.entry(i).call(); accounts.push(account); } return accounts; diff --git a/src/assets/js/block-sync/data/AccountRegistry.json b/src/assets/js/block-sync/data/AccountsIndex.json similarity index 55% rename from src/assets/js/block-sync/data/AccountRegistry.json rename to src/assets/js/block-sync/data/AccountsIndex.json index 13bbcb4..8ae6303 100644 --- a/src/assets/js/block-sync/data/AccountRegistry.json +++ b/src/assets/js/block-sync/data/AccountsIndex.json @@ -8,20 +8,6 @@ "name": "AccountAdded", "type": "event" }, - { - "inputs": [{ "internalType": "uint256", "name": "_idx", "type": "uint256" }], - "name": "accounts", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_account", "type": "address" }], - "name": "accountsIndex", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, { "inputs": [{ "internalType": "address", "name": "_account", "type": "address" }], "name": "add", @@ -30,24 +16,17 @@ "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "_writer", "type": "address" }], - "name": "addWriter", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "count", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "entry", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "_writer", "type": "address" }], - "name": "deleteWriter", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", + "inputs": [], + "name": "entryCount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", "type": "function" }, { diff --git a/src/assets/js/block-sync/data/AddressDeclarator.json b/src/assets/js/block-sync/data/Declarator.json similarity index 56% rename from src/assets/js/block-sync/data/AddressDeclarator.json rename to src/assets/js/block-sync/data/Declarator.json index 9759c56..7d2d536 100644 --- a/src/assets/js/block-sync/data/AddressDeclarator.json +++ b/src/assets/js/block-sync/data/Declarator.json @@ -1,18 +1,28 @@ [ { + "anonymous": false, "inputs": [ - { "internalType": "address", "name": "_address", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "_declarator", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "_subject", "type": "address" }, + { "indexed": false, "internalType": "bytes32", "name": "_proof", "type": "bytes32" } + ], + "name": "DeclarationAdded", + "type": "event" + }, + { + "inputs": [ + { "internalType": "address", "name": "_subject", "type": "address" }, { "internalType": "bytes32", "name": "_proof", "type": "bytes32" } ], "name": "addDeclaration", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_subjectAddress", "type": "address" }, - { "internalType": "address", "name": "_objectAddress", "type": "address" } + { "internalType": "address", "name": "_declarator", "type": "address" }, + { "internalType": "address", "name": "_subject", "type": "address" } ], "name": "declaration", "outputs": [{ "internalType": "bytes32[]", "name": "", "type": "bytes32[]" }], @@ -21,7 +31,7 @@ }, { "inputs": [ - { "internalType": "address", "name": "_subjectAddress", "type": "address" }, + { "internalType": "address", "name": "_declarator", "type": "address" }, { "internalType": "uint256", "name": "_idx", "type": "uint256" } ], "name": "declarationAddressAt", @@ -30,7 +40,7 @@ "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "_subjectAddress", "type": "address" }], + "inputs": [{ "internalType": "address", "name": "_declarator", "type": "address" }], "name": "declarationCount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", @@ -38,7 +48,7 @@ }, { "inputs": [ - { "internalType": "address", "name": "_targetAddress", "type": "address" }, + { "internalType": "address", "name": "_subject", "type": "address" }, { "internalType": "uint256", "name": "_idx", "type": "uint256" } ], "name": "declaratorAddressAt", @@ -47,7 +57,7 @@ "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "_objectAddress", "type": "address" }], + "inputs": [{ "internalType": "address", "name": "_subject", "type": "address" }], "name": "declaratorCount", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", diff --git a/src/assets/js/block-sync/data/ERC20.json b/src/assets/js/block-sync/data/ERC20.json index e2affcb..a4cf3d0 100644 --- a/src/assets/js/block-sync/data/ERC20.json +++ b/src/assets/js/block-sync/data/ERC20.json @@ -19,6 +19,17 @@ "name": "Transfer", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "_from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "_to", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "_spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "_value", "type": "uint256" } + ], + "name": "TransferFrom", + "type": "event" + }, { "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, @@ -39,17 +50,10 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" },