Update ABI files.

This commit is contained in:
Spencer Ofwiti 2021-05-13 12:17:59 +03:00
parent 94cf97b858
commit 2699dc5bcc
4 changed files with 41 additions and 48 deletions

View File

@ -1,7 +1,7 @@
import { environment } from '@src/environments/environment';
import Web3 from 'web3';
const abi: Array<any> = require('@src/assets/js/block-sync/data/AccountRegistry.json');
const abi: Array<any> = 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<number> {
return await this.contract.methods.count().call();
return await this.contract.methods.entryCount().call();
}
public async haveAccount(address: string): Promise<boolean> {
return (await this.contract.methods.accountIndex(address).call()) !== 0;
return (await this.contract.methods.have(address).call()) !== 0;
}
public async last(numberOfAccounts: number): Promise<Array<string>> {
@ -35,7 +35,7 @@ export class AccountIndex {
}
const accounts: Array<string> = [];
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;

View File

@ -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"
},
{

View File

@ -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",

View File

@ -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"
},