@imtbl/blockchain-data 2.0.0-alpha.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/LICENSE.md +176 -0
- package/README.md +58 -0
- package/dist/browser/index.js +2 -0
- package/dist/node/index.cjs +2 -0
- package/dist/node/index.js +2 -0
- package/dist/types/blockchain-data.d.ts +252 -0
- package/dist/types/config/config.test.d.ts +1 -0
- package/dist/types/config/index.d.ts +19 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/types/errors.d.ts +20 -0
- package/dist/types/utils/formatErrors.d.ts +7 -0
- package/package.json +59 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# About
|
|
2
|
+
|
|
3
|
+
The Blockchain Data SDK provides a set of wrapper functions for interacting with the Immutable Blockchain Data APIs. It provides a simple and easy-to-use interface for querying blockchain data, such as assets, orders, and trades.
|
|
4
|
+
|
|
5
|
+
[Read more about the Blockchain Data APIs in our docs here](https://docs.immutable.com/docs/zkEVM/products/blockchain-data).
|
|
6
|
+
|
|
7
|
+
# Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Usage](#usage)
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [Individual Package Installation](#individual-package-installation)
|
|
12
|
+
- [SDK Installation](#sdk-installation)
|
|
13
|
+
- [Conditional Exports](#conditional-exports)
|
|
14
|
+
- [Direct Imports](#direct-imports)
|
|
15
|
+
|
|
16
|
+
# Usage
|
|
17
|
+
|
|
18
|
+
You can find an example usage of this package in the example set up [here](https://github.com/immutable/ts-immutable-sdk/tree/main/examples/blockchain-data)
|
|
19
|
+
|
|
20
|
+
# Installation
|
|
21
|
+
|
|
22
|
+
## Individual Package Installation
|
|
23
|
+
|
|
24
|
+
To install this package, run the following command:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm add @imtbl/blockchain-data
|
|
28
|
+
# or
|
|
29
|
+
yarn add @imtbl/blockchain-data
|
|
30
|
+
# or
|
|
31
|
+
pnpm add @imtbl/blockchain-data
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## SDK Installation
|
|
35
|
+
|
|
36
|
+
This package is also included within the [`@imtbl/sdk` NPM package](https://www.npmjs.com/package/@imtbl/sdk) and can be re-exported directly from there.
|
|
37
|
+
|
|
38
|
+
### Conditional Exports
|
|
39
|
+
|
|
40
|
+
If your environment supports conditional exports, you can import the contents of this package directly from the `@imtbl/sdk` package using the `@imtbl/sdk/blockchain_data` import path like so:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { APIError, BlockchainData } from '@imtbl/sdk/blockchain_data';
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
This is the recommended way of consuming this package, as it allows for better tree-shaking and smaller bundle sizes.
|
|
47
|
+
|
|
48
|
+
### Direct Imports
|
|
49
|
+
|
|
50
|
+
If your environment does not support conditional exports, you will need to import the contents of this package directly from the `@imtbl/sdk` package like so:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { blockchainData } from '@imtbl/sdk';
|
|
54
|
+
|
|
55
|
+
const { APIError, BlockchainData } = blockchainData;
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
However this method will result in a larger bundle size as the entire `@imtbl/blockchain-data` package will be included in your bundle.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {mr}from'@imtbl/generated-clients';export{BlockchainData as Types}from'@imtbl/generated-clients';import {Environment,addKeysToHeadersOverride}from'@imtbl/config';import f from'axios';var r=class extends Error{code;details;link;traceId;constructor({message:e,code:t,details:u,link:h,trace_id:p}){super(e),this.code=t,this.details=u,this.link=h,this.traceId=p;}};var R={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-2.0.0-alpha.0"},c=a=>{let{baseConfig:e,basePath:t,headers:u}=a;if(!t.trim())throw Error("basePath can not be empty");let h={...u||{},...addKeysToHeadersOverride(e,a)||{},...R},p={...e,basePath:t,baseOptions:{headers:h}};return new mr.Configuration(p)},l=class{apiConfig;baseConfig;constructor({baseConfig:e,overrides:t}){if(this.baseConfig=e,t)this.apiConfig=c(t);else switch(e.environment){case Environment.SANDBOX:{this.apiConfig=c({basePath:"https://api.sandbox.immutable.com",baseConfig:e});break}case Environment.PRODUCTION:{this.apiConfig=c({basePath:"https://api.immutable.com",baseConfig:e});break}default:this.apiConfig=c({basePath:"https://api.sandbox.immutable.com",baseConfig:e});}}};function s(a){if(f.isAxiosError(a)&&a.response){let e=a.response.data;return e.code&&e.message?new r({code:e.code,message:e.message,details:e.details||null,link:e.link||"",trace_id:e.trace_id||""}):new r({code:a.code??a.response?.status.toString()??"unknown_error_code",message:String(a),details:null,link:"",trace_id:""})}return new r({code:"unknown_error_code",message:String(a),details:null,link:"",trace_id:""})}var y=class{config;activities;chains;collections;nfts;nftOwners;tokens;metadata;crafting;pricing;metadataSearch;constructor(e){this.config=new l(e),this.activities=new mr.ActivitiesApi(this.config.apiConfig),this.chains=new mr.ChainsApi(this.config.apiConfig),this.collections=new mr.CollectionsApi(this.config.apiConfig),this.nfts=new mr.NftsApi(this.config.apiConfig),this.nftOwners=new mr.NftOwnersApi(this.config.apiConfig),this.tokens=new mr.TokensApi(this.config.apiConfig),this.metadata=new mr.MetadataApi(this.config.apiConfig),this.crafting=new mr.CraftingApi(this.config.apiConfig),this.pricing=new mr.PricingApi(this.config.apiConfig),this.metadataSearch=new mr.MetadataSearchApi(this.config.apiConfig);}async listActivities(e){return await this.activities.listActivities(e).then(t=>t.data).catch(t=>{throw s(t)})}async listActivityHistory(e){return await this.activities.listActivityHistory(e).then(t=>t.data).catch(t=>{throw s(t)})}async getActivity(e){return await this.activities.getActivity(e).then(t=>t.data).catch(t=>{throw s(t)})}async listChains(e){return await this.chains.listChains(e).then(t=>t.data).catch(t=>{throw s(t)})}async listCollections(e){return await this.collections.listCollections(e).then(t=>t.data).catch(t=>{throw s(t)})}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then(t=>t.data).catch(t=>{throw s(t)})}async getCollection(e){return await this.collections.getCollection(e).then(t=>t.data).catch(t=>{throw s(t)})}async getNFT(e){return await this.nfts.getNFT(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTs(e){return await this.nfts.listNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then(t=>t.data).catch(t=>{throw s(t)})}async listAllNFTs(e){return await this.nfts.listAllNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async createMintRequest(e){return await this.nfts.createMintRequest(e).then(t=>t.data).catch(t=>{throw s(t)})}async listMintRequests(e){return await this.nfts.listMintRequests(e).then(t=>t.data).catch(t=>{throw s(t)})}async getMintRequest(e){return await this.nfts.getMintRequest(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTOwnersByContractAddress(e){return await this.nftOwners.listOwnersByContractAddress(e).then(t=>t.data).catch(t=>{throw s(t)})}async listAllNFTOwners(e){return await this.nftOwners.listAllNFTOwners(e).then(t=>t.data).catch(t=>{throw s(t)})}async listTokens(e){return await this.tokens.listERC20Tokens(e).then(t=>t.data).catch(t=>{throw s(t)})}async getToken(e){return await this.tokens.getERC20Token(e).then(t=>t.data).catch(t=>{throw s(t)})}async getMetadata(e){return await this.metadata.getMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTMetadataByContractAddress(e){return await this.metadata.listMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTMetadataByChain(e){return await this.metadata.listMetadataForChain(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshCollectionMetadata(e){return await this.collections.refreshCollectionMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshNFTMetadata(e){return await this.metadata.refreshNFTMetadataByTokenID(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshStackedMetadata(e){return await this.metadata.refreshMetadataByID(e).then(t=>t.data).catch(t=>{throw s(t)})}async signCraftingPayload(e){return await this.crafting.signCraftingPayload(e).then(t=>t.data).catch(t=>{throw s(t)})}async listFilters(e){return await this.metadataSearch.listFilters(e).then(t=>t.data).catch(t=>{throw s(t)})}async searchNFTs(e){return await this.metadataSearch.searchNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async searchStacks(e){return await this.metadataSearch.searchStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}async quotesForNFTs(e){return await this.pricing.quotesForNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async quotesForStacks(e){return await this.pricing.quotesForStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}async listStacks(e){return await this.metadata.listStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}};
|
|
2
|
+
export{r as APIError,y as BlockchainData};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var generatedClients=require('@imtbl/generated-clients'),config=require('@imtbl/config'),m=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var m__default=/*#__PURE__*/_interopDefault(m);var r=class extends Error{code;details;link;traceId;constructor({message:e,code:t,details:c,link:l,trace_id:u}){super(e),this.code=t,this.details=c,this.link=l,this.traceId=u;}};var d={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-2.0.0-alpha.0"},n=a=>{let{baseConfig:e,basePath:t,headers:c}=a;if(!t.trim())throw Error("basePath can not be empty");let l={...c||{},...config.addKeysToHeadersOverride(e,a)||{},...d},u={...e,basePath:t,baseOptions:{headers:l}};return new generatedClients.mr.Configuration(u)},o=class{apiConfig;baseConfig;constructor({baseConfig:e,overrides:t}){if(this.baseConfig=e,t)this.apiConfig=n(t);else switch(e.environment){case config.Environment.SANDBOX:{this.apiConfig=n({basePath:"https://api.sandbox.immutable.com",baseConfig:e});break}case config.Environment.PRODUCTION:{this.apiConfig=n({basePath:"https://api.immutable.com",baseConfig:e});break}default:this.apiConfig=n({basePath:"https://api.sandbox.immutable.com",baseConfig:e});}}};function s(a){if(m__default.default.isAxiosError(a)&&a.response){let e=a.response.data;return e.code&&e.message?new r({code:e.code,message:e.message,details:e.details||null,link:e.link||"",trace_id:e.trace_id||""}):new r({code:a.code??a.response?.status.toString()??"unknown_error_code",message:String(a),details:null,link:"",trace_id:""})}return new r({code:"unknown_error_code",message:String(a),details:null,link:"",trace_id:""})}var h=class{config;activities;chains;collections;nfts;nftOwners;tokens;metadata;crafting;pricing;metadataSearch;constructor(e){this.config=new o(e),this.activities=new generatedClients.mr.ActivitiesApi(this.config.apiConfig),this.chains=new generatedClients.mr.ChainsApi(this.config.apiConfig),this.collections=new generatedClients.mr.CollectionsApi(this.config.apiConfig),this.nfts=new generatedClients.mr.NftsApi(this.config.apiConfig),this.nftOwners=new generatedClients.mr.NftOwnersApi(this.config.apiConfig),this.tokens=new generatedClients.mr.TokensApi(this.config.apiConfig),this.metadata=new generatedClients.mr.MetadataApi(this.config.apiConfig),this.crafting=new generatedClients.mr.CraftingApi(this.config.apiConfig),this.pricing=new generatedClients.mr.PricingApi(this.config.apiConfig),this.metadataSearch=new generatedClients.mr.MetadataSearchApi(this.config.apiConfig);}async listActivities(e){return await this.activities.listActivities(e).then(t=>t.data).catch(t=>{throw s(t)})}async listActivityHistory(e){return await this.activities.listActivityHistory(e).then(t=>t.data).catch(t=>{throw s(t)})}async getActivity(e){return await this.activities.getActivity(e).then(t=>t.data).catch(t=>{throw s(t)})}async listChains(e){return await this.chains.listChains(e).then(t=>t.data).catch(t=>{throw s(t)})}async listCollections(e){return await this.collections.listCollections(e).then(t=>t.data).catch(t=>{throw s(t)})}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then(t=>t.data).catch(t=>{throw s(t)})}async getCollection(e){return await this.collections.getCollection(e).then(t=>t.data).catch(t=>{throw s(t)})}async getNFT(e){return await this.nfts.getNFT(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTs(e){return await this.nfts.listNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then(t=>t.data).catch(t=>{throw s(t)})}async listAllNFTs(e){return await this.nfts.listAllNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async createMintRequest(e){return await this.nfts.createMintRequest(e).then(t=>t.data).catch(t=>{throw s(t)})}async listMintRequests(e){return await this.nfts.listMintRequests(e).then(t=>t.data).catch(t=>{throw s(t)})}async getMintRequest(e){return await this.nfts.getMintRequest(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTOwnersByContractAddress(e){return await this.nftOwners.listOwnersByContractAddress(e).then(t=>t.data).catch(t=>{throw s(t)})}async listAllNFTOwners(e){return await this.nftOwners.listAllNFTOwners(e).then(t=>t.data).catch(t=>{throw s(t)})}async listTokens(e){return await this.tokens.listERC20Tokens(e).then(t=>t.data).catch(t=>{throw s(t)})}async getToken(e){return await this.tokens.getERC20Token(e).then(t=>t.data).catch(t=>{throw s(t)})}async getMetadata(e){return await this.metadata.getMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTMetadataByContractAddress(e){return await this.metadata.listMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTMetadataByChain(e){return await this.metadata.listMetadataForChain(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshCollectionMetadata(e){return await this.collections.refreshCollectionMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshNFTMetadata(e){return await this.metadata.refreshNFTMetadataByTokenID(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshStackedMetadata(e){return await this.metadata.refreshMetadataByID(e).then(t=>t.data).catch(t=>{throw s(t)})}async signCraftingPayload(e){return await this.crafting.signCraftingPayload(e).then(t=>t.data).catch(t=>{throw s(t)})}async listFilters(e){return await this.metadataSearch.listFilters(e).then(t=>t.data).catch(t=>{throw s(t)})}async searchNFTs(e){return await this.metadataSearch.searchNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async searchStacks(e){return await this.metadataSearch.searchStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}async quotesForNFTs(e){return await this.pricing.quotesForNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async quotesForStacks(e){return await this.pricing.quotesForStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}async listStacks(e){return await this.metadata.listStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}};
|
|
2
|
+
Object.defineProperty(exports,"Types",{enumerable:true,get:function(){return generatedClients.BlockchainData}});exports.APIError=r;exports.BlockchainData=h;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {mr}from'@imtbl/generated-clients';export{BlockchainData as Types}from'@imtbl/generated-clients';import {Environment,addKeysToHeadersOverride}from'@imtbl/config';import m from'axios';var r=class extends Error{code;details;link;traceId;constructor({message:e,code:t,details:c,link:l,trace_id:u}){super(e),this.code=t,this.details=c,this.link=l,this.traceId=u;}};var d={sdkVersion:"ts-immutable-sdk-multi-rollup-api-client-2.0.0-alpha.0"},n=a=>{let{baseConfig:e,basePath:t,headers:c}=a;if(!t.trim())throw Error("basePath can not be empty");let l={...c||{},...addKeysToHeadersOverride(e,a)||{},...d},u={...e,basePath:t,baseOptions:{headers:l}};return new mr.Configuration(u)},o=class{apiConfig;baseConfig;constructor({baseConfig:e,overrides:t}){if(this.baseConfig=e,t)this.apiConfig=n(t);else switch(e.environment){case Environment.SANDBOX:{this.apiConfig=n({basePath:"https://api.sandbox.immutable.com",baseConfig:e});break}case Environment.PRODUCTION:{this.apiConfig=n({basePath:"https://api.immutable.com",baseConfig:e});break}default:this.apiConfig=n({basePath:"https://api.sandbox.immutable.com",baseConfig:e});}}};function s(a){if(m.isAxiosError(a)&&a.response){let e=a.response.data;return e.code&&e.message?new r({code:e.code,message:e.message,details:e.details||null,link:e.link||"",trace_id:e.trace_id||""}):new r({code:a.code??a.response?.status.toString()??"unknown_error_code",message:String(a),details:null,link:"",trace_id:""})}return new r({code:"unknown_error_code",message:String(a),details:null,link:"",trace_id:""})}var h=class{config;activities;chains;collections;nfts;nftOwners;tokens;metadata;crafting;pricing;metadataSearch;constructor(e){this.config=new o(e),this.activities=new mr.ActivitiesApi(this.config.apiConfig),this.chains=new mr.ChainsApi(this.config.apiConfig),this.collections=new mr.CollectionsApi(this.config.apiConfig),this.nfts=new mr.NftsApi(this.config.apiConfig),this.nftOwners=new mr.NftOwnersApi(this.config.apiConfig),this.tokens=new mr.TokensApi(this.config.apiConfig),this.metadata=new mr.MetadataApi(this.config.apiConfig),this.crafting=new mr.CraftingApi(this.config.apiConfig),this.pricing=new mr.PricingApi(this.config.apiConfig),this.metadataSearch=new mr.MetadataSearchApi(this.config.apiConfig);}async listActivities(e){return await this.activities.listActivities(e).then(t=>t.data).catch(t=>{throw s(t)})}async listActivityHistory(e){return await this.activities.listActivityHistory(e).then(t=>t.data).catch(t=>{throw s(t)})}async getActivity(e){return await this.activities.getActivity(e).then(t=>t.data).catch(t=>{throw s(t)})}async listChains(e){return await this.chains.listChains(e).then(t=>t.data).catch(t=>{throw s(t)})}async listCollections(e){return await this.collections.listCollections(e).then(t=>t.data).catch(t=>{throw s(t)})}async listCollectionsByNFTOwner(e){return await this.collections.listCollectionsByNFTOwner(e).then(t=>t.data).catch(t=>{throw s(t)})}async getCollection(e){return await this.collections.getCollection(e).then(t=>t.data).catch(t=>{throw s(t)})}async getNFT(e){return await this.nfts.getNFT(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTs(e){return await this.nfts.listNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTsByAccountAddress(e){return await this.nfts.listNFTsByAccountAddress(e).then(t=>t.data).catch(t=>{throw s(t)})}async listAllNFTs(e){return await this.nfts.listAllNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async createMintRequest(e){return await this.nfts.createMintRequest(e).then(t=>t.data).catch(t=>{throw s(t)})}async listMintRequests(e){return await this.nfts.listMintRequests(e).then(t=>t.data).catch(t=>{throw s(t)})}async getMintRequest(e){return await this.nfts.getMintRequest(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTOwners(e){return await this.nftOwners.listNFTOwners(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTOwnersByContractAddress(e){return await this.nftOwners.listOwnersByContractAddress(e).then(t=>t.data).catch(t=>{throw s(t)})}async listAllNFTOwners(e){return await this.nftOwners.listAllNFTOwners(e).then(t=>t.data).catch(t=>{throw s(t)})}async listTokens(e){return await this.tokens.listERC20Tokens(e).then(t=>t.data).catch(t=>{throw s(t)})}async getToken(e){return await this.tokens.getERC20Token(e).then(t=>t.data).catch(t=>{throw s(t)})}async getMetadata(e){return await this.metadata.getMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTMetadataByContractAddress(e){return await this.metadata.listMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async listNFTMetadataByChain(e){return await this.metadata.listMetadataForChain(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshCollectionMetadata(e){return await this.collections.refreshCollectionMetadata(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshNFTMetadata(e){return await this.metadata.refreshNFTMetadataByTokenID(e).then(t=>t.data).catch(t=>{throw s(t)})}async refreshStackedMetadata(e){return await this.metadata.refreshMetadataByID(e).then(t=>t.data).catch(t=>{throw s(t)})}async signCraftingPayload(e){return await this.crafting.signCraftingPayload(e).then(t=>t.data).catch(t=>{throw s(t)})}async listFilters(e){return await this.metadataSearch.listFilters(e).then(t=>t.data).catch(t=>{throw s(t)})}async searchNFTs(e){return await this.metadataSearch.searchNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async searchStacks(e){return await this.metadataSearch.searchStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}async quotesForNFTs(e){return await this.pricing.quotesForNFTs(e).then(t=>t.data).catch(t=>{throw s(t)})}async quotesForStacks(e){return await this.pricing.quotesForStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}async listStacks(e){return await this.metadata.listStacks(e).then(t=>t.data).catch(t=>{throw s(t)})}};
|
|
2
|
+
export{r as APIError,h as BlockchainData};
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { BlockchainData as Types } from '@imtbl/generated-clients';
|
|
2
|
+
import { BlockchainDataConfiguration, BlockchainDataModuleConfiguration } from './config';
|
|
3
|
+
export declare class BlockchainData {
|
|
4
|
+
readonly config: BlockchainDataConfiguration;
|
|
5
|
+
private readonly activities;
|
|
6
|
+
private readonly chains;
|
|
7
|
+
private readonly collections;
|
|
8
|
+
private readonly nfts;
|
|
9
|
+
private readonly nftOwners;
|
|
10
|
+
private readonly tokens;
|
|
11
|
+
private readonly metadata;
|
|
12
|
+
private readonly crafting;
|
|
13
|
+
private readonly pricing;
|
|
14
|
+
private readonly metadataSearch;
|
|
15
|
+
constructor(moduleConfig: BlockchainDataModuleConfiguration);
|
|
16
|
+
/**
|
|
17
|
+
* List all activities
|
|
18
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
19
|
+
* @returns a promise that resolves with a list of activities
|
|
20
|
+
* @throws {@link index.APIError}
|
|
21
|
+
*/
|
|
22
|
+
listActivities(request: Types.ListActivitiesRequestParams): Promise<Types.ListActivitiesResult>;
|
|
23
|
+
/**
|
|
24
|
+
* List activities sorted by updated_at timestamp ascending, useful for time based data replication
|
|
25
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
26
|
+
* @returns a promise that resolves with a list of activities
|
|
27
|
+
* @throws {@link index.APIError}
|
|
28
|
+
*/
|
|
29
|
+
listActivityHistory(request: Types.ListActivityHistoryRequestParams): Promise<Types.ListActivitiesResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Get a single activity by ID
|
|
32
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
33
|
+
* @returns a promise that resolves with a single activity
|
|
34
|
+
* @throws {@link index.APIError}
|
|
35
|
+
*/
|
|
36
|
+
getActivity(request: Types.GetActivityRequestParams): Promise<Types.GetActivityResult>;
|
|
37
|
+
/**
|
|
38
|
+
* List supported chains
|
|
39
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
40
|
+
* @returns a promise that resolves with a list of supported chains
|
|
41
|
+
* @throws {@link index.APIError}
|
|
42
|
+
*/
|
|
43
|
+
listChains(request: Types.ListChainsRequestParams): Promise<Types.ListChainsResult>;
|
|
44
|
+
/**
|
|
45
|
+
* List all collections
|
|
46
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
47
|
+
* @returns a promise that resolves with a list of collections
|
|
48
|
+
* @throws {@link index.APIError}
|
|
49
|
+
*/
|
|
50
|
+
listCollections(request: Types.ListCollectionsRequestParams): Promise<Types.ListCollectionsResult>;
|
|
51
|
+
/**
|
|
52
|
+
* List collections by NFT owner
|
|
53
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
54
|
+
* @returns a promise that resolves with a list of collections
|
|
55
|
+
* @throws {@link index.APIError}
|
|
56
|
+
*/
|
|
57
|
+
listCollectionsByNFTOwner(request: Types.ListCollectionsByNFTOwnerRequestParams): Promise<Types.ListCollectionsResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Get a collection by contract address
|
|
60
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
61
|
+
* @returns a promise that resolves with a single collection
|
|
62
|
+
* @throws {@link index.APIError}
|
|
63
|
+
*/
|
|
64
|
+
getCollection(request: Types.GetCollectionRequestParams): Promise<Types.GetCollectionResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Get NFT by token ID
|
|
67
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
68
|
+
* @returns a promise that resolves with a single NFT
|
|
69
|
+
* @throws {@link index.APIError}
|
|
70
|
+
*/
|
|
71
|
+
getNFT(request: Types.GetNFTRequestParams): Promise<Types.GetNFTResult>;
|
|
72
|
+
/**
|
|
73
|
+
* List NFTs by contract address
|
|
74
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
75
|
+
* @returns a promise that resolves with a list of NFTs
|
|
76
|
+
* @throws {@link index.APIError}
|
|
77
|
+
*/
|
|
78
|
+
listNFTs(request: Types.ListNFTsRequestParams): Promise<Types.ListNFTsResult>;
|
|
79
|
+
/**
|
|
80
|
+
* List NFTs by account address
|
|
81
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
82
|
+
* @returns a promise that resolves with a list of NFTs
|
|
83
|
+
* @throws {@link index.APIError}
|
|
84
|
+
*/
|
|
85
|
+
listNFTsByAccountAddress(request: Types.ListNFTsByAccountAddressRequestParams): Promise<Types.ListNFTsByOwnerResult>;
|
|
86
|
+
/**
|
|
87
|
+
* List All NFTs on a chain
|
|
88
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
89
|
+
* @returns a promise that resolves with a list of NFTs
|
|
90
|
+
* @throws {@link index.APIError}
|
|
91
|
+
*/
|
|
92
|
+
listAllNFTs(request: Types.ListAllNFTsRequestParams): Promise<Types.ListNFTsResult>;
|
|
93
|
+
/**
|
|
94
|
+
* Create a mint request to mint a set of NFTs for a given collection
|
|
95
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
96
|
+
* @returns a promise that resolves with the remaining rate limits
|
|
97
|
+
* @throws {@link index.APIError}
|
|
98
|
+
*/
|
|
99
|
+
createMintRequest(request: Types.CreateMintRequestRequestParams): Promise<Types.CreateMintRequestResult>;
|
|
100
|
+
/**
|
|
101
|
+
* List all mint requests for a given contract address
|
|
102
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
103
|
+
* @returns a promise that resolves with a list of mint requests
|
|
104
|
+
* @throws {@link index.APIError}
|
|
105
|
+
*/
|
|
106
|
+
listMintRequests(request: Types.ListMintRequestsRequestParams): Promise<Types.ListMintRequestsResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Retrieve the status of a single mint request identified by its reference ID
|
|
109
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
110
|
+
* @returns a promise that resolves with a single mint request
|
|
111
|
+
* @throws {@link index.APIError}
|
|
112
|
+
*/
|
|
113
|
+
getMintRequest(request: Types.GetMintRequestRequestParams): Promise<Types.ListMintRequestsResult>;
|
|
114
|
+
/**
|
|
115
|
+
* List NFT owners by token ID
|
|
116
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
117
|
+
* @returns a promise that resolves with a list of NFT owners
|
|
118
|
+
* @throws {@link index.APIError}
|
|
119
|
+
*/
|
|
120
|
+
listNFTOwners(request: Types.ListNFTOwnersRequestParams): Promise<Types.ListNFTOwnersResult>;
|
|
121
|
+
/**
|
|
122
|
+
* List NFT owners by contract address
|
|
123
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
124
|
+
* @returns a promise that resolves with a list of NFT owners
|
|
125
|
+
* @throws {@link index.APIError}
|
|
126
|
+
*/
|
|
127
|
+
listNFTOwnersByContractAddress(request: Types.ListOwnersByContractAddressRequestParams): Promise<Types.ListNFTOwnersResult>;
|
|
128
|
+
/**
|
|
129
|
+
* List All NFT owners on a chain
|
|
130
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
131
|
+
* @returns a promise that resolves with a list of NFT owners
|
|
132
|
+
* @throws {@link index.APIError}
|
|
133
|
+
*/
|
|
134
|
+
listAllNFTOwners(request: Types.ListAllNFTOwnersRequestParams): Promise<Types.ListNFTOwnersResult>;
|
|
135
|
+
/**
|
|
136
|
+
* List ERC20 Token contracts
|
|
137
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
138
|
+
* @returns a promise that resolves with a list of ERC20 Tokens
|
|
139
|
+
* @throws {@link index.APIError}
|
|
140
|
+
*/
|
|
141
|
+
listTokens(request: Types.ListERC20TokensRequestParams): Promise<Types.ListTokensResult>;
|
|
142
|
+
/**
|
|
143
|
+
* Get details for an ERC20 Token by contract address
|
|
144
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
145
|
+
* @returns a promise that resolves with a list of ERC20 Tokens
|
|
146
|
+
* @throws {@link index.APIError}
|
|
147
|
+
*/
|
|
148
|
+
getToken(request: Types.GetERC20TokenRequestParams): Promise<Types.GetTokenResult>;
|
|
149
|
+
/**
|
|
150
|
+
* Get metadata by ID
|
|
151
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
152
|
+
* @returns a promise that resolves with a single Metadata
|
|
153
|
+
* @throws {@link index.APIError}
|
|
154
|
+
*/
|
|
155
|
+
getMetadata(request: Types.GetMetadataRequestParams): Promise<Types.GetMetadataResult>;
|
|
156
|
+
/**
|
|
157
|
+
* List NFT Metadata by contract address
|
|
158
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
159
|
+
* @returns a promise that resolves with a list of Metadata
|
|
160
|
+
* @throws {@link index.APIError}
|
|
161
|
+
*/
|
|
162
|
+
listNFTMetadataByContractAddress(request: Types.ListMetadataRequestParams): Promise<Types.ListMetadataResult>;
|
|
163
|
+
/**
|
|
164
|
+
* List NFT Metadata by chain
|
|
165
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
166
|
+
* @returns a promise that resolves with a list of Metadata
|
|
167
|
+
* @throws {@link index.APIError}
|
|
168
|
+
*/
|
|
169
|
+
listNFTMetadataByChain(request: Types.ListMetadataForChainRequestParams): Promise<Types.ListMetadataResult>;
|
|
170
|
+
/**
|
|
171
|
+
* Refresh collection metadata
|
|
172
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
173
|
+
* @returns a promise that resolves with the updated collection
|
|
174
|
+
* @throws {@link index.APIError}
|
|
175
|
+
*/
|
|
176
|
+
refreshCollectionMetadata(request: Types.RefreshCollectionMetadataRequestParams): Promise<Types.RefreshCollectionMetadataResult>;
|
|
177
|
+
/**
|
|
178
|
+
* Refresh metadata for specific NFTs
|
|
179
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
180
|
+
* @returns a promise that resolves with the remaining rate limits
|
|
181
|
+
* @throws {@link index.APIError}
|
|
182
|
+
*/
|
|
183
|
+
refreshNFTMetadata(request: Types.RefreshNFTMetadataByTokenIDRequestParams): Promise<Types.MetadataRefreshRateLimitResult>;
|
|
184
|
+
/**
|
|
185
|
+
* Refresh metadata by ID. This will refresh metadata for all NFTs that reference the given metadata ID.
|
|
186
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
187
|
+
* @returns a promise that resolves with the remaining rate limits
|
|
188
|
+
* @throws {@link index.APIError}
|
|
189
|
+
*/
|
|
190
|
+
refreshStackedMetadata(request: Types.RefreshMetadataByIDRequestParams): Promise<Types.MetadataRefreshRateLimitResult>;
|
|
191
|
+
/**
|
|
192
|
+
* Sign a crafting payload
|
|
193
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
194
|
+
* @returns a promise that resolves with the signature result
|
|
195
|
+
* @throws {@link index.APIError}
|
|
196
|
+
*/
|
|
197
|
+
signCraftingPayload(request: Types.SignCraftingPayloadRequestParams): Promise<Types.SignCraftingResult>;
|
|
198
|
+
/**
|
|
199
|
+
* Marketplace APIs
|
|
200
|
+
* - Metadata search
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* Get list of metadata filters
|
|
204
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
205
|
+
* @returns a promise that resolves with the a list of metadata filters
|
|
206
|
+
* @throws {@link index.APIError}
|
|
207
|
+
*/
|
|
208
|
+
listFilters(request: Types.ListFiltersRequestParams): Promise<Types.ListFiltersResult>;
|
|
209
|
+
/**
|
|
210
|
+
* Search NFTs
|
|
211
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
212
|
+
* @returns a promise that resolves with the a list NFTs with metadata, market and listings information
|
|
213
|
+
* @throws {@link index.APIError}
|
|
214
|
+
*/
|
|
215
|
+
searchNFTs(request: Types.SearchNFTsRequestParams): Promise<Types.SearchNFTsResult>;
|
|
216
|
+
/**
|
|
217
|
+
* Search NFT stacks
|
|
218
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
219
|
+
* @returns a promise that resolves with the a list NFT stacks with stack count, market and listings information
|
|
220
|
+
* @throws {@link index.APIError}
|
|
221
|
+
*/
|
|
222
|
+
searchStacks(request: Types.SearchStacksRequestParams): Promise<Types.SearchStacksResult>;
|
|
223
|
+
/**
|
|
224
|
+
* Marketplace APIs
|
|
225
|
+
* - Pricing
|
|
226
|
+
*/
|
|
227
|
+
/**
|
|
228
|
+
* Get pricing data for a list of token ids
|
|
229
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
230
|
+
* @returns a promise that resolves with the a list of pricing data for particular NFTs
|
|
231
|
+
* @throws {@link index.APIError}
|
|
232
|
+
*/
|
|
233
|
+
quotesForNFTs(request: Types.QuotesForNFTsRequestParams): Promise<Types.QuotesForNFTsResult>;
|
|
234
|
+
/**
|
|
235
|
+
* Get pricing data for a list of stack ids
|
|
236
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
237
|
+
* @returns a promise that resolves with the a list of pricing data for particular stack ids
|
|
238
|
+
* @throws {@link index.APIError}
|
|
239
|
+
*/
|
|
240
|
+
quotesForStacks(request: Types.QuotesForStacksRequestParams): Promise<Types.QuotesForStacksResult>;
|
|
241
|
+
/**
|
|
242
|
+
* Marketplace APIs
|
|
243
|
+
* - Metadata
|
|
244
|
+
*/
|
|
245
|
+
/**
|
|
246
|
+
* List NFT stack bundles by stack_id.
|
|
247
|
+
* @param request - the request object containing the parameters to be provided in the API request
|
|
248
|
+
* @returns a promise that resolves with a list of NFT stacks with stack count, market and listings information
|
|
249
|
+
* @throws {@link index.APIError}
|
|
250
|
+
*/
|
|
251
|
+
listStacks(request: Types.ListStacksRequestParams): Promise<Types.StackBundle[]>;
|
|
252
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ImmutableConfiguration, ModuleConfiguration } from '@imtbl/config';
|
|
2
|
+
import { mr } from '@imtbl/generated-clients';
|
|
3
|
+
export interface APIConfigurationParams {
|
|
4
|
+
basePath: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
baseConfig?: ImmutableConfiguration;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* createAPIConfiguration to create a custom Configuration
|
|
10
|
+
* other than the production and sandbox defined below.
|
|
11
|
+
*/
|
|
12
|
+
export declare const createAPIConfiguration: (overrides: APIConfigurationParams) => mr.Configuration;
|
|
13
|
+
export interface BlockchainDataModuleConfiguration extends ModuleConfiguration<APIConfigurationParams> {
|
|
14
|
+
}
|
|
15
|
+
export declare class BlockchainDataConfiguration {
|
|
16
|
+
readonly apiConfig: mr.Configuration;
|
|
17
|
+
readonly baseConfig: ImmutableConfiguration;
|
|
18
|
+
constructor({ baseConfig, overrides }: BlockchainDataModuleConfiguration);
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { mr, BlockchainData as Types } from '@imtbl/generated-clients';
|
|
2
|
+
import { APIError } from './types/errors';
|
|
3
|
+
import { BlockchainData } from './blockchain-data';
|
|
4
|
+
import { BlockchainDataModuleConfiguration } from './config';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated since version 1.1.5
|
|
7
|
+
* Please use Types.ActivityType instead
|
|
8
|
+
* import { Types } from '@imtbl/blockchain-data'
|
|
9
|
+
*/
|
|
10
|
+
type ActivityType = mr.ActivityType;
|
|
11
|
+
export { Types, APIError, BlockchainData };
|
|
12
|
+
export type { BlockchainDataModuleConfiguration, ActivityType };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { mr } from '@imtbl/generated-clients';
|
|
2
|
+
interface OpenAPIError extends mr.BasicAPIError {
|
|
3
|
+
code: string;
|
|
4
|
+
details: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
} | null;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Custom Error class that is returned from the API when a request fails
|
|
10
|
+
*/
|
|
11
|
+
export declare class APIError extends Error {
|
|
12
|
+
readonly code: string;
|
|
13
|
+
readonly details: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
} | null;
|
|
16
|
+
readonly link: string;
|
|
17
|
+
readonly traceId: string;
|
|
18
|
+
constructor({ message, code, details, link, trace_id: traceId, }: OpenAPIError);
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { APIError } from '../types/errors';
|
|
2
|
+
/**
|
|
3
|
+
* [Formats an error in the APIError shape](https://axios-http.com/docs/handling_errors)
|
|
4
|
+
* @param error - The Error object thrown by the request
|
|
5
|
+
* @returns APIError
|
|
6
|
+
*/
|
|
7
|
+
export declare function formatError(error: unknown): APIError;
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@imtbl/blockchain-data",
|
|
3
|
+
"description": "Wrapper functions for interacting with Immutable blockchain data APIs",
|
|
4
|
+
"version": "2.0.0-alpha.0",
|
|
5
|
+
"author": "Immutable",
|
|
6
|
+
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@imtbl/config": "2.0.0-alpha.0",
|
|
9
|
+
"@imtbl/generated-clients": "2.0.0-alpha.0",
|
|
10
|
+
"axios": "^1.6.5"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@swc/core": "^1.3.36",
|
|
14
|
+
"@swc/jest": "^0.2.24",
|
|
15
|
+
"@types/jest": "^29.4.3",
|
|
16
|
+
"eslint": "^8.40.0",
|
|
17
|
+
"jest": "^29.4.3",
|
|
18
|
+
"jest-environment-jsdom": "^29.4.3",
|
|
19
|
+
"tsup": "^8.3.5",
|
|
20
|
+
"typescript": "^5.6.2"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
"development": {
|
|
24
|
+
"types": "./src/index.ts",
|
|
25
|
+
"browser": "./dist/browser/index.js",
|
|
26
|
+
"require": "./dist/node/index.cjs",
|
|
27
|
+
"default": "./dist/node/index.js"
|
|
28
|
+
},
|
|
29
|
+
"default": {
|
|
30
|
+
"types": "./dist/types/index.d.ts",
|
|
31
|
+
"browser": "./dist/browser/index.js",
|
|
32
|
+
"require": "./dist/node/index.cjs",
|
|
33
|
+
"default": "./dist/node/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"homepage": "https://github.com/immutable/ts-immutable-sdk#readme",
|
|
40
|
+
"license": "Apache-2.0",
|
|
41
|
+
"main": "dist/node/index.cjs",
|
|
42
|
+
"module": "dist/node/index.js",
|
|
43
|
+
"browser": "dist/browser/index.js",
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"repository": "immutable/ts-immutable-sdk.git",
|
|
48
|
+
"type": "module",
|
|
49
|
+
"types": "./dist/types/index.d.ts",
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "pnpm transpile && pnpm typegen",
|
|
52
|
+
"transpile": "tsup src/index.ts --config ../../../tsup.config.js",
|
|
53
|
+
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
|
|
54
|
+
"lint": "eslint ./src --ext .ts,.jsx,.tsx --max-warnings=0",
|
|
55
|
+
"test": "jest",
|
|
56
|
+
"test:watch": "jest --watch",
|
|
57
|
+
"typecheck": "tsc --customConditions default --noEmit --jsx preserve"
|
|
58
|
+
}
|
|
59
|
+
}
|