privately-smartcontract-lib 1.0.6 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MockUSDC.json +342 -0
- package/package.json +4 -4
- package/PrivatelyCoin.json +0 -863
- package/dist/PrivatelyAuctionSystem.json +0 -734
- package/dist/PrivatelyCoin.json +0 -863
- package/dist/PrivatelyCollection.json +0 -865
- package/dist/client.d.ts +0 -38
- package/dist/client.js +0 -67
- package/dist/common/index.d.ts +0 -2
- package/dist/common/index.js +0 -18
- package/dist/common/privately.error.d.ts +0 -5
- package/dist/common/privately.error.js +0 -47
- package/dist/common/request-signature.d.ts +0 -17
- package/dist/common/request-signature.js +0 -38
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -21
- package/dist/modules/auctions/auctions.auction.d.ts +0 -12
- package/dist/modules/auctions/auctions.auction.js +0 -29
- package/dist/modules/auctions/auctions.bid.reqest.d.ts +0 -12
- package/dist/modules/auctions/auctions.bid.reqest.js +0 -11
- package/dist/modules/auctions/auctions.client.d.ts +0 -147
- package/dist/modules/auctions/auctions.client.js +0 -312
- package/dist/modules/auctions/auctions.create.request.d.ts +0 -13
- package/dist/modules/auctions/auctions.create.request.js +0 -12
- package/dist/modules/auctions/auctions.errors.d.ts +0 -6
- package/dist/modules/auctions/auctions.errors.js +0 -14
- package/dist/modules/auctions/auctions.events.d.ts +0 -5
- package/dist/modules/auctions/auctions.events.js +0 -2
- package/dist/modules/auctions/auctions.nonces.d.ts +0 -4
- package/dist/modules/auctions/auctions.nonces.js +0 -2
- package/dist/modules/auctions/index.d.ts +0 -6
- package/dist/modules/auctions/index.js +0 -22
- package/dist/modules/coin/coin.approve.request.d.ts +0 -8
- package/dist/modules/coin/coin.approve.request.js +0 -11
- package/dist/modules/coin/coin.client.d.ts +0 -120
- package/dist/modules/coin/coin.client.js +0 -246
- package/dist/modules/coin/coin.errors.d.ts +0 -6
- package/dist/modules/coin/coin.errors.js +0 -23
- package/dist/modules/coin/coin.events.d.ts +0 -3
- package/dist/modules/coin/coin.events.js +0 -2
- package/dist/modules/coin/coin.nonces.d.ts +0 -4
- package/dist/modules/coin/coin.nonces.js +0 -2
- package/dist/modules/coin/coin.transfer.request.d.ts +0 -8
- package/dist/modules/coin/coin.transfer.request.js +0 -11
- package/dist/modules/coin/index.d.ts +0 -5
- package/dist/modules/coin/index.js +0 -21
- package/dist/modules/collection/collection.approve.request.d.ts +0 -8
- package/dist/modules/collection/collection.approve.request.js +0 -11
- package/dist/modules/collection/collection.client.d.ts +0 -97
- package/dist/modules/collection/collection.client.js +0 -224
- package/dist/modules/collection/collection.errors.d.ts +0 -6
- package/dist/modules/collection/collection.errors.js +0 -14
- package/dist/modules/collection/collection.events.d.ts +0 -3
- package/dist/modules/collection/collection.events.js +0 -2
- package/dist/modules/collection/collection.mint.request.d.ts +0 -9
- package/dist/modules/collection/collection.mint.request.js +0 -12
- package/dist/modules/collection/collection.nft.d.ts +0 -8
- package/dist/modules/collection/collection.nft.js +0 -21
- package/dist/modules/collection/collection.nonces.d.ts +0 -5
- package/dist/modules/collection/collection.nonces.js +0 -2
- package/dist/modules/collection/collection.transfer.request.d.ts +0 -12
- package/dist/modules/collection/collection.transfer.request.js +0 -11
- package/dist/modules/collection/index.d.ts +0 -7
- package/dist/modules/collection/index.js +0 -23
package/dist/client.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Block, Signer, TransactionResponse } from "ethers";
|
|
2
|
-
import { PrivatelyAuctionSystemClient } from "./modules/auctions";
|
|
3
|
-
import { PrivatelyCoinClient } from "./modules/coin";
|
|
4
|
-
import { PrivatelyCollectionClient } from "./modules/collection";
|
|
5
|
-
export declare class PrivatelyClient {
|
|
6
|
-
readonly signer: Signer;
|
|
7
|
-
readonly coin: PrivatelyCoinClient;
|
|
8
|
-
readonly collection: PrivatelyCollectionClient;
|
|
9
|
-
readonly auctions: PrivatelyAuctionSystemClient;
|
|
10
|
-
private constructor();
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new PrivatelyClient instance using the provided signer.
|
|
13
|
-
* @param signer The signer to use for transactions.
|
|
14
|
-
* @returns A new PrivatelyClient instance.
|
|
15
|
-
*/
|
|
16
|
-
static create(signer: Signer): Promise<PrivatelyClient>;
|
|
17
|
-
/**
|
|
18
|
-
* Fetches the latest block from the connected provider.
|
|
19
|
-
* @returns The latest block.
|
|
20
|
-
*/
|
|
21
|
-
getLastBlock(): Promise<Block>;
|
|
22
|
-
/**
|
|
23
|
-
* Fetches the timestamp of the latest block from the connected provider.
|
|
24
|
-
* @returns The timestamp of the latest block in seconds.
|
|
25
|
-
*/
|
|
26
|
-
getLastBlockTimestamp(): Promise<number>;
|
|
27
|
-
/**
|
|
28
|
-
* Fetches the address (public key) of the connected signer.
|
|
29
|
-
* @returns The address of the signer.
|
|
30
|
-
*/
|
|
31
|
-
getAddress(): Promise<string>;
|
|
32
|
-
/**
|
|
33
|
-
* Fetches a transaction by its hash.
|
|
34
|
-
* @param txHash The hash of the transaction to fetch.
|
|
35
|
-
* @returns The transaction if found, otherwise null.
|
|
36
|
-
*/
|
|
37
|
-
getTransaction(txHash: string): Promise<TransactionResponse | null>;
|
|
38
|
-
}
|
package/dist/client.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrivatelyClient = void 0;
|
|
4
|
-
const common_1 = require("./common");
|
|
5
|
-
const auctions_1 = require("./modules/auctions");
|
|
6
|
-
const coin_1 = require("./modules/coin");
|
|
7
|
-
const collection_1 = require("./modules/collection");
|
|
8
|
-
class PrivatelyClient {
|
|
9
|
-
signer;
|
|
10
|
-
coin;
|
|
11
|
-
collection;
|
|
12
|
-
auctions;
|
|
13
|
-
constructor(signer, network) {
|
|
14
|
-
this.signer = signer;
|
|
15
|
-
this.coin = new coin_1.PrivatelyCoinClient(signer, network);
|
|
16
|
-
this.collection = new collection_1.PrivatelyCollectionClient(signer, network);
|
|
17
|
-
this.auctions = new auctions_1.PrivatelyAuctionSystemClient(signer, network);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates a new PrivatelyClient instance using the provided signer.
|
|
21
|
-
* @param signer The signer to use for transactions.
|
|
22
|
-
* @returns A new PrivatelyClient instance.
|
|
23
|
-
*/
|
|
24
|
-
static async create(signer) {
|
|
25
|
-
if (!signer.provider)
|
|
26
|
-
throw new Error("Signer must be connected to a provider.");
|
|
27
|
-
const network = await signer.provider.getNetwork();
|
|
28
|
-
return new PrivatelyClient(signer, network);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Fetches the latest block from the connected provider.
|
|
32
|
-
* @returns The latest block.
|
|
33
|
-
*/
|
|
34
|
-
async getLastBlock() {
|
|
35
|
-
const provider = this.signer.provider;
|
|
36
|
-
if (!provider)
|
|
37
|
-
throw new common_1.PrivatelyError("Signer must be connected to a provider.");
|
|
38
|
-
const block = await provider.getBlock("latest");
|
|
39
|
-
if (!block)
|
|
40
|
-
throw new common_1.PrivatelyError("Failed to fetch the latest block.");
|
|
41
|
-
return block;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Fetches the timestamp of the latest block from the connected provider.
|
|
45
|
-
* @returns The timestamp of the latest block in seconds.
|
|
46
|
-
*/
|
|
47
|
-
async getLastBlockTimestamp() {
|
|
48
|
-
const block = await this.getLastBlock();
|
|
49
|
-
return block.timestamp;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Fetches the address (public key) of the connected signer.
|
|
53
|
-
* @returns The address of the signer.
|
|
54
|
-
*/
|
|
55
|
-
getAddress() {
|
|
56
|
-
return this.signer.getAddress();
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Fetches a transaction by its hash.
|
|
60
|
-
* @param txHash The hash of the transaction to fetch.
|
|
61
|
-
* @returns The transaction if found, otherwise null.
|
|
62
|
-
*/
|
|
63
|
-
async getTransaction(txHash) {
|
|
64
|
-
return (await this.signer.provider?.getTransaction(txHash)) ?? null;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
exports.PrivatelyClient = PrivatelyClient;
|
package/dist/common/index.d.ts
DELETED
package/dist/common/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./privately.error"), exports);
|
|
18
|
-
__exportStar(require("./request-signature"), exports);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrivatelyError = void 0;
|
|
4
|
-
exports.parseContractError = parseContractError;
|
|
5
|
-
class PrivatelyError extends Error {
|
|
6
|
-
constructor(message) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = "PrivatelyError";
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.PrivatelyError = PrivatelyError;
|
|
12
|
-
function parseContractError(error, contractInterface) {
|
|
13
|
-
const getNestedErrorData = (err) => {
|
|
14
|
-
if (typeof err?.data === "string")
|
|
15
|
-
return err.data;
|
|
16
|
-
if (err?.error)
|
|
17
|
-
return getNestedErrorData(err.error);
|
|
18
|
-
if (err?.data?.data)
|
|
19
|
-
return err.data.data;
|
|
20
|
-
return err?.data || err?.message || err;
|
|
21
|
-
};
|
|
22
|
-
try {
|
|
23
|
-
const errorData = getNestedErrorData(error);
|
|
24
|
-
if (errorData && contractInterface) {
|
|
25
|
-
const formattedData = typeof errorData === "string" && errorData.startsWith("0x")
|
|
26
|
-
? errorData
|
|
27
|
-
: null;
|
|
28
|
-
if (formattedData) {
|
|
29
|
-
const parsed = contractInterface.parseError(formattedData);
|
|
30
|
-
if (parsed) {
|
|
31
|
-
return `${parsed.name}${parsed.args.length ? `: ${parsed.args.join(", ")}` : ""}`;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const message = (error instanceof Error)
|
|
36
|
-
? error.message
|
|
37
|
-
: JSON.stringify(error, Object.getOwnPropertyNames(error));
|
|
38
|
-
const match = message.match(/(?:"message":"|execution reverted:?)(.*?)(?:"|$)/);
|
|
39
|
-
return match?.[1] || message;
|
|
40
|
-
}
|
|
41
|
-
catch (parseError) {
|
|
42
|
-
return JSON.stringify({
|
|
43
|
-
originalError: error,
|
|
44
|
-
parseError
|
|
45
|
-
}, null, 2);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare enum RequestType {
|
|
2
|
-
AUCTION_CREATE = "AUCTION_CREATE",
|
|
3
|
-
AUCTION_BID = "AUCTION_BID",
|
|
4
|
-
COIN_TRANSFER = "COIN_TRANSFER",
|
|
5
|
-
COIN_APPROVE = "COIN_APPROVE",
|
|
6
|
-
COLLECTION_MINT = "COLLECTION_MINT",
|
|
7
|
-
COLLECTION_TRANSFER = "COLLECTION_TRANSFER",
|
|
8
|
-
COLLECTION_APPROVE = "COLLECTION_APPROVE"
|
|
9
|
-
}
|
|
10
|
-
export declare class RequestSignature<T> {
|
|
11
|
-
readonly type: RequestType;
|
|
12
|
-
readonly signature: string;
|
|
13
|
-
readonly request: T;
|
|
14
|
-
constructor(type: RequestType, signature: string, request: T);
|
|
15
|
-
static deserialize<T>(json: string): RequestSignature<T>;
|
|
16
|
-
serialize(): string;
|
|
17
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequestSignature = exports.RequestType = void 0;
|
|
4
|
-
var RequestType;
|
|
5
|
-
(function (RequestType) {
|
|
6
|
-
// Auctions requests types
|
|
7
|
-
RequestType["AUCTION_CREATE"] = "AUCTION_CREATE";
|
|
8
|
-
RequestType["AUCTION_BID"] = "AUCTION_BID";
|
|
9
|
-
// Coin requests types
|
|
10
|
-
RequestType["COIN_TRANSFER"] = "COIN_TRANSFER";
|
|
11
|
-
RequestType["COIN_APPROVE"] = "COIN_APPROVE";
|
|
12
|
-
// Collection requests types
|
|
13
|
-
RequestType["COLLECTION_MINT"] = "COLLECTION_MINT";
|
|
14
|
-
RequestType["COLLECTION_TRANSFER"] = "COLLECTION_TRANSFER";
|
|
15
|
-
RequestType["COLLECTION_APPROVE"] = "COLLECTION_APPROVE";
|
|
16
|
-
})(RequestType || (exports.RequestType = RequestType = {}));
|
|
17
|
-
class RequestSignature {
|
|
18
|
-
type;
|
|
19
|
-
signature;
|
|
20
|
-
request;
|
|
21
|
-
constructor(type, signature, request) {
|
|
22
|
-
this.type = type;
|
|
23
|
-
this.signature = signature;
|
|
24
|
-
this.request = request;
|
|
25
|
-
}
|
|
26
|
-
static deserialize(json) {
|
|
27
|
-
const parsed = JSON.parse(json, (key, value) => {
|
|
28
|
-
if (typeof value === "string" && value.endsWith("n"))
|
|
29
|
-
return BigInt(value.slice(0, -1));
|
|
30
|
-
return value;
|
|
31
|
-
});
|
|
32
|
-
return new RequestSignature(parsed.type, parsed.signature, parsed.request);
|
|
33
|
-
}
|
|
34
|
-
serialize() {
|
|
35
|
-
return JSON.stringify(this, (key, value) => typeof value === "bigint" ? value.toString() + "n" : value);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.RequestSignature = RequestSignature;
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./client"), exports);
|
|
18
|
-
__exportStar(require("./common"), exports);
|
|
19
|
-
__exportStar(require("./modules/coin"), exports);
|
|
20
|
-
__exportStar(require("./modules/collection"), exports);
|
|
21
|
-
__exportStar(require("./modules/auctions"), exports);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare class Auction {
|
|
2
|
-
id: bigint;
|
|
3
|
-
seller: string;
|
|
4
|
-
tokenId: bigint;
|
|
5
|
-
startPrice: bigint;
|
|
6
|
-
highestBid: bigint;
|
|
7
|
-
highestBidder: string;
|
|
8
|
-
endTime: bigint;
|
|
9
|
-
settled: boolean;
|
|
10
|
-
constructor(id: bigint, seller: string, tokenId: bigint, startPrice: bigint, highestBid: bigint, highestBidder: string, endTime: bigint, settled: boolean);
|
|
11
|
-
static map(list: bigint[], client: any): Promise<Auction[]>;
|
|
12
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Auction = void 0;
|
|
4
|
-
class Auction {
|
|
5
|
-
id; // Auction ID
|
|
6
|
-
seller; // Seller's address
|
|
7
|
-
tokenId; // Token ID being auctioned
|
|
8
|
-
startPrice; // Starting price of the auction
|
|
9
|
-
highestBid; // Highest bid placed in the auction
|
|
10
|
-
highestBidder; // Address of the highest bidder
|
|
11
|
-
endTime; // End time of the auction (timestamp)
|
|
12
|
-
settled; // Indicates if the auction has been settled
|
|
13
|
-
constructor(id, seller, tokenId, startPrice, highestBid, highestBidder, endTime, settled) {
|
|
14
|
-
this.id = id;
|
|
15
|
-
this.seller = seller;
|
|
16
|
-
this.tokenId = tokenId;
|
|
17
|
-
this.startPrice = startPrice;
|
|
18
|
-
this.highestBid = highestBid;
|
|
19
|
-
this.highestBidder = highestBidder;
|
|
20
|
-
this.endTime = endTime;
|
|
21
|
-
this.settled = settled;
|
|
22
|
-
}
|
|
23
|
-
static async map(list, client) {
|
|
24
|
-
return await Promise.all(list.map(async (id) => {
|
|
25
|
-
return await client.getAuction(id);
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.Auction = Auction;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AUCTIONS_BID_REQUEST_TYPE = void 0;
|
|
4
|
-
exports.AUCTIONS_BID_REQUEST_TYPE = {
|
|
5
|
-
BidRequest: [
|
|
6
|
-
{ name: "bidder", type: "address" },
|
|
7
|
-
{ name: "auctionId", type: "uint256" },
|
|
8
|
-
{ name: "bidAmount", type: "uint256" },
|
|
9
|
-
{ name: "nonce", type: "uint256" }
|
|
10
|
-
]
|
|
11
|
-
};
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { Contract, Network, Signer, TransactionResponse } from "ethers";
|
|
2
|
-
import { RequestSignature } from "../../common/request-signature";
|
|
3
|
-
import { Auction } from "./auctions.auction";
|
|
4
|
-
import { BidAuctionRequest } from "./auctions.bid.reqest";
|
|
5
|
-
import { CreateAuctionRequest } from "./auctions.create.request";
|
|
6
|
-
import { OnBidListener, OnCreateListener, OnEnd, OnWithdrawListener } from "./auctions.events";
|
|
7
|
-
export declare class PrivatelyAuctionSystemClient {
|
|
8
|
-
readonly contract: Contract;
|
|
9
|
-
private readonly signer;
|
|
10
|
-
private readonly domain;
|
|
11
|
-
constructor(signer: Signer, network: Network);
|
|
12
|
-
/**
|
|
13
|
-
* Retrieves the address of the current deployed contract.
|
|
14
|
-
* @returns The contract address.
|
|
15
|
-
*/
|
|
16
|
-
getContractAddress(): string;
|
|
17
|
-
/**
|
|
18
|
-
* Creates and signs a CreateAuctionRequest using EIP-712 structured data.
|
|
19
|
-
* The request can later be relayed to the contract via `relayCreateAuction`.
|
|
20
|
-
* @param tokenId The ID of the NFT being auctioned.
|
|
21
|
-
* @param startPrice The auction's starting price in wei.
|
|
22
|
-
* @param endTime The timestamp at which the auction ends.
|
|
23
|
-
* @returns An object containing the request struct and its signature.
|
|
24
|
-
*/
|
|
25
|
-
createAuctionRequest(tokenId: bigint, startPrice: bigint, endTime: bigint): Promise<RequestSignature<CreateAuctionRequest>>;
|
|
26
|
-
/**
|
|
27
|
-
* Relays a signed CreateAuctionRequest on-chain. The relayer pays gas.
|
|
28
|
-
* @param request The CreateAuctionRequest struct.
|
|
29
|
-
* @param signature The EIP-712 signature that authorizes creating the auction.
|
|
30
|
-
* @returns A TransactionResponse from ethers.
|
|
31
|
-
*/
|
|
32
|
-
relayCreateAuctionRequest(request: CreateAuctionRequest, signature: string): Promise<TransactionResponse>;
|
|
33
|
-
/**
|
|
34
|
-
* Creates and signs a BidRequest using EIP-712 structured data.
|
|
35
|
-
* The request can later be relayed to the contract via `relayBid`.
|
|
36
|
-
* @param auctionId The ID of the auction the bidder is bidding on.
|
|
37
|
-
* @param bidAmount The amount in wei the bidder is offering.
|
|
38
|
-
* @returns An object containing the bid request struct and its signature.
|
|
39
|
-
*/
|
|
40
|
-
createBidRequest(auctionId: bigint, bidAmount: bigint): Promise<RequestSignature<BidAuctionRequest>>;
|
|
41
|
-
/**
|
|
42
|
-
* Relays a signed bid request (BidRequest) on-chain. The relayer pays gas.
|
|
43
|
-
* IMPORTANT: The relayer must include `bidAmount` in `msg.value` when sending the transaction.
|
|
44
|
-
* @param request The BidRequest struct.
|
|
45
|
-
* @param signature The EIP-712 signature that authorizes the bid.
|
|
46
|
-
* @returns A TransactionResponse from ethers.
|
|
47
|
-
*/
|
|
48
|
-
relayBidRequest(request: BidAuctionRequest, signature: string): Promise<TransactionResponse>;
|
|
49
|
-
/**
|
|
50
|
-
* Finalizes an auction once the endTime is reached. Anyone can call this.
|
|
51
|
-
* @param auctionId The ID of the auction to finalize.
|
|
52
|
-
* @returns A TransactionResponse.
|
|
53
|
-
*/
|
|
54
|
-
finalizeAuction(auctionId: bigint): Promise<TransactionResponse>;
|
|
55
|
-
/**
|
|
56
|
-
* Allows users to withdraw their pending refunds from previous unsuccessful bids.
|
|
57
|
-
* @returns A TransactionResponse.
|
|
58
|
-
*/
|
|
59
|
-
withdraw(): Promise<TransactionResponse>;
|
|
60
|
-
/**
|
|
61
|
-
* Retrieves all auction IDs created in the contract.
|
|
62
|
-
* @returns An array of auction IDs.
|
|
63
|
-
*/
|
|
64
|
-
getAllAuctions(): Promise<bigint[]>;
|
|
65
|
-
/**
|
|
66
|
-
* Retrieves all active auction IDs in the contract.
|
|
67
|
-
* @returns An array of Auction objects representing active auctions.
|
|
68
|
-
*/
|
|
69
|
-
getAllActiveAuctions(): Promise<Auction[]>;
|
|
70
|
-
/**
|
|
71
|
-
* Retrieves all auction IDs created by a specific seller.
|
|
72
|
-
* @param seller The address of the seller to fetch auctions for.
|
|
73
|
-
* @returns An array of Auction objects.
|
|
74
|
-
*/
|
|
75
|
-
getSellerAuctions(seller: string): Promise<Auction[]>;
|
|
76
|
-
/**
|
|
77
|
-
* Retrieves all auction IDs created by the client's signer address.
|
|
78
|
-
* @returns An array of Auction objects.
|
|
79
|
-
*/
|
|
80
|
-
getAuctions(): Promise<Auction[]>;
|
|
81
|
-
/**
|
|
82
|
-
* Retrieves the auction details for a specific auction ID.
|
|
83
|
-
* @param auctionId The ID of the auction to fetch.
|
|
84
|
-
* @returns An Auction object.
|
|
85
|
-
*/
|
|
86
|
-
getAuction(auctionId: bigint): Promise<Auction>;
|
|
87
|
-
/**
|
|
88
|
-
* Registers a listener for the "OnCreate" event emitted by the contract when an auction is created.
|
|
89
|
-
* @param listener A callback function to be executed when the "OnCreate" event is triggered.
|
|
90
|
-
*/
|
|
91
|
-
onCreateEvent(listener: OnCreateListener): void;
|
|
92
|
-
/**
|
|
93
|
-
* Registers a listener for the "OnBid" event emitted by the contract when a bid is placed.
|
|
94
|
-
* @param listener A callback function to be executed when the "OnBid" event is triggered.
|
|
95
|
-
*/
|
|
96
|
-
onBidEvent(listener: OnBidListener): void;
|
|
97
|
-
/**
|
|
98
|
-
* Registers a listener for the "OnEnd" event emitted by the contract when an auction ends.
|
|
99
|
-
* @param listener A callback function to be executed when the "OnEnd" event is triggered.
|
|
100
|
-
*/
|
|
101
|
-
onEndEvent(listener: OnEnd): void;
|
|
102
|
-
/**
|
|
103
|
-
* Registers a listener for the "OnWithdraw" event emitted by the contract when a user withdraws funds.
|
|
104
|
-
* @param listener A callback function to be executed when the "OnWithdraw" event is triggered.
|
|
105
|
-
*/
|
|
106
|
-
onWithdrawEvent(listener: OnWithdrawListener): void;
|
|
107
|
-
/**
|
|
108
|
-
* Retrieves all auctions (settled or not) for a given tokenId,
|
|
109
|
-
* and maps them into Auction instances via Auction.map().
|
|
110
|
-
* @param tokenId The NFT identifier.
|
|
111
|
-
* @returns A list of Auction objects.
|
|
112
|
-
*/
|
|
113
|
-
getAuctionsByToken(tokenId: bigint): Promise<Auction[]>;
|
|
114
|
-
/**
|
|
115
|
-
* Fetches the current nonces for a user.
|
|
116
|
-
* @param userAddress The address of the user to fetch the nonce for.
|
|
117
|
-
* @returns An object containing the nonces.
|
|
118
|
-
*/
|
|
119
|
-
private getNonces;
|
|
120
|
-
/**
|
|
121
|
-
* Retrieves all auctions where the user has placed at least one bid.
|
|
122
|
-
* @param userAddress The address of the user to fetch auctions for.
|
|
123
|
-
* @returns An array of Auction objects where the user has bid.
|
|
124
|
-
*/
|
|
125
|
-
getUserBidAuctions(userAddress: string): Promise<Auction[]>;
|
|
126
|
-
/**
|
|
127
|
-
* Retrieves all active auctions where the user has placed at least one bid.
|
|
128
|
-
* @param userAddress The address of the user to fetch active auctions for.
|
|
129
|
-
* @returns An array of active Auction objects where the user has bid.
|
|
130
|
-
*/
|
|
131
|
-
getUserActiveBidAuctions(userAddress: string): Promise<Auction[]>;
|
|
132
|
-
/**
|
|
133
|
-
* Retrieves all auctions where the current signer has placed at least one bid.
|
|
134
|
-
* @returns An array of Auction objects where the signer has bid.
|
|
135
|
-
*/
|
|
136
|
-
getBidAuctions(): Promise<Auction[]>;
|
|
137
|
-
/**
|
|
138
|
-
* Retrieves all active auctions where the current signer has placed at least one bid.
|
|
139
|
-
* @returns An array of active Auction objects where the signer has bid.
|
|
140
|
-
*/
|
|
141
|
-
getActiveBidAuctions(): Promise<Auction[]>;
|
|
142
|
-
/**
|
|
143
|
-
* Retrieves all expired but unfinalized auction IDs in the contract.
|
|
144
|
-
* @returns An array of expired auction objects that need to be finalized.
|
|
145
|
-
*/
|
|
146
|
-
getAllExpiredUnfinalizedAuctions(): Promise<Auction[]>;
|
|
147
|
-
}
|