updated interface typings

pull/40/head
Tim Pechersky 2022-02-21 19:23:04 +00:00
rodzic 1c8d65daca
commit c13b807535
11 zmienionych plików z 872 dodań i 16 usunięć

Wyświetl plik

@ -93,6 +93,11 @@ export interface ERC1155WithTerminusStorage extends BaseContract {
operator: string
): NonPayableTransactionObject<boolean>;
poolOfOwnerByIndex(
owner: string,
index: number | string | BN
): NonPayableTransactionObject<string>;
safeBatchTransferFrom(
from: string,
to: string,
@ -118,6 +123,10 @@ export interface ERC1155WithTerminusStorage extends BaseContract {
interfaceId: string | number[]
): NonPayableTransactionObject<boolean>;
totalPools(): NonPayableTransactionObject<string>;
totalPoolsByOwner(owner: string): NonPayableTransactionObject<string>;
uri(poolID: number | string | BN): NonPayableTransactionObject<string>;
};
events: {

Wyświetl plik

@ -0,0 +1,173 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import BN from "bn.js";
import { ContractOptions } from "web3-eth-contract";
import { EventLog } from "web3-core";
import { EventEmitter } from "events";
import {
Callback,
PayableTransactionObject,
NonPayableTransactionObject,
BlockType,
ContractEventLog,
BaseContract,
} from "./types";
export interface EventOptions {
filter?: object;
fromBlock?: BlockType;
topics?: string[];
}
export type ApprovalForAll = ContractEventLog<{
account: string;
operator: string;
approved: boolean;
0: string;
1: string;
2: boolean;
}>;
export type TransferBatch = ContractEventLog<{
operator: string;
from: string;
to: string;
ids: string[];
values: string[];
0: string;
1: string;
2: string;
3: string[];
4: string[];
}>;
export type TransferSingle = ContractEventLog<{
operator: string;
from: string;
to: string;
id: string;
value: string;
0: string;
1: string;
2: string;
3: string;
4: string;
}>;
export type URI = ContractEventLog<{
value: string;
id: string;
0: string;
1: string;
}>;
export interface ERC1155WithTerminusStorageFixture extends BaseContract {
constructor(
jsonInterface: any[],
address?: string,
options?: ContractOptions
): ERC1155WithTerminusStorageFixture;
clone(): ERC1155WithTerminusStorageFixture;
methods: {
approveForPool(
poolID: number | string | BN,
operator: string
): NonPayableTransactionObject<void>;
balanceOf(
account: string,
id: number | string | BN
): NonPayableTransactionObject<string>;
balanceOfBatch(
accounts: string[],
ids: (number | string | BN)[]
): NonPayableTransactionObject<string[]>;
isApprovedForAll(
account: string,
operator: string
): NonPayableTransactionObject<boolean>;
isApprovedForPool(
poolID: number | string | BN,
operator: string
): NonPayableTransactionObject<boolean>;
isFixture(): NonPayableTransactionObject<boolean>;
safeBatchTransferFrom(
from: string,
to: string,
ids: (number | string | BN)[],
amounts: (number | string | BN)[],
data: string | number[]
): NonPayableTransactionObject<void>;
safeTransferFrom(
from: string,
to: string,
id: number | string | BN,
amount: number | string | BN,
data: string | number[]
): NonPayableTransactionObject<void>;
setApprovalForAll(
operator: string,
approved: boolean
): NonPayableTransactionObject<void>;
supportsInterface(
interfaceId: string | number[]
): NonPayableTransactionObject<boolean>;
uri(poolID: number | string | BN): NonPayableTransactionObject<string>;
};
events: {
ApprovalForAll(cb?: Callback<ApprovalForAll>): EventEmitter;
ApprovalForAll(
options?: EventOptions,
cb?: Callback<ApprovalForAll>
): EventEmitter;
TransferBatch(cb?: Callback<TransferBatch>): EventEmitter;
TransferBatch(
options?: EventOptions,
cb?: Callback<TransferBatch>
): EventEmitter;
TransferSingle(cb?: Callback<TransferSingle>): EventEmitter;
TransferSingle(
options?: EventOptions,
cb?: Callback<TransferSingle>
): EventEmitter;
URI(cb?: Callback<URI>): EventEmitter;
URI(options?: EventOptions, cb?: Callback<URI>): EventEmitter;
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
};
once(event: "ApprovalForAll", cb: Callback<ApprovalForAll>): void;
once(
event: "ApprovalForAll",
options: EventOptions,
cb: Callback<ApprovalForAll>
): void;
once(event: "TransferBatch", cb: Callback<TransferBatch>): void;
once(
event: "TransferBatch",
options: EventOptions,
cb: Callback<TransferBatch>
): void;
once(event: "TransferSingle", cb: Callback<TransferSingle>): void;
once(
event: "TransferSingle",
options: EventOptions,
cb: Callback<TransferSingle>
): void;
once(event: "URI", cb: Callback<URI>): void;
once(event: "URI", options: EventOptions, cb: Callback<URI>): void;
}

Wyświetl plik

@ -0,0 +1,168 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import BN from "bn.js";
import { ContractOptions } from "web3-eth-contract";
import { EventLog } from "web3-core";
import { EventEmitter } from "events";
import {
Callback,
PayableTransactionObject,
NonPayableTransactionObject,
BlockType,
ContractEventLog,
BaseContract,
} from "./types";
export interface EventOptions {
filter?: object;
fromBlock?: BlockType;
topics?: string[];
}
export type ApprovalForAll = ContractEventLog<{
account: string;
operator: string;
approved: boolean;
0: string;
1: string;
2: boolean;
}>;
export type TransferBatch = ContractEventLog<{
operator: string;
from: string;
to: string;
ids: string[];
values: string[];
0: string;
1: string;
2: string;
3: string[];
4: string[];
}>;
export type TransferSingle = ContractEventLog<{
operator: string;
from: string;
to: string;
id: string;
value: string;
0: string;
1: string;
2: string;
3: string;
4: string;
}>;
export type URI = ContractEventLog<{
value: string;
id: string;
0: string;
1: string;
}>;
export interface IERC1155Enumerable extends BaseContract {
constructor(
jsonInterface: any[],
address?: string,
options?: ContractOptions
): IERC1155Enumerable;
clone(): IERC1155Enumerable;
methods: {
balanceOf(
account: string,
id: number | string | BN
): NonPayableTransactionObject<string>;
balanceOfBatch(
accounts: string[],
ids: (number | string | BN)[]
): NonPayableTransactionObject<string[]>;
isApprovedForAll(
account: string,
operator: string
): NonPayableTransactionObject<boolean>;
poolOfOwnerByIndex(
owner: string,
index: number | string | BN
): NonPayableTransactionObject<string>;
safeBatchTransferFrom(
from: string,
to: string,
ids: (number | string | BN)[],
amounts: (number | string | BN)[],
data: string | number[]
): NonPayableTransactionObject<void>;
safeTransferFrom(
from: string,
to: string,
id: number | string | BN,
amount: number | string | BN,
data: string | number[]
): NonPayableTransactionObject<void>;
setApprovalForAll(
operator: string,
approved: boolean
): NonPayableTransactionObject<void>;
supportsInterface(
interfaceId: string | number[]
): NonPayableTransactionObject<boolean>;
totalPools(): NonPayableTransactionObject<string>;
totalPoolsByOwner(owner: string): NonPayableTransactionObject<string>;
};
events: {
ApprovalForAll(cb?: Callback<ApprovalForAll>): EventEmitter;
ApprovalForAll(
options?: EventOptions,
cb?: Callback<ApprovalForAll>
): EventEmitter;
TransferBatch(cb?: Callback<TransferBatch>): EventEmitter;
TransferBatch(
options?: EventOptions,
cb?: Callback<TransferBatch>
): EventEmitter;
TransferSingle(cb?: Callback<TransferSingle>): EventEmitter;
TransferSingle(
options?: EventOptions,
cb?: Callback<TransferSingle>
): EventEmitter;
URI(cb?: Callback<URI>): EventEmitter;
URI(options?: EventOptions, cb?: Callback<URI>): EventEmitter;
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
};
once(event: "ApprovalForAll", cb: Callback<ApprovalForAll>): void;
once(
event: "ApprovalForAll",
options: EventOptions,
cb: Callback<ApprovalForAll>
): void;
once(event: "TransferBatch", cb: Callback<TransferBatch>): void;
once(
event: "TransferBatch",
options: EventOptions,
cb: Callback<TransferBatch>
): void;
once(event: "TransferSingle", cb: Callback<TransferSingle>): void;
once(
event: "TransferSingle",
options: EventOptions,
cb: Callback<TransferSingle>
): void;
once(event: "URI", cb: Callback<URI>): void;
once(event: "URI", options: EventOptions, cb: Callback<URI>): void;
}

Wyświetl plik

@ -0,0 +1,79 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import BN from "bn.js";
import { ContractOptions } from "web3-eth-contract";
import { EventLog } from "web3-core";
import { EventEmitter } from "events";
import {
Callback,
PayableTransactionObject,
NonPayableTransactionObject,
BlockType,
ContractEventLog,
BaseContract,
} from "./types";
export interface EventOptions {
filter?: object;
fromBlock?: BlockType;
topics?: string[];
}
export type ControlTransferred = ContractEventLog<{
previousController: string;
newController: string;
0: string;
1: string;
}>;
export type PoolControlTransferred = ContractEventLog<{
poolID: string;
previousController: string;
newController: string;
0: string;
1: string;
2: string;
}>;
export interface LibTerminusFixture extends BaseContract {
constructor(
jsonInterface: any[],
address?: string,
options?: ContractOptions
): LibTerminusFixture;
clone(): LibTerminusFixture;
methods: {};
events: {
ControlTransferred(cb?: Callback<ControlTransferred>): EventEmitter;
ControlTransferred(
options?: EventOptions,
cb?: Callback<ControlTransferred>
): EventEmitter;
PoolControlTransferred(cb?: Callback<PoolControlTransferred>): EventEmitter;
PoolControlTransferred(
options?: EventOptions,
cb?: Callback<PoolControlTransferred>
): EventEmitter;
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
};
once(event: "ControlTransferred", cb: Callback<ControlTransferred>): void;
once(
event: "ControlTransferred",
options: EventOptions,
cb: Callback<ControlTransferred>
): void;
once(
event: "PoolControlTransferred",
cb: Callback<PoolControlTransferred>
): void;
once(
event: "PoolControlTransferred",
options: EventOptions,
cb: Callback<PoolControlTransferred>
): void;
}

Wyświetl plik

@ -0,0 +1,37 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import BN from "bn.js";
import { ContractOptions } from "web3-eth-contract";
import { EventLog } from "web3-core";
import { EventEmitter } from "events";
import {
Callback,
PayableTransactionObject,
NonPayableTransactionObject,
BlockType,
ContractEventLog,
BaseContract,
} from "./types";
export interface EventOptions {
filter?: object;
fromBlock?: BlockType;
topics?: string[];
}
export interface PoolControllerEnumeration extends BaseContract {
constructor(
jsonInterface: any[],
address?: string,
options?: ContractOptions
): PoolControllerEnumeration;
clone(): PoolControllerEnumeration;
methods: {
init(): NonPayableTransactionObject<void>;
};
events: {
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
};
}

Wyświetl plik

@ -147,6 +147,11 @@ export interface TerminusFacet extends BaseContract {
amounts: (number | string | BN)[]
): NonPayableTransactionObject<void>;
poolOfOwnerByIndex(
owner: string,
index: number | string | BN
): NonPayableTransactionObject<string>;
safeBatchTransferFrom(
from: string,
to: string,
@ -208,6 +213,8 @@ export interface TerminusFacet extends BaseContract {
totalPools(): NonPayableTransactionObject<string>;
totalPoolsByOwner(owner: string): NonPayableTransactionObject<string>;
uri(poolID: number | string | BN): NonPayableTransactionObject<string>;
withdrawPayments(

Wyświetl plik

@ -0,0 +1,281 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import BN from "bn.js";
import { ContractOptions } from "web3-eth-contract";
import { EventLog } from "web3-core";
import { EventEmitter } from "events";
import {
Callback,
PayableTransactionObject,
NonPayableTransactionObject,
BlockType,
ContractEventLog,
BaseContract,
} from "./types";
export interface EventOptions {
filter?: object;
fromBlock?: BlockType;
topics?: string[];
}
export type ApprovalForAll = ContractEventLog<{
account: string;
operator: string;
approved: boolean;
0: string;
1: string;
2: boolean;
}>;
export type PoolMintBatch = ContractEventLog<{
id: string;
operator: string;
from: string;
toAddresses: string[];
amounts: string[];
0: string;
1: string;
2: string;
3: string[];
4: string[];
}>;
export type TransferBatch = ContractEventLog<{
operator: string;
from: string;
to: string;
ids: string[];
values: string[];
0: string;
1: string;
2: string;
3: string[];
4: string[];
}>;
export type TransferSingle = ContractEventLog<{
operator: string;
from: string;
to: string;
id: string;
value: string;
0: string;
1: string;
2: string;
3: string;
4: string;
}>;
export type URI = ContractEventLog<{
value: string;
id: string;
0: string;
1: string;
}>;
export interface TerminusFacetFixture extends BaseContract {
constructor(
jsonInterface: any[],
address?: string,
options?: ContractOptions
): TerminusFacetFixture;
clone(): TerminusFacetFixture;
methods: {
approveForPool(
poolID: number | string | BN,
operator: string
): NonPayableTransactionObject<void>;
balanceOf(
account: string,
id: number | string | BN
): NonPayableTransactionObject<string>;
balanceOfBatch(
accounts: string[],
ids: (number | string | BN)[]
): NonPayableTransactionObject<string[]>;
burn(
from: string,
poolID: number | string | BN,
amount: number | string | BN
): NonPayableTransactionObject<void>;
contractURI(): NonPayableTransactionObject<string>;
createPoolV1(
_capacity: number | string | BN,
_transferable: boolean,
_burnable: boolean
): NonPayableTransactionObject<string>;
createSimplePool(
_capacity: number | string | BN
): NonPayableTransactionObject<string>;
isApprovedForAll(
account: string,
operator: string
): NonPayableTransactionObject<boolean>;
isApprovedForPool(
poolID: number | string | BN,
operator: string
): NonPayableTransactionObject<boolean>;
isFixture(): NonPayableTransactionObject<boolean>;
mint(
to: string,
poolID: number | string | BN,
amount: number | string | BN,
data: string | number[]
): NonPayableTransactionObject<void>;
mintBatch(
to: string,
poolIDs: (number | string | BN)[],
amounts: (number | string | BN)[],
data: string | number[]
): NonPayableTransactionObject<void>;
paymentToken(): NonPayableTransactionObject<string>;
poolBasePrice(): NonPayableTransactionObject<string>;
poolMintBatch(
id: number | string | BN,
toAddresses: string[],
amounts: (number | string | BN)[]
): NonPayableTransactionObject<void>;
safeBatchTransferFrom(
from: string,
to: string,
ids: (number | string | BN)[],
amounts: (number | string | BN)[],
data: string | number[]
): NonPayableTransactionObject<void>;
safeTransferFrom(
from: string,
to: string,
id: number | string | BN,
amount: number | string | BN,
data: string | number[]
): NonPayableTransactionObject<void>;
setApprovalForAll(
operator: string,
approved: boolean
): NonPayableTransactionObject<void>;
setContractURI(_contractURI: string): NonPayableTransactionObject<void>;
setController(newController: string): NonPayableTransactionObject<void>;
setPaymentToken(newPaymentToken: string): NonPayableTransactionObject<void>;
setPoolBasePrice(
newBasePrice: number | string | BN
): NonPayableTransactionObject<void>;
setPoolController(
poolID: number | string | BN,
newController: string
): NonPayableTransactionObject<void>;
setURI(
poolID: number | string | BN,
poolURI: string
): NonPayableTransactionObject<void>;
supportsInterface(
interfaceId: string | number[]
): NonPayableTransactionObject<boolean>;
terminusController(): NonPayableTransactionObject<string>;
terminusPoolCapacity(
poolID: number | string | BN
): NonPayableTransactionObject<string>;
terminusPoolController(
poolID: number | string | BN
): NonPayableTransactionObject<string>;
terminusPoolSupply(
poolID: number | string | BN
): NonPayableTransactionObject<string>;
totalPools(): NonPayableTransactionObject<string>;
uri(poolID: number | string | BN): NonPayableTransactionObject<string>;
withdrawPayments(
toAddress: string,
amount: number | string | BN
): NonPayableTransactionObject<void>;
};
events: {
ApprovalForAll(cb?: Callback<ApprovalForAll>): EventEmitter;
ApprovalForAll(
options?: EventOptions,
cb?: Callback<ApprovalForAll>
): EventEmitter;
PoolMintBatch(cb?: Callback<PoolMintBatch>): EventEmitter;
PoolMintBatch(
options?: EventOptions,
cb?: Callback<PoolMintBatch>
): EventEmitter;
TransferBatch(cb?: Callback<TransferBatch>): EventEmitter;
TransferBatch(
options?: EventOptions,
cb?: Callback<TransferBatch>
): EventEmitter;
TransferSingle(cb?: Callback<TransferSingle>): EventEmitter;
TransferSingle(
options?: EventOptions,
cb?: Callback<TransferSingle>
): EventEmitter;
URI(cb?: Callback<URI>): EventEmitter;
URI(options?: EventOptions, cb?: Callback<URI>): EventEmitter;
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
};
once(event: "ApprovalForAll", cb: Callback<ApprovalForAll>): void;
once(
event: "ApprovalForAll",
options: EventOptions,
cb: Callback<ApprovalForAll>
): void;
once(event: "PoolMintBatch", cb: Callback<PoolMintBatch>): void;
once(
event: "PoolMintBatch",
options: EventOptions,
cb: Callback<PoolMintBatch>
): void;
once(event: "TransferBatch", cb: Callback<TransferBatch>): void;
once(
event: "TransferBatch",
options: EventOptions,
cb: Callback<TransferBatch>
): void;
once(event: "TransferSingle", cb: Callback<TransferSingle>): void;
once(
event: "TransferSingle",
options: EventOptions,
cb: Callback<TransferSingle>
): void;
once(event: "URI", cb: Callback<URI>): void;
once(event: "URI", options: EventOptions, cb: Callback<URI>): void;
}

Wyświetl plik

@ -0,0 +1,37 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import BN from "bn.js";
import { ContractOptions } from "web3-eth-contract";
import { EventLog } from "web3-core";
import { EventEmitter } from "events";
import {
Callback,
PayableTransactionObject,
NonPayableTransactionObject,
BlockType,
ContractEventLog,
BaseContract,
} from "./types";
export interface EventOptions {
filter?: object;
fromBlock?: BlockType;
topics?: string[];
}
export interface TerminusInitializerFixture extends BaseContract {
constructor(
jsonInterface: any[],
address?: string,
options?: ContractOptions
): TerminusInitializerFixture;
clone(): TerminusInitializerFixture;
methods: {
init(): NonPayableTransactionObject<void>;
};
events: {
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
};
}

Wyświetl plik

@ -0,0 +1,37 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import BN from "bn.js";
import { ContractOptions } from "web3-eth-contract";
import { EventLog } from "web3-core";
import { EventEmitter } from "events";
import {
Callback,
PayableTransactionObject,
NonPayableTransactionObject,
BlockType,
ContractEventLog,
BaseContract,
} from "./types";
export interface EventOptions {
filter?: object;
fromBlock?: BlockType;
topics?: string[];
}
export interface TestFixture extends BaseContract {
constructor(
jsonInterface: any[],
address?: string,
options?: ContractOptions
): TestFixture;
clone(): TestFixture;
methods: {
isFixture(): NonPayableTransactionObject<boolean>;
};
events: {
allEvents(options?: EventOptions, cb?: Callback<EventLog>): EventEmitter;
};
}

Wyświetl plik

@ -26,11 +26,7 @@ const PoolCard = ({ poolId }: { poolId: string }) => {
poolId: poolId,
});
const web3Provider = useContext(Web3Context);
const isOwner =
terminusPool.terminusFacetCache.data?.controller === web3Provider.account;
if (!isOwner || terminusPool.terminusFacetCache.isLoading) return "";
if (terminusPool.terminusFacetCache.isLoading) return <Spinner />;
return (
<Center>
<Flex

Wyświetl plik

@ -7,18 +7,43 @@ import { ERC20WithCommonStorage } from "../../../contracts/ERC20WithCommonStorag
import { MoonstreamTokenFaucet } from "../../../contracts/MoonstreamTokenFaucet";
const erc20abi = require("../../../abi/erc20.json");
export const getTerminusFacetState = (contract: BaseContract) => async () => {
console.log("getTerminusFacetState");
const terminusFacet = contract as TerminusFacet;
// const controller = await terminusFacet.methods.terminusController().call();
const poolBasePrice = await terminusFacet.methods.poolBasePrice().call();
console.log("poolBasePrice", poolBasePrice);
const paymentToken = await terminusFacet.methods.paymentToken().call();
const contractURI = await terminusFacet.methods.contractURI().call();
const totalPools = await terminusFacet.methods.totalPools().call();
export const getTerminusFacetState =
(contract: BaseContract, owner?: string) => async () => {
console.log("getTerminusFacetState");
const terminusFacet = contract as TerminusFacet;
// const controller = await terminusFacet.methods.terminusController().call();
const poolBasePrice = await terminusFacet.methods.poolBasePrice().call();
console.log("poolBasePrice", poolBasePrice);
const paymentToken = await terminusFacet.methods.paymentToken().call();
const contractURI = await terminusFacet.methods.contractURI().call();
const totalPools = await terminusFacet.methods.totalPools().call();
let numberOfOwnedPools = "0";
let ownedPoolIds = [];
if (owner) {
numberOfOwnedPools = await terminusFacet.methods
.totalPoolsByOwner(owner)
.call();
return { poolBasePrice, paymentToken, contractURI, totalPools };
};
if (numberOfOwnedPools !== "0") {
const n = new Number(numberOfOwnedPools);
for (let i = 0; i < n; i++) {
const poolId = await terminusFacet.methods
.poolOfOwnerByIndex(owner, i)
.call();
ownedPoolIds.push(poolId);
}
}
}
return {
poolBasePrice,
paymentToken,
contractURI,
totalPools,
numberOfOwnedPools,
ownedPoolIds,
};
};
export const getTerminusFacetPoolState =
(contract: BaseContract, poolId: string) => async () => {
@ -37,6 +62,13 @@ export const getTerminusFacetPoolState =
return { controller, supply, uri, capacity };
};
export const getNumberOfPoolsByOwner =
(contract: BaseContract, owner: string) => async () => {
const terminusFacet = contract as TerminusFacet;
return number;
};
export const createSimplePool =
(contract: BaseContract, defaultTxConfig: any) =>
async ({