@opensea/seaport-js 1.0.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/README.md +45 -0
- package/lib/abi/ERC1155.d.ts +29 -0
- package/lib/abi/ERC1155.js +319 -0
- package/lib/abi/ERC1155.js.map +1 -0
- package/lib/abi/ERC20.d.ts +29 -0
- package/lib/abi/ERC20.js +317 -0
- package/lib/abi/ERC20.js.map +1 -0
- package/lib/abi/ERC721.d.ts +29 -0
- package/lib/abi/ERC721.js +337 -0
- package/lib/abi/ERC721.js.map +1 -0
- package/lib/abi/Seaport.d.ts +112 -0
- package/lib/abi/Seaport.js +2585 -0
- package/lib/abi/Seaport.js.map +1 -0
- package/lib/constants.d.ts +49 -0
- package/lib/constants.js +73 -0
- package/lib/constants.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/seaport.d.ts +181 -0
- package/lib/seaport.js +720 -0
- package/lib/seaport.js.map +1 -0
- package/lib/typechain/ERC1155.d.ts +189 -0
- package/lib/typechain/ERC1155.js +3 -0
- package/lib/typechain/ERC1155.js.map +1 -0
- package/lib/typechain/ERC20.d.ts +209 -0
- package/lib/typechain/ERC20.js +3 -0
- package/lib/typechain/ERC20.js.map +1 -0
- package/lib/typechain/ERC721.d.ts +220 -0
- package/lib/typechain/ERC721.js +3 -0
- package/lib/typechain/ERC721.js.map +1 -0
- package/lib/typechain/Seaport.d.ts +686 -0
- package/lib/typechain/Seaport.js +3 -0
- package/lib/typechain/Seaport.js.map +1 -0
- package/lib/typechain/common.d.ts +21 -0
- package/lib/typechain/common.js +3 -0
- package/lib/typechain/common.js.map +1 -0
- package/lib/types.d.ts +207 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/approval.d.ts +9 -0
- package/lib/utils/approval.js +108 -0
- package/lib/utils/approval.js.map +1 -0
- package/lib/utils/balance.d.ts +4 -0
- package/lib/utils/balance.js +86 -0
- package/lib/utils/balance.js.map +1 -0
- package/lib/utils/balanceAndApprovalCheck.d.ts +108 -0
- package/lib/utils/balanceAndApprovalCheck.js +322 -0
- package/lib/utils/balanceAndApprovalCheck.js.map +1 -0
- package/lib/utils/criteria.d.ts +14 -0
- package/lib/utils/criteria.js +91 -0
- package/lib/utils/criteria.js.map +1 -0
- package/lib/utils/fulfill.d.ts +84 -0
- package/lib/utils/fulfill.js +573 -0
- package/lib/utils/fulfill.js.map +1 -0
- package/lib/utils/gcd.d.ts +3 -0
- package/lib/utils/gcd.js +25 -0
- package/lib/utils/gcd.js.map +1 -0
- package/lib/utils/item.d.ts +29 -0
- package/lib/utils/item.js +136 -0
- package/lib/utils/item.js.map +1 -0
- package/lib/utils/match.d.ts +54 -0
- package/lib/utils/match.js +56 -0
- package/lib/utils/match.js.map +1 -0
- package/lib/utils/merkletree.d.ts +11 -0
- package/lib/utils/merkletree.js +32 -0
- package/lib/utils/merkletree.js.map +1 -0
- package/lib/utils/order.d.ts +37 -0
- package/lib/utils/order.js +224 -0
- package/lib/utils/order.js.map +1 -0
- package/lib/utils/usecase.d.ts +4 -0
- package/lib/utils/usecase.js +158 -0
- package/lib/utils/usecase.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Seaport.js","sourceRoot":"","sources":["../../src/typechain/Seaport.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Listener } from "@ethersproject/providers";
|
|
2
|
+
import type { Event, EventFilter } from "ethers";
|
|
3
|
+
export interface TypedEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends Event {
|
|
4
|
+
args: TArgsArray & TArgsObject;
|
|
5
|
+
}
|
|
6
|
+
export interface TypedEventFilter<_TEvent extends TypedEvent> extends EventFilter {
|
|
7
|
+
}
|
|
8
|
+
export interface TypedListener<TEvent extends TypedEvent> {
|
|
9
|
+
(...listenerArg: [...__TypechainArgsArray<TEvent>, TEvent]): void;
|
|
10
|
+
}
|
|
11
|
+
declare type __TypechainArgsArray<T> = T extends TypedEvent<infer U> ? U : never;
|
|
12
|
+
export interface OnEvent<TRes> {
|
|
13
|
+
<TEvent extends TypedEvent>(eventFilter: TypedEventFilter<TEvent>, listener: TypedListener<TEvent>): TRes;
|
|
14
|
+
(eventName: string, listener: Listener): TRes;
|
|
15
|
+
}
|
|
16
|
+
export declare type MinEthersFactory<C, ARGS> = {
|
|
17
|
+
deploy(...a: ARGS[]): Promise<C>;
|
|
18
|
+
};
|
|
19
|
+
export declare type GetContractTypeFromFactory<F> = F extends MinEthersFactory<infer C, any> ? C : never;
|
|
20
|
+
export declare type GetARGsTypeFromFactory<F> = F extends MinEthersFactory<any, any> ? Parameters<F["deploy"]> : never;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/typechain/common.ts"],"names":[],"mappings":""}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import type { OrderStruct, Seaport as TypeChainSeaportContract } from "./typechain/Seaport";
|
|
2
|
+
import { BigNumber, BigNumberish, Contract, ContractTransaction, Overrides, PayableOverrides, PopulatedTransaction } from "ethers";
|
|
3
|
+
import { ItemType, OrderType } from "./constants";
|
|
4
|
+
import type { ERC721 } from "./typechain/ERC721";
|
|
5
|
+
import type { ERC20 } from "./typechain/ERC20";
|
|
6
|
+
export declare type SeaportConfig = {
|
|
7
|
+
ascendingAmountFulfillmentBuffer?: number;
|
|
8
|
+
balanceAndApprovalChecksOnOrderCreation?: boolean;
|
|
9
|
+
conduitKeyToConduit?: Record<string, string>;
|
|
10
|
+
overrides?: {
|
|
11
|
+
contractAddress?: string;
|
|
12
|
+
defaultConduitKey?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
export declare type OfferItem = {
|
|
16
|
+
itemType: ItemType;
|
|
17
|
+
token: string;
|
|
18
|
+
identifierOrCriteria: string;
|
|
19
|
+
startAmount: string;
|
|
20
|
+
endAmount: string;
|
|
21
|
+
};
|
|
22
|
+
export declare type ConsiderationItem = {
|
|
23
|
+
itemType: ItemType;
|
|
24
|
+
token: string;
|
|
25
|
+
identifierOrCriteria: string;
|
|
26
|
+
startAmount: string;
|
|
27
|
+
endAmount: string;
|
|
28
|
+
recipient: string;
|
|
29
|
+
};
|
|
30
|
+
export declare type Item = OfferItem | ConsiderationItem;
|
|
31
|
+
export declare type OrderParameters = {
|
|
32
|
+
offerer: string;
|
|
33
|
+
zone: string;
|
|
34
|
+
orderType: OrderType;
|
|
35
|
+
startTime: BigNumberish;
|
|
36
|
+
endTime: BigNumberish;
|
|
37
|
+
zoneHash: string;
|
|
38
|
+
salt: string;
|
|
39
|
+
offer: OfferItem[];
|
|
40
|
+
consideration: ConsiderationItem[];
|
|
41
|
+
totalOriginalConsiderationItems: BigNumberish;
|
|
42
|
+
conduitKey: string;
|
|
43
|
+
};
|
|
44
|
+
export declare type OrderComponents = OrderParameters & {
|
|
45
|
+
counter: number;
|
|
46
|
+
};
|
|
47
|
+
export declare type Order = {
|
|
48
|
+
parameters: OrderParameters;
|
|
49
|
+
signature: string;
|
|
50
|
+
};
|
|
51
|
+
export declare type AdvancedOrder = Order & {
|
|
52
|
+
numerator: BigNumber;
|
|
53
|
+
denominator: BigNumber;
|
|
54
|
+
extraData: string;
|
|
55
|
+
};
|
|
56
|
+
export declare type BasicErc721Item = {
|
|
57
|
+
itemType: ItemType.ERC721;
|
|
58
|
+
token: string;
|
|
59
|
+
identifier: string;
|
|
60
|
+
};
|
|
61
|
+
export declare type Erc721ItemWithCriteria = {
|
|
62
|
+
itemType: ItemType.ERC721;
|
|
63
|
+
token: string;
|
|
64
|
+
identifiers: string[];
|
|
65
|
+
amount?: string;
|
|
66
|
+
endAmount?: string;
|
|
67
|
+
};
|
|
68
|
+
declare type Erc721Item = BasicErc721Item | Erc721ItemWithCriteria;
|
|
69
|
+
export declare type BasicErc1155Item = {
|
|
70
|
+
itemType: ItemType.ERC1155;
|
|
71
|
+
token: string;
|
|
72
|
+
identifier: string;
|
|
73
|
+
amount: string;
|
|
74
|
+
endAmount?: string;
|
|
75
|
+
};
|
|
76
|
+
export declare type Erc1155ItemWithCriteria = {
|
|
77
|
+
itemType: ItemType.ERC1155;
|
|
78
|
+
token: string;
|
|
79
|
+
identifiers: string[];
|
|
80
|
+
amount: string;
|
|
81
|
+
endAmount?: string;
|
|
82
|
+
};
|
|
83
|
+
declare type Erc1155Item = BasicErc1155Item | Erc1155ItemWithCriteria;
|
|
84
|
+
export declare type CurrencyItem = {
|
|
85
|
+
token?: string;
|
|
86
|
+
amount: string;
|
|
87
|
+
endAmount?: string;
|
|
88
|
+
};
|
|
89
|
+
export declare type CreateInputItem = Erc721Item | Erc1155Item | CurrencyItem;
|
|
90
|
+
export declare type ConsiderationInputItem = CreateInputItem & {
|
|
91
|
+
recipient?: string;
|
|
92
|
+
};
|
|
93
|
+
export declare type TipInputItem = CreateInputItem & {
|
|
94
|
+
recipient: string;
|
|
95
|
+
};
|
|
96
|
+
export declare type Fee = {
|
|
97
|
+
recipient: string;
|
|
98
|
+
basisPoints: number;
|
|
99
|
+
};
|
|
100
|
+
export declare type CreateOrderInput = {
|
|
101
|
+
conduitKey?: string;
|
|
102
|
+
zone?: string;
|
|
103
|
+
startTime?: string;
|
|
104
|
+
endTime?: string;
|
|
105
|
+
offer: readonly CreateInputItem[];
|
|
106
|
+
consideration: readonly ConsiderationInputItem[];
|
|
107
|
+
counter?: number;
|
|
108
|
+
fees?: readonly Fee[];
|
|
109
|
+
allowPartialFills?: boolean;
|
|
110
|
+
restrictedByZone?: boolean;
|
|
111
|
+
useProxy?: boolean;
|
|
112
|
+
salt?: string;
|
|
113
|
+
};
|
|
114
|
+
export declare type InputCriteria = {
|
|
115
|
+
identifier: string;
|
|
116
|
+
proof: string[];
|
|
117
|
+
};
|
|
118
|
+
export declare type OrderStatus = {
|
|
119
|
+
isValidated: boolean;
|
|
120
|
+
isCancelled: boolean;
|
|
121
|
+
totalFilled: BigNumber;
|
|
122
|
+
totalSize: BigNumber;
|
|
123
|
+
};
|
|
124
|
+
export declare type OrderWithCounter = {
|
|
125
|
+
parameters: OrderComponents;
|
|
126
|
+
signature: string;
|
|
127
|
+
};
|
|
128
|
+
export declare type ContractMethodReturnType<T extends Contract, U extends keyof T["callStatic"]> = Awaited<ReturnType<T["callStatic"][U]>>;
|
|
129
|
+
export declare type TransactionMethods<T = unknown> = {
|
|
130
|
+
buildTransaction: (overrides?: Overrides) => Promise<PopulatedTransaction>;
|
|
131
|
+
callStatic: (overrides?: Overrides) => Promise<T>;
|
|
132
|
+
estimateGas: (overrides?: Overrides) => Promise<BigNumber>;
|
|
133
|
+
transact: (overrides?: Overrides) => Promise<ContractTransaction>;
|
|
134
|
+
};
|
|
135
|
+
export declare type ApprovalAction = {
|
|
136
|
+
type: "approval";
|
|
137
|
+
token: string;
|
|
138
|
+
identifierOrCriteria: string;
|
|
139
|
+
itemType: ItemType;
|
|
140
|
+
operator: string;
|
|
141
|
+
transactionMethods: TransactionMethods<ContractMethodReturnType<ERC721, "setApprovalForAll">> | TransactionMethods<ContractMethodReturnType<ERC20, "approve">>;
|
|
142
|
+
};
|
|
143
|
+
export declare type ExchangeAction<T = unknown> = {
|
|
144
|
+
type: "exchange";
|
|
145
|
+
transactionMethods: TransactionMethods<T>;
|
|
146
|
+
};
|
|
147
|
+
export declare type CreateOrderAction = {
|
|
148
|
+
type: "create";
|
|
149
|
+
getMessageToSign: () => Promise<string>;
|
|
150
|
+
createOrder: () => Promise<OrderWithCounter>;
|
|
151
|
+
};
|
|
152
|
+
export declare type TransactionAction = ApprovalAction | ExchangeAction;
|
|
153
|
+
export declare type CreateOrderActions = readonly [
|
|
154
|
+
...ApprovalAction[],
|
|
155
|
+
CreateOrderAction
|
|
156
|
+
];
|
|
157
|
+
export declare type OrderExchangeActions<T> = readonly [
|
|
158
|
+
...ApprovalAction[],
|
|
159
|
+
ExchangeAction<T>
|
|
160
|
+
];
|
|
161
|
+
export declare type OrderUseCase<T extends CreateOrderAction | ExchangeAction> = {
|
|
162
|
+
actions: T extends CreateOrderAction ? CreateOrderActions : OrderExchangeActions<T extends ExchangeAction<infer U> ? U : never>;
|
|
163
|
+
executeAllActions: () => Promise<T extends CreateOrderAction ? OrderWithCounter : ContractTransaction>;
|
|
164
|
+
};
|
|
165
|
+
export declare type FulfillmentComponent = {
|
|
166
|
+
orderIndex: number;
|
|
167
|
+
itemIndex: number;
|
|
168
|
+
}[];
|
|
169
|
+
export declare type Fulfillment = {
|
|
170
|
+
offerComponents: FulfillmentComponent[];
|
|
171
|
+
considerationComponents: FulfillmentComponent[];
|
|
172
|
+
};
|
|
173
|
+
declare type MatchOrdersFulfillmentComponent = {
|
|
174
|
+
orderIndex: number;
|
|
175
|
+
itemIndex: number;
|
|
176
|
+
};
|
|
177
|
+
export declare type MatchOrdersFulfillment = {
|
|
178
|
+
offerComponents: MatchOrdersFulfillmentComponent[];
|
|
179
|
+
considerationComponents: MatchOrdersFulfillmentComponent[];
|
|
180
|
+
};
|
|
181
|
+
export declare type SeaportContract = TypeChainSeaportContract & {
|
|
182
|
+
encodeFunctionData(functionFragment: "matchOrders", values: [OrderStruct[], MatchOrdersFulfillment[]]): string;
|
|
183
|
+
matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
|
|
184
|
+
from?: string | Promise<string>;
|
|
185
|
+
}): Promise<ContractTransaction>;
|
|
186
|
+
functions: TypeChainSeaportContract["functions"] & {
|
|
187
|
+
matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
|
|
188
|
+
from?: string | Promise<string>;
|
|
189
|
+
}): Promise<ContractTransaction>;
|
|
190
|
+
};
|
|
191
|
+
callStatic: TypeChainSeaportContract["callStatic"] & {
|
|
192
|
+
matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
|
|
193
|
+
from?: string | Promise<string>;
|
|
194
|
+
}): Promise<ContractTransaction>;
|
|
195
|
+
};
|
|
196
|
+
estimateGas: TypeChainSeaportContract["estimateGas"] & {
|
|
197
|
+
matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
|
|
198
|
+
from?: string | Promise<string>;
|
|
199
|
+
}): Promise<BigNumber>;
|
|
200
|
+
};
|
|
201
|
+
populateTranscation: TypeChainSeaportContract["populateTransaction"] & {
|
|
202
|
+
matchOrders(orders: OrderStruct[], fulfillments: MatchOrdersFulfillment[], overrides?: PayableOverrides & {
|
|
203
|
+
from?: string | Promise<string>;
|
|
204
|
+
}): Promise<PopulatedTransaction>;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
export {};
|
package/lib/types.js
ADDED
package/lib/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { providers as multicallProviders } from "@0xsequence/multicall";
|
|
2
|
+
import { BigNumber, providers } from "ethers";
|
|
3
|
+
import type { ApprovalAction, Item } from "../types";
|
|
4
|
+
import type { InsufficientApprovals } from "./balanceAndApprovalCheck";
|
|
5
|
+
export declare const approvedItemAmount: (owner: string, item: Item, operator: string, multicallProvider: multicallProviders.MulticallProvider) => Promise<BigNumber>;
|
|
6
|
+
/**
|
|
7
|
+
* Get approval actions given a list of insufficent approvals.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getApprovalActions(insufficientApprovals: InsufficientApprovals, signer: providers.JsonRpcSigner): Promise<ApprovalAction[]>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getApprovalActions = exports.approvedItemAmount = void 0;
|
|
40
|
+
var ethers_1 = require("ethers");
|
|
41
|
+
var ERC20_1 = require("../abi/ERC20");
|
|
42
|
+
var ERC721_1 = require("../abi/ERC721");
|
|
43
|
+
var constants_1 = require("../constants");
|
|
44
|
+
var item_1 = require("./item");
|
|
45
|
+
var usecase_1 = require("./usecase");
|
|
46
|
+
var approvedItemAmount = function (owner, item, operator, multicallProvider) { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var contract, contract;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
if ((0, item_1.isErc721Item)(item.itemType) || (0, item_1.isErc1155Item)(item.itemType)) {
|
|
50
|
+
contract = new ethers_1.Contract(item.token, ERC721_1.ERC721ABI, multicallProvider);
|
|
51
|
+
return [2 /*return*/, contract.isApprovedForAll(owner, operator).then(function (isApprovedForAll) {
|
|
52
|
+
// Setting to the max int to consolidate types and simplify
|
|
53
|
+
return isApprovedForAll ? constants_1.MAX_INT : ethers_1.BigNumber.from(0);
|
|
54
|
+
})];
|
|
55
|
+
}
|
|
56
|
+
else if (item.itemType === constants_1.ItemType.ERC20) {
|
|
57
|
+
contract = new ethers_1.Contract(item.token, ERC20_1.ERC20ABI, multicallProvider);
|
|
58
|
+
return [2 /*return*/, contract.allowance(owner, operator)];
|
|
59
|
+
}
|
|
60
|
+
// We don't need to check approvals for native tokens
|
|
61
|
+
return [2 /*return*/, constants_1.MAX_INT];
|
|
62
|
+
});
|
|
63
|
+
}); };
|
|
64
|
+
exports.approvedItemAmount = approvedItemAmount;
|
|
65
|
+
/**
|
|
66
|
+
* Get approval actions given a list of insufficent approvals.
|
|
67
|
+
*/
|
|
68
|
+
function getApprovalActions(insufficientApprovals, signer) {
|
|
69
|
+
var _this = this;
|
|
70
|
+
return Promise.all(insufficientApprovals
|
|
71
|
+
.filter(function (approval, index) {
|
|
72
|
+
return index === insufficientApprovals.length - 1 ||
|
|
73
|
+
insufficientApprovals[index + 1].token !== approval.token;
|
|
74
|
+
})
|
|
75
|
+
.map(function (_a) {
|
|
76
|
+
var token = _a.token, operator = _a.operator, itemType = _a.itemType, identifierOrCriteria = _a.identifierOrCriteria;
|
|
77
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
78
|
+
var contract, contract;
|
|
79
|
+
return __generator(this, function (_b) {
|
|
80
|
+
if ((0, item_1.isErc721Item)(itemType) || (0, item_1.isErc1155Item)(itemType)) {
|
|
81
|
+
contract = new ethers_1.Contract(token, ERC721_1.ERC721ABI, signer);
|
|
82
|
+
return [2 /*return*/, {
|
|
83
|
+
type: "approval",
|
|
84
|
+
token: token,
|
|
85
|
+
identifierOrCriteria: identifierOrCriteria,
|
|
86
|
+
itemType: itemType,
|
|
87
|
+
operator: operator,
|
|
88
|
+
transactionMethods: (0, usecase_1.getTransactionMethods)(contract.connect(signer), "setApprovalForAll", [operator, true]),
|
|
89
|
+
}];
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
contract = new ethers_1.Contract(token, ERC20_1.ERC20ABI, signer);
|
|
93
|
+
return [2 /*return*/, {
|
|
94
|
+
type: "approval",
|
|
95
|
+
token: token,
|
|
96
|
+
identifierOrCriteria: identifierOrCriteria,
|
|
97
|
+
itemType: itemType,
|
|
98
|
+
transactionMethods: (0, usecase_1.getTransactionMethods)(contract.connect(signer), "approve", [operator, constants_1.MAX_INT]),
|
|
99
|
+
operator: operator,
|
|
100
|
+
}];
|
|
101
|
+
}
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
exports.getApprovalActions = getApprovalActions;
|
|
108
|
+
//# sourceMappingURL=approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval.js","sourceRoot":"","sources":["../../src/utils/approval.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAAwD;AACxD,sCAAwC;AACxC,wCAA0C;AAC1C,0CAAiD;AAKjD,+BAAqD;AACrD,qCAAkD;AAE3C,IAAM,kBAAkB,GAAG,UAChC,KAAa,EACb,IAAU,EACV,QAAgB,EAChB,iBAAuD;;;QAEvD,IAAI,IAAA,mBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAEzD,QAAQ,GAAG,IAAI,iBAAQ,CAC3B,IAAI,CAAC,KAAK,EACV,kBAAS,EACT,iBAAiB,CACR,CAAC;YACZ,sBAAO,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,gBAAgB;oBACtE,2DAA2D;oBAC3D,OAAA,gBAAgB,CAAC,CAAC,CAAC,mBAAO,CAAC,CAAC,CAAC,kBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;gBAA9C,CAA8C,CAC/C,EAAC;SACH;aAAM,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAQ,CAAC,KAAK,EAAE;YACrC,QAAQ,GAAG,IAAI,iBAAQ,CAC3B,IAAI,CAAC,KAAK,EACV,gBAAQ,EACR,iBAAiB,CACT,CAAC;YAEX,sBAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAC;SAC5C;QAED,qDAAqD;QACrD,sBAAO,mBAAO,EAAC;;KAChB,CAAC;AA7BW,QAAA,kBAAkB,sBA6B7B;AAEF;;GAEG;AACH,SAAgB,kBAAkB,CAChC,qBAA4C,EAC5C,MAA+B;IAFjC,iBA8CC;IA1CC,OAAO,OAAO,CAAC,GAAG,CAChB,qBAAqB;SAClB,MAAM,CACL,UAAC,QAAQ,EAAE,KAAK;QACd,OAAA,KAAK,KAAK,qBAAqB,CAAC,MAAM,GAAG,CAAC;YAC1C,qBAAqB,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK;IADzD,CACyD,CAC5D;SACA,GAAG,CAAC,UAAO,EAAmD;YAAjD,KAAK,WAAA,EAAE,QAAQ,cAAA,EAAE,QAAQ,cAAA,EAAE,oBAAoB,0BAAA;;;;gBAC3D,IAAI,IAAA,mBAAY,EAAC,QAAQ,CAAC,IAAI,IAAA,oBAAa,EAAC,QAAQ,CAAC,EAAE;oBAE/C,QAAQ,GAAG,IAAI,iBAAQ,CAAC,KAAK,EAAE,kBAAS,EAAE,MAAM,CAAW,CAAC;oBAElE,sBAAO;4BACL,IAAI,EAAE,UAAU;4BAChB,KAAK,OAAA;4BACL,oBAAoB,sBAAA;4BACpB,QAAQ,UAAA;4BACR,QAAQ,UAAA;4BACR,kBAAkB,EAAE,IAAA,+BAAqB,EACvC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EACxB,mBAAmB,EACnB,CAAC,QAAQ,EAAE,IAAI,CAAC,CACjB;yBACF,EAAC;iBACH;qBAAM;oBACC,QAAQ,GAAG,IAAI,iBAAQ,CAAC,KAAK,EAAE,gBAAQ,EAAE,MAAM,CAAU,CAAC;oBAEhE,sBAAO;4BACL,IAAI,EAAE,UAAU;4BAChB,KAAK,OAAA;4BACL,oBAAoB,sBAAA;4BACpB,QAAQ,UAAA;4BACR,kBAAkB,EAAE,IAAA,+BAAqB,EACvC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EACxB,SAAS,EACT,CAAC,QAAQ,EAAE,mBAAO,CAAC,CACpB;4BACD,QAAQ,UAAA;yBACT,EAAC;iBACH;;;;KACF,CAAC,CACL,CAAC;AACJ,CAAC;AA9CD,gDA8CC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { providers as multicallProviders } from "@0xsequence/multicall";
|
|
2
|
+
import { BigNumber } from "ethers";
|
|
3
|
+
import type { InputCriteria, Item } from "../types";
|
|
4
|
+
export declare const balanceOf: (owner: string, item: Item, multicallProvider: multicallProviders.MulticallProvider, criteria?: InputCriteria | undefined) => Promise<BigNumber>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.balanceOf = void 0;
|
|
40
|
+
var ethers_1 = require("ethers");
|
|
41
|
+
var ERC1155_1 = require("../abi/ERC1155");
|
|
42
|
+
var ERC20_1 = require("../abi/ERC20");
|
|
43
|
+
var ERC721_1 = require("../abi/ERC721");
|
|
44
|
+
var constants_1 = require("../constants");
|
|
45
|
+
var item_1 = require("./item");
|
|
46
|
+
var balanceOf = function (owner, item, multicallProvider, criteria) { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var contract, contract, startAmount, endAmount, contract;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
if ((0, item_1.isErc721Item)(item.itemType)) {
|
|
50
|
+
contract = new ethers_1.Contract(item.token, ERC721_1.ERC721ABI, multicallProvider);
|
|
51
|
+
if (item.itemType === constants_1.ItemType.ERC721_WITH_CRITERIA) {
|
|
52
|
+
return [2 /*return*/, criteria
|
|
53
|
+
? contract
|
|
54
|
+
.ownerOf(criteria.identifier)
|
|
55
|
+
.then(function (ownerOf) {
|
|
56
|
+
return ethers_1.BigNumber.from(Number(ownerOf.toLowerCase() === owner.toLowerCase()));
|
|
57
|
+
})
|
|
58
|
+
: contract.balanceOf(owner)];
|
|
59
|
+
}
|
|
60
|
+
return [2 /*return*/, contract
|
|
61
|
+
.ownerOf(item.identifierOrCriteria)
|
|
62
|
+
.then(function (ownerOf) {
|
|
63
|
+
return ethers_1.BigNumber.from(Number(ownerOf.toLowerCase() === owner.toLowerCase()));
|
|
64
|
+
})];
|
|
65
|
+
}
|
|
66
|
+
else if ((0, item_1.isErc1155Item)(item.itemType)) {
|
|
67
|
+
contract = new ethers_1.Contract(item.token, ERC1155_1.ERC1155ABI, multicallProvider);
|
|
68
|
+
if (item.itemType === constants_1.ItemType.ERC1155_WITH_CRITERIA) {
|
|
69
|
+
if (!criteria) {
|
|
70
|
+
startAmount = ethers_1.BigNumber.from(item.startAmount);
|
|
71
|
+
endAmount = ethers_1.BigNumber.from(item.endAmount);
|
|
72
|
+
return [2 /*return*/, startAmount.gt(endAmount) ? startAmount : endAmount];
|
|
73
|
+
}
|
|
74
|
+
return [2 /*return*/, contract.balanceOf(owner, criteria.identifier)];
|
|
75
|
+
}
|
|
76
|
+
return [2 /*return*/, contract.balanceOf(owner, item.identifierOrCriteria)];
|
|
77
|
+
}
|
|
78
|
+
if ((0, item_1.isErc20Item)(item.itemType)) {
|
|
79
|
+
contract = new ethers_1.Contract(item.token, ERC20_1.ERC20ABI, multicallProvider);
|
|
80
|
+
return [2 /*return*/, contract.balanceOf(owner)];
|
|
81
|
+
}
|
|
82
|
+
return [2 /*return*/, multicallProvider.getBalance(owner)];
|
|
83
|
+
});
|
|
84
|
+
}); };
|
|
85
|
+
exports.balanceOf = balanceOf;
|
|
86
|
+
//# sourceMappingURL=balance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../src/utils/balance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,iCAA6C;AAC7C,0CAA4C;AAC5C,sCAAwC;AACxC,wCAA0C;AAC1C,0CAAwC;AAKxC,+BAAkE;AAE3D,IAAM,SAAS,GAAG,UACvB,KAAa,EACb,IAAU,EACV,iBAAuD,EACvD,QAAwB;;;QAExB,IAAI,IAAA,mBAAY,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACzB,QAAQ,GAAG,IAAI,iBAAQ,CAC3B,IAAI,CAAC,KAAK,EACV,kBAAS,EACT,iBAAiB,CACR,CAAC;YAEZ,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAQ,CAAC,oBAAoB,EAAE;gBACnD,sBAAO,QAAQ;wBACb,CAAC,CAAC,QAAQ;6BACL,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;6BAC5B,IAAI,CAAC,UAAC,OAAO;4BACZ,OAAA,kBAAS,CAAC,IAAI,CACZ,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,CACtD;wBAFD,CAEC,CACF;wBACL,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAC;aAC/B;YAED,sBAAO,QAAQ;qBACZ,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC;qBAClC,IAAI,CAAC,UAAC,OAAO;oBACZ,OAAA,kBAAS,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;gBAArE,CAAqE,CACtE,EAAC;SACL;aAAM,IAAI,IAAA,oBAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACjC,QAAQ,GAAG,IAAI,iBAAQ,CAC3B,IAAI,CAAC,KAAK,EACV,oBAAU,EACV,iBAAiB,CACP,CAAC;YAEb,IAAI,IAAI,CAAC,QAAQ,KAAK,oBAAQ,CAAC,qBAAqB,EAAE;gBACpD,IAAI,CAAC,QAAQ,EAAE;oBAGP,WAAW,GAAG,kBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBAC/C,SAAS,GAAG,kBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBAEjD,sBAAO,WAAW,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAC;iBAC5D;gBACD,sBAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAC;aACvD;YAED,sBAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,oBAAoB,CAAC,EAAC;SAC7D;QAED,IAAI,IAAA,kBAAW,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YACxB,QAAQ,GAAG,IAAI,iBAAQ,CAC3B,IAAI,CAAC,KAAK,EACV,gBAAQ,EACR,iBAAiB,CACT,CAAC;YACX,sBAAO,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAC;SAClC;QAED,sBAAO,iBAAiB,CAAC,UAAU,CAAC,KAAK,CAAC,EAAC;;KAC5C,CAAC;AA9DW,QAAA,SAAS,aA8DpB"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { providers as multicallProviders } from "@0xsequence/multicall";
|
|
2
|
+
import { BigNumber } from "ethers";
|
|
3
|
+
import { ItemType } from "../constants";
|
|
4
|
+
import type { InputCriteria, Item, OrderParameters } from "../types";
|
|
5
|
+
import { getSummedTokenAndIdentifierAmounts, TimeBasedItemParams } from "./item";
|
|
6
|
+
export declare type BalancesAndApprovals = {
|
|
7
|
+
token: string;
|
|
8
|
+
identifierOrCriteria: string;
|
|
9
|
+
balance: BigNumber;
|
|
10
|
+
approvedAmount: BigNumber;
|
|
11
|
+
itemType: ItemType;
|
|
12
|
+
}[];
|
|
13
|
+
export declare type InsufficientBalances = {
|
|
14
|
+
token: string;
|
|
15
|
+
identifierOrCriteria: string;
|
|
16
|
+
requiredAmount: BigNumber;
|
|
17
|
+
amountHave: BigNumber;
|
|
18
|
+
itemType: ItemType;
|
|
19
|
+
}[];
|
|
20
|
+
export declare type InsufficientApprovals = {
|
|
21
|
+
token: string;
|
|
22
|
+
identifierOrCriteria: string;
|
|
23
|
+
approvedAmount: BigNumber;
|
|
24
|
+
requiredApprovedAmount: BigNumber;
|
|
25
|
+
operator: string;
|
|
26
|
+
itemType: ItemType;
|
|
27
|
+
}[];
|
|
28
|
+
export declare const getBalancesAndApprovals: ({ owner, items, criterias, operator, multicallProvider, }: {
|
|
29
|
+
owner: string;
|
|
30
|
+
items: Item[];
|
|
31
|
+
criterias: InputCriteria[];
|
|
32
|
+
operator: string;
|
|
33
|
+
multicallProvider: multicallProviders.MulticallProvider;
|
|
34
|
+
}) => Promise<BalancesAndApprovals>;
|
|
35
|
+
export declare const getInsufficientBalanceAndApprovalAmounts: ({ balancesAndApprovals, tokenAndIdentifierAmounts, operator, }: {
|
|
36
|
+
balancesAndApprovals: BalancesAndApprovals;
|
|
37
|
+
tokenAndIdentifierAmounts: ReturnType<typeof getSummedTokenAndIdentifierAmounts>;
|
|
38
|
+
operator: string;
|
|
39
|
+
}) => {
|
|
40
|
+
insufficientBalances: InsufficientBalances;
|
|
41
|
+
insufficientApprovals: InsufficientApprovals;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* 1. The offerer should have sufficient balance of all offered items.
|
|
45
|
+
* 2. If the order does not indicate proxy utilization, the offerer should have sufficient approvals set
|
|
46
|
+
* for the Seaport contract for all offered ERC20, ERC721, and ERC1155 items.
|
|
47
|
+
* 3. If the order does indicate proxy utilization, the offerer should have sufficient approvals set
|
|
48
|
+
* for their respective proxy contract for all offered ERC20, ERC721, and ERC1155 items.
|
|
49
|
+
*/
|
|
50
|
+
export declare const validateOfferBalancesAndApprovals: ({ offer, criterias, balancesAndApprovals, timeBasedItemParams, throwOnInsufficientBalances, throwOnInsufficientApprovals, operator, }: {
|
|
51
|
+
balancesAndApprovals: BalancesAndApprovals;
|
|
52
|
+
timeBasedItemParams?: TimeBasedItemParams | undefined;
|
|
53
|
+
throwOnInsufficientBalances?: boolean | undefined;
|
|
54
|
+
throwOnInsufficientApprovals?: boolean | undefined;
|
|
55
|
+
operator: string;
|
|
56
|
+
} & Pick<OrderParameters, "offer"> & {
|
|
57
|
+
criterias: InputCriteria[];
|
|
58
|
+
}) => InsufficientApprovals;
|
|
59
|
+
/**
|
|
60
|
+
* When fulfilling a basic order, the following requirements need to be checked to ensure that the order will be fulfillable:
|
|
61
|
+
* 1. Offer checks need to be performed to ensure that the offerer still has sufficient balance and approvals
|
|
62
|
+
* 2. The fulfiller should have sufficient balance of all consideration items except for those with an
|
|
63
|
+
* item type that matches the order's offered item type — by way of example, if the fulfilled order offers
|
|
64
|
+
* an ERC20 item and requires an ERC721 item to the offerer and the same ERC20 item to another recipient,
|
|
65
|
+
* the fulfiller needs to own the ERC721 item but does not need to own the ERC20 item as it will be sourced from the offerer.
|
|
66
|
+
* 3. If the fulfiller does not elect to utilize a proxy, they need to have sufficient approvals set for the
|
|
67
|
+
* Seaport contract for all ERC20, ERC721, and ERC1155 consideration items on the fulfilled order except
|
|
68
|
+
* for ERC20 items with an item type that matches the order's offered item type.
|
|
69
|
+
* 4. If the fulfiller does elect to utilize a proxy, they need to have sufficient approvals set for their
|
|
70
|
+
* respective proxy contract for all ERC20, ERC721, and ERC1155 consideration items on the fulfilled order
|
|
71
|
+
* except for ERC20 items with an item type that matches the order's offered item type.
|
|
72
|
+
* 5. If the fulfilled order specifies Ether (or other native tokens) as consideration items, the fulfiller must
|
|
73
|
+
* be able to supply the sum total of those items as msg.value.
|
|
74
|
+
*
|
|
75
|
+
* @returns the list of insufficient owner and proxy approvals
|
|
76
|
+
*/
|
|
77
|
+
export declare const validateBasicFulfillBalancesAndApprovals: ({ offer, consideration, offererBalancesAndApprovals, fulfillerBalancesAndApprovals, timeBasedItemParams, offererOperator, fulfillerOperator, }: {
|
|
78
|
+
offererBalancesAndApprovals: BalancesAndApprovals;
|
|
79
|
+
fulfillerBalancesAndApprovals: BalancesAndApprovals;
|
|
80
|
+
timeBasedItemParams: TimeBasedItemParams;
|
|
81
|
+
offererOperator: string;
|
|
82
|
+
fulfillerOperator: string;
|
|
83
|
+
} & Pick<OrderParameters, "offer" | "consideration">) => InsufficientApprovals;
|
|
84
|
+
/**
|
|
85
|
+
* When fulfilling a standard order, the following requirements need to be checked to ensure that the order will be fulfillable:
|
|
86
|
+
* 1. Offer checks need to be performed to ensure that the offerer still has sufficient balance and approvals
|
|
87
|
+
* 2. The fulfiller should have sufficient balance of all consideration items after receiving all offered items
|
|
88
|
+
* — by way of example, if the fulfilled order offers an ERC20 item and requires an ERC721 item to the offerer
|
|
89
|
+
* and the same ERC20 item to another recipient with an amount less than or equal to the offered amount,
|
|
90
|
+
* the fulfiller does not need to own the ERC20 item as it will first be received from the offerer.
|
|
91
|
+
* 3. If the fulfiller does not elect to utilize a proxy, they need to have sufficient approvals set for the
|
|
92
|
+
* Seaport contract for all ERC20, ERC721, and ERC1155 consideration items on the fulfilled order.
|
|
93
|
+
* 4. If the fulfiller does elect to utilize a proxy, they need to have sufficient approvals set for their
|
|
94
|
+
* respective proxy contract for all ERC20, ERC721, and ERC1155 consideration items on the fulfilled order.
|
|
95
|
+
* 5. If the fulfilled order specifies Ether (or other native tokens) as consideration items, the fulfiller must
|
|
96
|
+
* be able to supply the sum total of those items as msg.value.
|
|
97
|
+
*
|
|
98
|
+
* @returns the list of insufficient owner and proxy approvals
|
|
99
|
+
*/
|
|
100
|
+
export declare const validateStandardFulfillBalancesAndApprovals: ({ offer, consideration, offerCriteria, considerationCriteria, offererBalancesAndApprovals, fulfillerBalancesAndApprovals, timeBasedItemParams, offererOperator, fulfillerOperator, }: Pick<OrderParameters, "offer" | "consideration"> & {
|
|
101
|
+
offerCriteria: InputCriteria[];
|
|
102
|
+
considerationCriteria: InputCriteria[];
|
|
103
|
+
offererBalancesAndApprovals: BalancesAndApprovals;
|
|
104
|
+
fulfillerBalancesAndApprovals: BalancesAndApprovals;
|
|
105
|
+
timeBasedItemParams: TimeBasedItemParams;
|
|
106
|
+
offererOperator: string;
|
|
107
|
+
fulfillerOperator: string;
|
|
108
|
+
}) => InsufficientApprovals;
|