opensea-js 1.2.7 → 1.2.8-beta.1.2
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 +26 -22
- package/lib/__tests__/api/api.d.ts +1 -0
- package/lib/__tests__/api/api.js +447 -0
- package/lib/__tests__/api/api.js.map +1 -0
- package/lib/__tests__/constants.d.ts +44 -0
- package/lib/__tests__/constants.js +58 -0
- package/lib/__tests__/constants.js.map +1 -0
- package/lib/__tests__/fixtures/orders.json +248 -0
- package/lib/__tests__/seaport/bundles.d.ts +1 -0
- package/lib/__tests__/seaport/bundles.js +680 -0
- package/lib/__tests__/seaport/bundles.js.map +1 -0
- package/lib/__tests__/seaport/fees.d.ts +2 -0
- package/lib/__tests__/seaport/fees.js +461 -0
- package/lib/__tests__/seaport/fees.js.map +1 -0
- package/lib/__tests__/seaport/misc.d.ts +1 -0
- package/lib/__tests__/seaport/misc.js +174 -0
- package/lib/__tests__/seaport/misc.js.map +1 -0
- package/lib/__tests__/seaport/orders.d.ts +2 -0
- package/lib/__tests__/seaport/orders.js +1381 -0
- package/lib/__tests__/seaport/orders.js.map +1 -0
- package/lib/__tests__/seaport/ownersAndTransfers.d.ts +1 -0
- package/lib/__tests__/seaport/ownersAndTransfers.js +480 -0
- package/lib/__tests__/seaport/ownersAndTransfers.js.map +1 -0
- package/lib/__tests__/seaport/staticCall.d.ts +1 -0
- package/lib/__tests__/seaport/staticCall.js +208 -0
- package/lib/__tests__/seaport/staticCall.js.map +1 -0
- package/lib/abi/CanonicalWETH.js +153 -1
- package/lib/abi/CanonicalWETH.js.map +1 -1
- package/lib/abi/CheezeWizardsBasicTournament.js +521 -1
- package/lib/abi/CheezeWizardsBasicTournament.js.map +1 -1
- package/lib/abi/CheezeWizardsGuild.js +446 -1
- package/lib/abi/CheezeWizardsGuild.js.map +1 -1
- package/lib/abi/DecentralandEstates.js +614 -1
- package/lib/abi/DecentralandEstates.js.map +1 -1
- package/lib/abi/ERC1155.js +1505 -1505
- package/lib/abi/ERC1155.js.map +1 -1
- package/lib/abi/ERC20.js +137 -1
- package/lib/abi/ERC20.js.map +1 -1
- package/lib/abi/ERC721v3.js +276 -276
- package/lib/abi/ERC721v3.js.map +1 -1
- package/lib/abi/Proxy.d.ts +27 -2
- package/lib/abi/Proxy.js +26 -2
- package/lib/abi/Proxy.js.map +1 -1
- package/lib/abi/StaticCheckCheezeWizards.js +87 -1
- package/lib/abi/StaticCheckCheezeWizards.js.map +1 -1
- package/lib/abi/StaticCheckDecentralandEstates.js +87 -1
- package/lib/abi/StaticCheckDecentralandEstates.js.map +1 -1
- package/lib/abi/StaticCheckTxOrigin.js +80 -1
- package/lib/abi/StaticCheckTxOrigin.js.map +1 -1
- package/lib/abi/UniswapExchange.js +451 -1
- package/lib/abi/UniswapExchange.js.map +1 -1
- package/lib/abi/UniswapFactory.js +67 -1
- package/lib/abi/UniswapFactory.js.map +1 -1
- package/lib/abi/WrappedNFT.js +305 -1
- package/lib/abi/WrappedNFT.js.map +1 -1
- package/lib/abi/WrappedNFTFactory.js +240 -1
- package/lib/abi/WrappedNFTFactory.js.map +1 -1
- package/lib/abi/WrappedNFTLiquidationProxy.js +135 -1
- package/lib/abi/WrappedNFTLiquidationProxy.js.map +1 -1
- package/lib/api.d.ts +9 -9
- package/lib/api.js +71 -50
- package/lib/api.js.map +1 -1
- package/lib/constants.d.ts +1 -6
- package/lib/constants.js +31 -35
- package/lib/constants.js.map +1 -1
- package/lib/contracts.d.ts +16 -21
- package/lib/contracts.js +3 -16
- package/lib/contracts.js.map +1 -1
- package/lib/debugging.d.ts +3 -3
- package/lib/debugging.js +61 -16
- package/lib/debugging.js.map +1 -1
- package/lib/index.d.ts +7 -6
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/seaport.d.ts +44 -44
- package/lib/seaport.js +1327 -947
- package/lib/seaport.js.map +1 -1
- package/lib/types.d.ts +27 -22
- package/lib/types.js +3 -9
- package/lib/types.js.map +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +15 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/schema.d.ts +6 -6
- package/lib/utils/schema.js +54 -24
- package/lib/utils/schema.js.map +1 -1
- package/lib/utils/utils.d.ts +10 -10
- package/lib/utils/utils.js +206 -169
- package/lib/utils/utils.js.map +1 -1
- package/package.json +76 -57
- package/CHANGELOG.md +0 -47
- package/lib/errors.d.ts +0 -14
- package/lib/errors.js +0 -118
- package/lib/errors.js.map +0 -1
- package/lib/utils.d.ts +0 -192
- package/lib/utils.js +0 -1022
- package/lib/utils.js.map +0 -1
- package/webpack.config.js +0 -52
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
# OpenSea.js <!-- omit in toc -->
|
|
6
6
|
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://coveralls.io/github/ProjectOpenSea/opensea-js?branch=master)
|
|
9
|
+
[](https://github.com/prettier/prettier)
|
|
10
|
+
|
|
8
11
|
<!-- [](https://www.npmjs.com/package/wyvern-js) [](https://www.npmjs.com/package/wyvern-js) -->
|
|
9
12
|
|
|
10
13
|
A JavaScript library for crypto-native ecommerce: buying, selling, and bidding on any cryptogood. With OpenSea.js, you can easily build your own native marketplace for your non-fungible tokens, or NFTs. These can be ERC-721 or ERC-1155 (semi-fungible) items. You don't have to deploy your own smart contracts or backend orderbooks.
|
|
@@ -57,6 +60,7 @@ Happy seafaring! ⛵️
|
|
|
57
60
|
We recommend switching to Node.js version 8.11 to make sure common crypto dependencies work. Execute `nvm use`, if you have Node Version Manager.
|
|
58
61
|
|
|
59
62
|
Then, in your project, run:
|
|
63
|
+
|
|
60
64
|
```bash
|
|
61
65
|
npm install --save opensea-js
|
|
62
66
|
```
|
|
@@ -232,7 +236,9 @@ const offer = await seaport.createBuyOrder({
|
|
|
232
236
|
startAmount: 1.2,
|
|
233
237
|
})
|
|
234
238
|
```
|
|
239
|
+
|
|
235
240
|
#### Offer Limits
|
|
241
|
+
|
|
236
242
|
Note: The total value of buy orders must not exceed 10000 x wallet balance.
|
|
237
243
|
|
|
238
244
|
### Making Listings / Selling Items
|
|
@@ -380,7 +386,7 @@ const transactionHash = await this.props.seaport.fulfillOrder({ order, accountAd
|
|
|
380
386
|
|
|
381
387
|
Note that the `fulfillOrder` promise resolves when the transaction has been confirmed and mined to the blockchain. To get the transaction hash before this happens, add an event listener (see [Listening to Events](#listening-to-events)) for the `TransactionCreated` event.
|
|
382
388
|
|
|
383
|
-
If the order is a sell order (`order.side === OrderSide.Sell`), the taker is the
|
|
389
|
+
If the order is a sell order (`order.side === OrderSide.Sell`), the taker is the _buyer_ and this will prompt the buyer to pay for the item(s).
|
|
384
390
|
|
|
385
391
|
### Accepting Offers
|
|
386
392
|
|
|
@@ -392,7 +398,7 @@ const accountAddress = "0x..." // The owner's wallet address, also the taker
|
|
|
392
398
|
await this.props.seaport.fulfillOrder({ order, accountAddress })
|
|
393
399
|
```
|
|
394
400
|
|
|
395
|
-
If the order is a buy order (`order.side === OrderSide.Buy`), then the taker is the
|
|
401
|
+
If the order is a buy order (`order.side === OrderSide.Buy`), then the taker is the _owner_ and this will prompt the owner to exchange their item(s) for whatever is being offered in return. See [Listening to Events](#listening-to-events) below to respond to the setup transactions that occur the first time a user accepts a bid.
|
|
396
402
|
|
|
397
403
|
### Transferring Items or Coins (Gifting)
|
|
398
404
|
|
|
@@ -477,7 +483,7 @@ await this.props.seaport.fulfillOrder({
|
|
|
477
483
|
})
|
|
478
484
|
```
|
|
479
485
|
|
|
480
|
-
If the order is a sell order (`order.side === OrderSide.Sell`), the taker is the
|
|
486
|
+
If the order is a sell order (`order.side === OrderSide.Sell`), the taker is the _buyer_ and this will prompt the buyer to pay for the item(s) but send them to the `recipientAddress`. If the order is a buy order ( `OrderSide.Buy`), the taker is the _seller_ but the bid amount be sent to the `recipientAddress`.
|
|
481
487
|
|
|
482
488
|
### Bulk Transfers
|
|
483
489
|
|
|
@@ -550,9 +556,9 @@ const order = await seaport.api.getOrders({
|
|
|
550
556
|
|
|
551
557
|
**Fun note:** soon, all ERC-20 tokens will be allowed! This will mean you can create crazy offers on crypto collectibles **using your own ERC-20 token**. However, opensea.io will only display offers and auctions in ERC-20 tokens that it knows about, optimizing the user experience of order takers. Orders made with the following tokens will be shown on OpenSea:
|
|
552
558
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
559
|
+
- MANA, Decentraland's currency: https://etherscan.io/token/0x0f5d2fb29fb7d3cfee444a200298f468908cc942
|
|
560
|
+
- DAI, Maker's stablecoin, pegged to $1 USD: https://etherscan.io/token/0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359
|
|
561
|
+
- And tons more! See the "Currencies" list in the sidebar on https://opensea.io/assets for a full list, or contact us to add yours: [Discord](https://discord.gg/ga8EJbv)
|
|
556
562
|
|
|
557
563
|
### Private Auctions
|
|
558
564
|
|
|
@@ -573,10 +579,9 @@ const listing = await seaport.createSellOrder({
|
|
|
573
579
|
})
|
|
574
580
|
```
|
|
575
581
|
|
|
576
|
-
|
|
577
582
|
### Sharing Sale Fees with OpenSea
|
|
578
583
|
|
|
579
|
-
We share fees for successful sales with game developers, relayers, and affiliates using the OpenSea orderbook. Developers can customize the fee amount to apply to
|
|
584
|
+
We share fees for successful sales with game developers, relayers, and affiliates using the OpenSea orderbook. Developers can customize the fee amount to apply to buyers and/or sellers.
|
|
580
585
|
|
|
581
586
|
See [Affiliate Program](#affiliate-program) above for how to register referrers for sales.
|
|
582
587
|
|
|
@@ -705,6 +710,7 @@ npm run build
|
|
|
705
710
|
```
|
|
706
711
|
|
|
707
712
|
Or run the tests:
|
|
713
|
+
|
|
708
714
|
```bash
|
|
709
715
|
npm test
|
|
710
716
|
```
|
|
@@ -714,18 +720,9 @@ Note that the tests require access to both Infura and the OpenSea API. The timeo
|
|
|
714
720
|
**Generate Documentation**
|
|
715
721
|
|
|
716
722
|
Generate html docs, also available for browsing [here](https://projectopensea.github.io/opensea-js/):
|
|
717
|
-
```bash
|
|
718
|
-
npm run docsHtml
|
|
719
|
-
```
|
|
720
|
-
|
|
721
|
-
Or generate markdown docs available for browsing on git repos:
|
|
722
|
-
```bash
|
|
723
|
-
npm run docsMarkdown
|
|
724
|
-
```
|
|
725
723
|
|
|
726
|
-
Due to a markdown theme typescript issue, `docs` just generates html docs right now:
|
|
727
724
|
```bash
|
|
728
|
-
|
|
725
|
+
yarn docs-build
|
|
729
726
|
```
|
|
730
727
|
|
|
731
728
|
**Contributing**
|
|
@@ -734,10 +731,17 @@ Contributions welcome! Please use GitHub issues for suggestions/concerns - if yo
|
|
|
734
731
|
|
|
735
732
|
## Diagnosing Common Issues
|
|
736
733
|
|
|
737
|
-
|
|
734
|
+
- Is the `expirationTime` in the future? If not, change it to a time in the future.
|
|
738
735
|
|
|
739
|
-
|
|
736
|
+
- Are the input addresses all strings? If not, convert them to strings.
|
|
740
737
|
|
|
741
|
-
|
|
738
|
+
- Is your computer's internal clock accurate? If not, try enabling automatic clock adjustment locally or following [this tutorial](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html) to update an Amazon EC2 instance.
|
|
742
739
|
|
|
743
|
-
|
|
740
|
+
- Are you attempting to purchase a token that's unpurchasable on [OpenSea](https://opensea.io/)? If so, contact us [Discord](https://discord.gg/XjwWYgU) in the `#developers` channel and we'll help diagnose the issue.
|
|
741
|
+
|
|
742
|
+
## Testing your branch locally
|
|
743
|
+
|
|
744
|
+
```sh
|
|
745
|
+
yarn link # in opensea-js repo
|
|
746
|
+
yarn link opensea-js # in repo you're working on
|
|
747
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
26
|
+
if (mod && mod.__esModule) return mod;
|
|
27
|
+
var result = {};
|
|
28
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
29
|
+
__setModuleDefault(result, mod);
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
32
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
33
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
34
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
35
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
36
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
37
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
38
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
42
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
43
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
44
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
45
|
+
function step(op) {
|
|
46
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
47
|
+
while (_) try {
|
|
48
|
+
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;
|
|
49
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
50
|
+
switch (op[0]) {
|
|
51
|
+
case 0: case 1: t = op; break;
|
|
52
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
53
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
54
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
55
|
+
default:
|
|
56
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
57
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
58
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
59
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
60
|
+
if (t[2]) _.ops.pop();
|
|
61
|
+
_.trys.pop(); continue;
|
|
62
|
+
}
|
|
63
|
+
op = body.call(thisArg, _);
|
|
64
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
65
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
|
+
var chai_1 = require("chai");
|
|
70
|
+
var mocha_1 = require("mocha");
|
|
71
|
+
var Web3 = __importStar(require("web3"));
|
|
72
|
+
var wyvern_js_1 = require("wyvern-js");
|
|
73
|
+
var constants_1 = require("../../constants");
|
|
74
|
+
var index_1 = require("../../index");
|
|
75
|
+
var types_1 = require("../../types");
|
|
76
|
+
var utils_1 = require("../../utils/utils");
|
|
77
|
+
var constants_2 = require("../constants");
|
|
78
|
+
var provider = new Web3.providers.HttpProvider(constants_1.MAINNET_PROVIDER_URL);
|
|
79
|
+
var client = new index_1.OpenSeaPort(provider, {
|
|
80
|
+
networkName: types_1.Network.Main,
|
|
81
|
+
apiKey: constants_2.MAINNET_API_KEY,
|
|
82
|
+
}, function (line) { return console.info("MAINNET: ".concat(line)); });
|
|
83
|
+
(0, mocha_1.suite)("api", function () {
|
|
84
|
+
(0, mocha_1.test)("API has correct base url", function () {
|
|
85
|
+
chai_1.assert.equal(constants_2.mainApi.apiBaseUrl, "https://api.opensea.io");
|
|
86
|
+
chai_1.assert.equal(constants_2.rinkebyApi.apiBaseUrl, "https://testnets-api.opensea.io");
|
|
87
|
+
});
|
|
88
|
+
(0, mocha_1.test)("API fetches bundles and prefetches sell orders", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
+
var bundles, bundle;
|
|
90
|
+
return __generator(this, function (_a) {
|
|
91
|
+
switch (_a.label) {
|
|
92
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getBundles({
|
|
93
|
+
asset_contract_address: constants_2.CK_RINKEBY_ADDRESS,
|
|
94
|
+
})];
|
|
95
|
+
case 1:
|
|
96
|
+
bundles = (_a.sent()).bundles;
|
|
97
|
+
chai_1.assert.isArray(bundles);
|
|
98
|
+
bundle = bundles[0];
|
|
99
|
+
chai_1.assert.isNotNull(bundle);
|
|
100
|
+
if (!bundle) {
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
chai_1.assert.include(bundle.assets.map(function (a) { return a.assetContract.name; }), "CryptoKittiesRinkeby");
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}); });
|
|
108
|
+
(0, mocha_1.test)("Includes API key in token request", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
109
|
+
var oldLogger, logPromise;
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
switch (_a.label) {
|
|
112
|
+
case 0:
|
|
113
|
+
oldLogger = constants_2.rinkebyApi.logger;
|
|
114
|
+
logPromise = new Promise(function (resolve, reject) {
|
|
115
|
+
constants_2.rinkebyApi.logger = function (log) {
|
|
116
|
+
try {
|
|
117
|
+
chai_1.assert.include(log, "\"X-API-KEY\":\"".concat(constants_2.RINKEBY_API_KEY, "\""));
|
|
118
|
+
resolve();
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
reject(e);
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
124
|
+
constants_2.rinkebyApi.logger = oldLogger;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
constants_2.rinkebyApi.getPaymentTokens({ symbol: "WETH" });
|
|
128
|
+
});
|
|
129
|
+
return [4 /*yield*/, logPromise];
|
|
130
|
+
case 1:
|
|
131
|
+
_a.sent();
|
|
132
|
+
return [2 /*return*/];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}); });
|
|
136
|
+
(0, mocha_1.test)("An API asset's order has correct hash", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
137
|
+
var asset, order;
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
switch (_a.label) {
|
|
140
|
+
case 0: return [4 /*yield*/, constants_2.mainApi.getAsset({
|
|
141
|
+
tokenAddress: constants_2.CK_ADDRESS,
|
|
142
|
+
tokenId: 1,
|
|
143
|
+
})];
|
|
144
|
+
case 1:
|
|
145
|
+
asset = _a.sent();
|
|
146
|
+
chai_1.assert.isNotNull(asset.orders);
|
|
147
|
+
if (!asset.orders) {
|
|
148
|
+
return [2 /*return*/];
|
|
149
|
+
}
|
|
150
|
+
order = asset.orders[0];
|
|
151
|
+
chai_1.assert.isNotNull(order);
|
|
152
|
+
if (!order) {
|
|
153
|
+
return [2 /*return*/];
|
|
154
|
+
}
|
|
155
|
+
chai_1.assert.equal(order.hash, (0, utils_1.getOrderHash)(order));
|
|
156
|
+
return [2 /*return*/];
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}); });
|
|
160
|
+
(0, mocha_1.test)("orderToJSON is correct", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
161
|
+
var accountAddress, quantity, amountInToken, paymentTokenAddress, extraBountyBasisPoints, expirationTime, englishAuctionReservePrice, tokenId, tokenAddress, order, hashedOrder, orderData;
|
|
162
|
+
return __generator(this, function (_a) {
|
|
163
|
+
switch (_a.label) {
|
|
164
|
+
case 0:
|
|
165
|
+
accountAddress = constants_2.ALEX_ADDRESS;
|
|
166
|
+
quantity = 1;
|
|
167
|
+
amountInToken = 1.2;
|
|
168
|
+
paymentTokenAddress = constants_2.WETH_ADDRESS;
|
|
169
|
+
extraBountyBasisPoints = 0;
|
|
170
|
+
expirationTime = Math.round(Date.now() / 1000 + 60);
|
|
171
|
+
englishAuctionReservePrice = 2;
|
|
172
|
+
tokenId = constants_2.MYTHEREUM_TOKEN_ID.toString();
|
|
173
|
+
tokenAddress = constants_2.MYTHEREUM_ADDRESS;
|
|
174
|
+
return [4 /*yield*/, client._makeSellOrder({
|
|
175
|
+
asset: { tokenAddress: tokenAddress, tokenId: tokenId },
|
|
176
|
+
quantity: quantity,
|
|
177
|
+
accountAddress: accountAddress,
|
|
178
|
+
startAmount: amountInToken,
|
|
179
|
+
paymentTokenAddress: paymentTokenAddress,
|
|
180
|
+
extraBountyBasisPoints: extraBountyBasisPoints,
|
|
181
|
+
buyerAddress: constants_1.NULL_ADDRESS,
|
|
182
|
+
expirationTime: expirationTime,
|
|
183
|
+
waitForHighestBid: true,
|
|
184
|
+
englishAuctionReservePrice: englishAuctionReservePrice,
|
|
185
|
+
})];
|
|
186
|
+
case 1:
|
|
187
|
+
order = _a.sent();
|
|
188
|
+
hashedOrder = __assign(__assign({}, order), { hash: (0, utils_1.getOrderHash)(order) });
|
|
189
|
+
orderData = (0, index_1.orderToJSON)(hashedOrder);
|
|
190
|
+
chai_1.assert.equal(orderData.quantity, quantity.toString());
|
|
191
|
+
chai_1.assert.equal(orderData.maker, accountAddress);
|
|
192
|
+
chai_1.assert.equal(orderData.taker, constants_1.NULL_ADDRESS);
|
|
193
|
+
chai_1.assert.equal(orderData.basePrice, wyvern_js_1.WyvernProtocol.toBaseUnitAmount((0, utils_1.makeBigNumber)(amountInToken), 18).toString());
|
|
194
|
+
chai_1.assert.equal(orderData.paymentToken, paymentTokenAddress);
|
|
195
|
+
chai_1.assert.equal(orderData.extra, extraBountyBasisPoints.toString());
|
|
196
|
+
chai_1.assert.equal(orderData.expirationTime, expirationTime + constants_1.ORDER_MATCHING_LATENCY_SECONDS);
|
|
197
|
+
chai_1.assert.equal(orderData.englishAuctionReservePrice, wyvern_js_1.WyvernProtocol.toBaseUnitAmount((0, utils_1.makeBigNumber)(englishAuctionReservePrice), 18).toString());
|
|
198
|
+
return [2 /*return*/];
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}); });
|
|
202
|
+
(0, mocha_1.test)("API fetches tokens", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
+
var tokens;
|
|
204
|
+
return __generator(this, function (_a) {
|
|
205
|
+
switch (_a.label) {
|
|
206
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getPaymentTokens({ symbol: "MANA" })];
|
|
207
|
+
case 1:
|
|
208
|
+
tokens = (_a.sent()).tokens;
|
|
209
|
+
chai_1.assert.isArray(tokens);
|
|
210
|
+
chai_1.assert.equal(tokens.length, 1);
|
|
211
|
+
chai_1.assert.equal(tokens[0].name, "Decentraland MANA");
|
|
212
|
+
return [2 /*return*/];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}); });
|
|
216
|
+
(0, mocha_1.test)("Rinkeby API orders have correct OpenSea url", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
217
|
+
var order, url;
|
|
218
|
+
return __generator(this, function (_a) {
|
|
219
|
+
switch (_a.label) {
|
|
220
|
+
case 0: return [4 /*yield*/, constants_2.rinkebyApi.getOrder({})];
|
|
221
|
+
case 1:
|
|
222
|
+
order = _a.sent();
|
|
223
|
+
if (!order.asset) {
|
|
224
|
+
return [2 /*return*/];
|
|
225
|
+
}
|
|
226
|
+
url = "https://testnets.opensea.io/assets/".concat(order.asset.assetContract.address, "/").concat(order.asset.tokenId);
|
|
227
|
+
chai_1.assert.equal(order.asset.openseaLink, url);
|
|
228
|
+
return [2 /*return*/];
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
}); });
|
|
232
|
+
(0, mocha_1.test)("Mainnet API orders have correct OpenSea url", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
233
|
+
var order, url;
|
|
234
|
+
return __generator(this, function (_a) {
|
|
235
|
+
switch (_a.label) {
|
|
236
|
+
case 0: return [4 /*yield*/, constants_2.mainApi.getOrder({})];
|
|
237
|
+
case 1:
|
|
238
|
+
order = _a.sent();
|
|
239
|
+
if (!order.asset) {
|
|
240
|
+
return [2 /*return*/];
|
|
241
|
+
}
|
|
242
|
+
url = "https://opensea.io/assets/".concat(order.asset.assetContract.address, "/").concat(order.asset.tokenId);
|
|
243
|
+
chai_1.assert.equal(order.asset.openseaLink, url);
|
|
244
|
+
return [2 /*return*/];
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}); });
|
|
248
|
+
(0, mocha_1.test)("API fetches orderbook", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
249
|
+
var _a, orders, count;
|
|
250
|
+
return __generator(this, function (_b) {
|
|
251
|
+
switch (_b.label) {
|
|
252
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getOrders()];
|
|
253
|
+
case 1:
|
|
254
|
+
_a = _b.sent(), orders = _a.orders, count = _a.count;
|
|
255
|
+
chai_1.assert.isArray(orders);
|
|
256
|
+
chai_1.assert.isNumber(count);
|
|
257
|
+
chai_1.assert.equal(orders.length, constants_2.apiToTest.pageSize);
|
|
258
|
+
return [2 /*return*/];
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}); });
|
|
262
|
+
(0, mocha_1.test)("API can change page size", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
263
|
+
var defaultPageSize, orders;
|
|
264
|
+
return __generator(this, function (_a) {
|
|
265
|
+
switch (_a.label) {
|
|
266
|
+
case 0:
|
|
267
|
+
defaultPageSize = constants_2.apiToTest.pageSize;
|
|
268
|
+
constants_2.apiToTest.pageSize = 7;
|
|
269
|
+
return [4 /*yield*/, constants_2.apiToTest.getOrders()];
|
|
270
|
+
case 1:
|
|
271
|
+
orders = (_a.sent()).orders;
|
|
272
|
+
chai_1.assert.equal(orders.length, 7);
|
|
273
|
+
constants_2.apiToTest.pageSize = defaultPageSize;
|
|
274
|
+
return [2 /*return*/];
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}); });
|
|
278
|
+
if (constants_1.ORDERBOOK_VERSION > 0) {
|
|
279
|
+
(0, mocha_1.test)("API orderbook paginates", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
280
|
+
var _a, orders, count, pagination;
|
|
281
|
+
return __generator(this, function (_b) {
|
|
282
|
+
switch (_b.label) {
|
|
283
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getOrders()];
|
|
284
|
+
case 1:
|
|
285
|
+
_a = _b.sent(), orders = _a.orders, count = _a.count;
|
|
286
|
+
return [4 /*yield*/, constants_2.apiToTest.getOrders({}, 2)];
|
|
287
|
+
case 2:
|
|
288
|
+
pagination = _b.sent();
|
|
289
|
+
chai_1.assert.equal(pagination.orders.length, constants_2.apiToTest.pageSize);
|
|
290
|
+
chai_1.assert.notDeepEqual(pagination.orders[0], orders[0]);
|
|
291
|
+
chai_1.assert.equal(pagination.count, count);
|
|
292
|
+
return [2 /*return*/];
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}); });
|
|
296
|
+
}
|
|
297
|
+
(0, mocha_1.test)("API fetches orders for asset", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
298
|
+
var forKitty;
|
|
299
|
+
return __generator(this, function (_a) {
|
|
300
|
+
switch (_a.label) {
|
|
301
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getOrders({
|
|
302
|
+
asset_contract_address: constants_2.CK_RINKEBY_ADDRESS,
|
|
303
|
+
token_id: constants_2.CK_RINKEBY_TOKEN_ID,
|
|
304
|
+
})];
|
|
305
|
+
case 1:
|
|
306
|
+
forKitty = _a.sent();
|
|
307
|
+
chai_1.assert.isArray(forKitty.orders);
|
|
308
|
+
return [2 /*return*/];
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}); });
|
|
312
|
+
(0, mocha_1.test)("API fetches orders for asset owner", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
313
|
+
var forOwner, owners;
|
|
314
|
+
return __generator(this, function (_a) {
|
|
315
|
+
switch (_a.label) {
|
|
316
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getOrders({ owner: constants_2.ALEX_ADDRESS })];
|
|
317
|
+
case 1:
|
|
318
|
+
forOwner = _a.sent();
|
|
319
|
+
chai_1.assert.isAbove(forOwner.orders.length, 0);
|
|
320
|
+
chai_1.assert.isAbove(forOwner.count, 0);
|
|
321
|
+
owners = forOwner.orders.map(function (o) { return o.asset && o.asset.owner && o.asset.owner.address; });
|
|
322
|
+
owners.forEach(function (owner) {
|
|
323
|
+
chai_1.assert.include([constants_2.ALEX_ADDRESS, constants_1.NULL_ADDRESS], owner);
|
|
324
|
+
});
|
|
325
|
+
return [2 /*return*/];
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}); });
|
|
329
|
+
(0, mocha_1.test)("API fetches buy orders for maker", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
330
|
+
var forMaker;
|
|
331
|
+
return __generator(this, function (_a) {
|
|
332
|
+
switch (_a.label) {
|
|
333
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getOrders({
|
|
334
|
+
maker: "0x5a237d6ce6d1fa3766fc15256cbfb8bdcf5a5b8a",
|
|
335
|
+
side: types_1.OrderSide.Buy,
|
|
336
|
+
})];
|
|
337
|
+
case 1:
|
|
338
|
+
forMaker = _a.sent();
|
|
339
|
+
chai_1.assert.isAbove(forMaker.orders.length, 0);
|
|
340
|
+
chai_1.assert.isAbove(forMaker.count, 0);
|
|
341
|
+
forMaker.orders.forEach(function (order) {
|
|
342
|
+
chai_1.assert.equal("0x5a237d6ce6d1fa3766fc15256cbfb8bdcf5a5b8a", order.maker);
|
|
343
|
+
chai_1.assert.equal(types_1.OrderSide.Buy, order.side);
|
|
344
|
+
});
|
|
345
|
+
return [2 /*return*/];
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}); });
|
|
349
|
+
(0, mocha_1.test)("API excludes cancelledOrFinalized and markedInvalid orders", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
350
|
+
var orders, finishedOrders, invalidOrders;
|
|
351
|
+
return __generator(this, function (_a) {
|
|
352
|
+
switch (_a.label) {
|
|
353
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getOrders({ limit: 50 })];
|
|
354
|
+
case 1:
|
|
355
|
+
orders = (_a.sent()).orders;
|
|
356
|
+
finishedOrders = orders.filter(function (o) { return o.cancelledOrFinalized; });
|
|
357
|
+
chai_1.assert.isEmpty(finishedOrders);
|
|
358
|
+
invalidOrders = orders.filter(function (o) { return o.markedInvalid; });
|
|
359
|
+
chai_1.assert.isEmpty(invalidOrders);
|
|
360
|
+
return [2 /*return*/];
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
}); });
|
|
364
|
+
(0, mocha_1.test)("API fetches fees for an asset", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
365
|
+
var asset;
|
|
366
|
+
return __generator(this, function (_a) {
|
|
367
|
+
switch (_a.label) {
|
|
368
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getAsset({
|
|
369
|
+
tokenAddress: constants_2.CK_RINKEBY_ADDRESS,
|
|
370
|
+
tokenId: constants_2.CK_RINKEBY_TOKEN_ID,
|
|
371
|
+
})];
|
|
372
|
+
case 1:
|
|
373
|
+
asset = _a.sent();
|
|
374
|
+
chai_1.assert.equal(asset.tokenId, constants_2.CK_RINKEBY_TOKEN_ID.toString());
|
|
375
|
+
chai_1.assert.equal(asset.assetContract.name, "CryptoKittiesRinkeby");
|
|
376
|
+
chai_1.assert.equal(asset.assetContract.sellerFeeBasisPoints, constants_2.CK_RINKEBY_SELLER_FEE);
|
|
377
|
+
return [2 /*return*/];
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}); });
|
|
381
|
+
(0, mocha_1.test)("API fetches assets", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
382
|
+
var assets, asset;
|
|
383
|
+
return __generator(this, function (_a) {
|
|
384
|
+
switch (_a.label) {
|
|
385
|
+
case 0: return [4 /*yield*/, constants_2.apiToTest.getAssets({
|
|
386
|
+
asset_contract_address: constants_2.CK_RINKEBY_ADDRESS,
|
|
387
|
+
order_by: "sale_date",
|
|
388
|
+
})];
|
|
389
|
+
case 1:
|
|
390
|
+
assets = (_a.sent()).assets;
|
|
391
|
+
chai_1.assert.isArray(assets);
|
|
392
|
+
chai_1.assert.equal(assets.length, constants_2.apiToTest.pageSize);
|
|
393
|
+
asset = assets[0];
|
|
394
|
+
chai_1.assert.equal(asset.assetContract.name, "CryptoKittiesRinkeby");
|
|
395
|
+
return [2 /*return*/];
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
}); });
|
|
399
|
+
(0, mocha_1.test)("API handles errors", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
400
|
+
var error_1, error_2, res, order, newOrder, error_3;
|
|
401
|
+
return __generator(this, function (_a) {
|
|
402
|
+
switch (_a.label) {
|
|
403
|
+
case 0:
|
|
404
|
+
_a.trys.push([0, 2, , 3]);
|
|
405
|
+
return [4 /*yield*/, constants_2.apiToTest.get("/user")];
|
|
406
|
+
case 1:
|
|
407
|
+
_a.sent();
|
|
408
|
+
return [3 /*break*/, 3];
|
|
409
|
+
case 2:
|
|
410
|
+
error_1 = _a.sent();
|
|
411
|
+
chai_1.assert.include(error_1.message, "Unauthorized");
|
|
412
|
+
return [3 /*break*/, 3];
|
|
413
|
+
case 3:
|
|
414
|
+
_a.trys.push([3, 5, , 6]);
|
|
415
|
+
return [4 /*yield*/, constants_2.apiToTest.get("/asset/".concat(constants_2.CK_RINKEBY_ADDRESS, "/0"))];
|
|
416
|
+
case 4:
|
|
417
|
+
_a.sent();
|
|
418
|
+
return [3 /*break*/, 6];
|
|
419
|
+
case 5:
|
|
420
|
+
error_2 = _a.sent();
|
|
421
|
+
chai_1.assert.include(error_2.message, "Not found");
|
|
422
|
+
return [3 /*break*/, 6];
|
|
423
|
+
case 6: return [4 /*yield*/, constants_2.apiToTest.getOrders({
|
|
424
|
+
// Get an old order to make sure listing time is too early
|
|
425
|
+
listed_before: Math.round(Date.now() / 1000 - 3600),
|
|
426
|
+
})];
|
|
427
|
+
case 7:
|
|
428
|
+
res = _a.sent();
|
|
429
|
+
order = res.orders[0];
|
|
430
|
+
chai_1.assert.isNotNull(order);
|
|
431
|
+
_a.label = 8;
|
|
432
|
+
case 8:
|
|
433
|
+
_a.trys.push([8, 10, , 11]);
|
|
434
|
+
newOrder = __assign(__assign({}, (0, index_1.orderToJSON)(order)), { v: 1, r: "", s: "" });
|
|
435
|
+
return [4 /*yield*/, constants_2.apiToTest.postOrder(newOrder)];
|
|
436
|
+
case 9:
|
|
437
|
+
_a.sent();
|
|
438
|
+
return [3 /*break*/, 11];
|
|
439
|
+
case 10:
|
|
440
|
+
error_3 = _a.sent();
|
|
441
|
+
return [3 /*break*/, 11];
|
|
442
|
+
case 11: return [2 /*return*/];
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
}); });
|
|
446
|
+
});
|
|
447
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/__tests__/api/api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA8B;AAC9B,+BAAoC;AACpC,yCAA6B;AAC7B,uCAA2C;AAC3C,6CAKyB;AACzB,qCAAuD;AACvD,qCAAiD;AACjD,2CAAgE;AAChE,0CAcsB;AAEtB,IAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,gCAAoB,CAAC,CAAC;AAEvE,IAAM,MAAM,GAAG,IAAI,mBAAW,CAC5B,QAAQ,EACR;IACE,WAAW,EAAE,eAAO,CAAC,IAAI;IACzB,MAAM,EAAE,2BAAe;CACxB,EACD,UAAC,IAAI,IAAK,OAAA,OAAO,CAAC,IAAI,CAAC,mBAAY,IAAI,CAAE,CAAC,EAAhC,CAAgC,CAC3C,CAAC;AAEF,IAAA,aAAK,EAAC,KAAK,EAAE;IACX,IAAA,YAAI,EAAC,0BAA0B,EAAE;QAC/B,aAAM,CAAC,KAAK,CAAC,mBAAO,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC;QAC3D,aAAM,CAAC,KAAK,CAAC,sBAAU,CAAC,UAAU,EAAE,iCAAiC,CAAC,CAAC;IACzE,CAAC,CAAC,CAAC;IAEH,IAAA,YAAI,EAAC,gDAAgD,EAAE;;;;wBACjC,qBAAM,qBAAS,CAAC,UAAU,CAAC;wBAC7C,sBAAsB,EAAE,8BAAkB;qBAC3C,CAAC,EAAA;;oBAFM,OAAO,GAAK,CAAA,SAElB,CAAA,QAFa;oBAGf,aAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;oBAEl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qBAAM,qBAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAA;;oBAAnC,SAAmC,CAAC;;;;;;;;SAKvC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { OpenSeaAPI } from "../api";
|
|
2
|
+
import { CK_ADDRESS, CK_RINKEBY_ADDRESS } from "../constants";
|
|
3
|
+
export declare const MAINNET_API_KEY: string | undefined;
|
|
4
|
+
export declare const RINKEBY_API_KEY: string | undefined;
|
|
5
|
+
export declare const mainApi: OpenSeaAPI;
|
|
6
|
+
export declare const rinkebyApi: OpenSeaAPI;
|
|
7
|
+
export declare const apiToTest: OpenSeaAPI;
|
|
8
|
+
export { CK_ADDRESS, CK_RINKEBY_ADDRESS };
|
|
9
|
+
export declare const GODS_UNCHAINED_ADDRESS = "0x6ebeaf8e8e946f0716e6533a6f2cefc83f60e8ab";
|
|
10
|
+
export declare const DIGITAL_ART_CHAIN_ADDRESS = "0x323a3e1693e7a0959f65972f3bf2dfcb93239dfe";
|
|
11
|
+
export declare const MYTHEREUM_ADDRESS = "0xc70be5b7c19529ef642d16c10dfe91c58b5c3bf0";
|
|
12
|
+
export declare const MYTHEREUM_SLUG = "mythereum";
|
|
13
|
+
export declare const DIGITAL_ART_CHAIN_TOKEN_ID = 189;
|
|
14
|
+
export declare const GODS_UNCHAINED_TOKEN_ID = 76719;
|
|
15
|
+
export declare const MYTHEREUM_TOKEN_ID = 4367;
|
|
16
|
+
export declare const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
|
|
17
|
+
export declare const ENS_RINKEBY_TOKEN_ADDRESS = "0x53ceb15b76023fbec5bb39450214926f6aa77d2e";
|
|
18
|
+
export declare const ENS_RINKEBY_SHORT_NAME_OWNER = "0xe0ee13cd5a45e7fa140409edfc9ce17c7b11e6d2";
|
|
19
|
+
export declare const ENS_HELLO_TOKEN_ID = "12910348618308260923200348219926901280687058984330794534952861439530514639560";
|
|
20
|
+
export declare const ENS_HELLO_NAME = "hello";
|
|
21
|
+
export declare const CK_RINKEBY_TOKEN_ID = 1068;
|
|
22
|
+
export declare const CK_TOKEN_ID = 637488;
|
|
23
|
+
export declare const CK_RINKEBY_SELLER_FEE = 250;
|
|
24
|
+
export declare const CATS_IN_MECHS_ID = "11081664790290028159747096595969945056246807881612483124155840544084353614722";
|
|
25
|
+
export declare const AGE_OF_RUST_TOKEN_ID = "10855508365998404086189256032722001339622921863551706494238735756561045520384";
|
|
26
|
+
export declare const CRYPTOVOXELS_WEARABLE_ADDRESS = "0xa58b5224e2fd94020cb2837231b2b0e4247301a6";
|
|
27
|
+
export declare const CRYPTOVOXELS_WEARABLE_ID = "908";
|
|
28
|
+
export declare const CRYPTOVOXELS_WEARABLE_2_ID = "693";
|
|
29
|
+
export declare const DECENTRALAND_ADDRESS = "0xf87e31492faf9a91b02ee0deaad50d51d56d5d4d";
|
|
30
|
+
export declare const DECENTRALAND_ID = "115792089237316195423570985008687907840339254722644902427849348925505937604680";
|
|
31
|
+
export declare const DISSOLUTION_TOKEN_ID = "39803530675327460487158288219684256433559304725576879659134376004308812431360";
|
|
32
|
+
export declare const CRYPTOFLOWERS_CONTRACT_ADDRESS_WITH_BUYER_FEE = "0x8bc67d00253fd60b1afcce88b78820413139f4c6";
|
|
33
|
+
export declare const SANDBOX_RINKEBY_ADDRESS = "0xcdeadfb2caa81d8c16d2935f3e379dda61242be9";
|
|
34
|
+
export declare const SANDBOX_RINKEBY_ID = "44221324190444972628403853229966997983936414854632412290085204005353951330306";
|
|
35
|
+
export declare const SPIRIT_CLASH_TOKEN_ID = "10855508365998412378240648478527290366700749920879042165450277893550637056000";
|
|
36
|
+
export declare const SPIRIT_CLASH_OWNER = "0x6a846239658f5a16a0b5977e1c0d007bc13267f0";
|
|
37
|
+
export declare const BENZENE_ADDRESS = "0x6524b87960c2d573ae514fd4181777e7842435d4";
|
|
38
|
+
export declare const GODS_UNCHAINED_CHEST_ADDRESS = "0xee85966b4974d3c6f71a2779cc3b6f53afbc2b68";
|
|
39
|
+
export declare const ALEX_ADDRESS = "0xe96a1b303a1eb8d04fb973eb2b291b8d591c8f72";
|
|
40
|
+
export declare const RANDOM_ADDRESS = "0x196a1b303a1eb8d04fb973eb2b291b8d591c8f72";
|
|
41
|
+
export declare const ALEX_ADDRESS_2 = "0x431e44389a003f0ec6e83b3578db5075a44ac523";
|
|
42
|
+
export declare const DEVIN_ADDRESS = "0x0239769a1adf4def9f07da824b80b9c4fcb59593";
|
|
43
|
+
export declare const DAN_ADDRESS = "0x530cf036ed4fa58f7301a9c788c9806624cefd19";
|
|
44
|
+
export declare const DAN_DAPPER_ADDRESS = "0x4819352bd7fadcCFAA8A2cDA4b2825a9ec51417c";
|