mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[@types/web3] ⬆️ Solidity compilers defines stateMutability for ABIDefinition
This commit is contained in:
parent
c34029e6e0
commit
a359aa88dd
1
types/web3/eth/abi.d.ts
vendored
1
types/web3/eth/abi.d.ts
vendored
@ -1,6 +1,7 @@
|
||||
export interface ABIDefinition {
|
||||
constant?: boolean;
|
||||
payable?: boolean;
|
||||
stateMutability?: "pure" | "view" | "nonpayable" | "payable";
|
||||
anonymous?: boolean;
|
||||
inputs?: Array<{ name: string; type: ABIDataTypes; indexed?: boolean }>;
|
||||
name?: string;
|
||||
|
||||
89
types/web3/test/abi-tests.ts
Normal file
89
types/web3/test/abi-tests.ts
Normal file
@ -0,0 +1,89 @@
|
||||
import { ABIDefinition } from "web3/eth/abi.d";
|
||||
|
||||
export const OLD_ABI_STANDARD: ABIDefinition[] = [
|
||||
{
|
||||
constant: true,
|
||||
payable: false,
|
||||
inputs: [
|
||||
{
|
||||
name: "paramAddress",
|
||||
type: "address"
|
||||
}
|
||||
],
|
||||
name: "function1",
|
||||
outputs: [],
|
||||
type: "function"
|
||||
}, {
|
||||
constant: true,
|
||||
payable: false,
|
||||
inputs: [],
|
||||
name: "removeOwner",
|
||||
outputs: [
|
||||
{
|
||||
name: "paramAddress",
|
||||
type: "address"
|
||||
}
|
||||
],
|
||||
type: "function"
|
||||
}, {
|
||||
constant: false,
|
||||
payable: false,
|
||||
inputs: [],
|
||||
name: "removeOwner",
|
||||
outputs: [],
|
||||
type: "function"
|
||||
}, {
|
||||
constant: false,
|
||||
payable: true,
|
||||
inputs: [],
|
||||
name: "removeOwner",
|
||||
outputs: [],
|
||||
type: "function"
|
||||
},
|
||||
];
|
||||
|
||||
export const NEW_ABI_STANDARD: ABIDefinition[] = [
|
||||
{
|
||||
constant: true,
|
||||
payable: false,
|
||||
stateMutability: "view",
|
||||
inputs: [
|
||||
{
|
||||
name: "paramAddress",
|
||||
type: "address"
|
||||
}
|
||||
],
|
||||
name: "function1",
|
||||
outputs: [],
|
||||
type: "function"
|
||||
}, {
|
||||
constant: true,
|
||||
payable: false,
|
||||
stateMutability: "pure",
|
||||
inputs: [],
|
||||
name: "removeOwner",
|
||||
outputs: [
|
||||
{
|
||||
name: "paramAddress",
|
||||
type: "address"
|
||||
}
|
||||
],
|
||||
type: "function"
|
||||
}, {
|
||||
constant: false,
|
||||
payable: false,
|
||||
stateMutability: "nonpayable",
|
||||
inputs: [],
|
||||
name: "removeOwner",
|
||||
outputs: [],
|
||||
type: "function"
|
||||
}, {
|
||||
constant: false,
|
||||
payable: true,
|
||||
stateMutability: "payable",
|
||||
inputs: [],
|
||||
name: "removeOwner",
|
||||
outputs: [],
|
||||
type: "function"
|
||||
},
|
||||
];
|
||||
@ -23,6 +23,7 @@
|
||||
"eth/accounts.d.ts",
|
||||
"eth/contract.d.ts",
|
||||
"eth/index.d.ts",
|
||||
"eth/types.d.ts"
|
||||
"eth/types.d.ts",
|
||||
"test/abi-tests.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ import Web3 = require("web3");
|
||||
import BigNumber = require("bn.js");
|
||||
import { TransactionReceipt } from "web3/types";
|
||||
import PromiEvent from "web3/promiEvent";
|
||||
import { NEW_ABI_STANDARD, OLD_ABI_STANDARD } from "web3/test/abi-tests";
|
||||
|
||||
const contractAddress = "0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe";
|
||||
|
||||
@ -125,6 +126,8 @@ web3.eth.personal.unlockAccount(
|
||||
//
|
||||
// web3.eth.abi
|
||||
// --------------------------------------------------------------------------
|
||||
const myContractOldAbi = new web3.eth.Contract(OLD_ABI_STANDARD);
|
||||
const myContractNewAbi = new web3.eth.Contract(NEW_ABI_STANDARD);
|
||||
|
||||
//
|
||||
// web3.bzz
|
||||
|
||||
Loading…
Reference in New Issue
Block a user