@xyo-network/crypto-nft-collection-witness-plugin 2.79.4 → 2.79.5
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/dist/browser/Plugin.d.cts +1 -21
- package/dist/browser/Plugin.d.cts.map +1 -1
- package/dist/browser/Plugin.d.mts +1 -21
- package/dist/browser/Plugin.d.mts.map +1 -1
- package/dist/browser/Plugin.d.ts +1 -21
- package/dist/browser/Plugin.d.ts.map +1 -1
- package/dist/browser/Witness.d.cts +3 -10
- package/dist/browser/Witness.d.cts.map +1 -1
- package/dist/browser/Witness.d.mts +3 -10
- package/dist/browser/Witness.d.mts.map +1 -1
- package/dist/browser/Witness.d.ts +3 -10
- package/dist/browser/Witness.d.ts.map +1 -1
- package/dist/browser/index.cjs +6 -10
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +7 -11
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/lib/getNftCollectionNfts.d.cts.map +1 -1
- package/dist/browser/lib/getNftCollectionNfts.d.mts.map +1 -1
- package/dist/browser/lib/getNftCollectionNfts.d.ts.map +1 -1
- package/dist/node/Plugin.d.cts +1 -21
- package/dist/node/Plugin.d.cts.map +1 -1
- package/dist/node/Plugin.d.mts +1 -21
- package/dist/node/Plugin.d.mts.map +1 -1
- package/dist/node/Plugin.d.ts +1 -21
- package/dist/node/Plugin.d.ts.map +1 -1
- package/dist/node/Witness.d.cts +3 -10
- package/dist/node/Witness.d.cts.map +1 -1
- package/dist/node/Witness.d.mts +3 -10
- package/dist/node/Witness.d.mts.map +1 -1
- package/dist/node/Witness.d.ts +3 -10
- package/dist/node/Witness.d.ts.map +1 -1
- package/dist/node/index.js +6 -10
- package/dist/node/index.js.map +1 -1
- package/dist/node/index.mjs +7 -11
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/lib/getNftCollectionNfts.d.cts.map +1 -1
- package/dist/node/lib/getNftCollectionNfts.d.mts.map +1 -1
- package/dist/node/lib/getNftCollectionNfts.d.ts.map +1 -1
- package/package.json +15 -16
- package/src/Witness.ts +7 -24
- package/src/lib/getNftCollectionNfts.ts +3 -2
package/src/Witness.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { InfuraProvider, Provider, WebSocketProvider } from '@ethersproject/providers'
|
|
2
1
|
import { assertEx } from '@xylabs/assert'
|
|
3
2
|
import { EthAddress } from '@xylabs/eth-address'
|
|
4
|
-
import { AbstractWitness } from '@xyo-network/abstract-witness'
|
|
5
3
|
import { PayloadHasher } from '@xyo-network/core'
|
|
6
4
|
import {
|
|
7
5
|
isNftCollectionWitnessQuery,
|
|
@@ -11,19 +9,12 @@ import {
|
|
|
11
9
|
NftCollectionWitnessConfigSchema,
|
|
12
10
|
NftCollectionWitnessQuery,
|
|
13
11
|
} from '@xyo-network/crypto-nft-collection-payload-plugin'
|
|
14
|
-
import { AnyConfigSchema } from '@xyo-network/module-model'
|
|
15
12
|
import { ERC721Enumerable__factory } from '@xyo-network/open-zeppelin-typechain'
|
|
16
|
-
import {
|
|
17
|
-
import { WitnessParams } from '@xyo-network/witness-model'
|
|
13
|
+
import { AbstractBlockchainWitness, BlockchainWitnessParams } from '@xyo-network/witness-blockchain-abstract'
|
|
18
14
|
|
|
19
15
|
import { getNftCollectionMetrics, getNftCollectionNfts, tokenTypes } from './lib'
|
|
20
16
|
|
|
21
|
-
export type CryptoNftCollectionWitnessParams =
|
|
22
|
-
AnyConfigSchema<NftCollectionWitnessConfig>,
|
|
23
|
-
{
|
|
24
|
-
provider: Provider
|
|
25
|
-
}
|
|
26
|
-
>
|
|
17
|
+
export type CryptoNftCollectionWitnessParams = BlockchainWitnessParams<NftCollectionWitnessConfig>
|
|
27
18
|
|
|
28
19
|
const defaultMaxNfts = 100
|
|
29
20
|
|
|
@@ -43,27 +34,19 @@ function resolvedValue<T>(settled: PromiseSettledResult<T>, assert?: boolean) {
|
|
|
43
34
|
return settled.status === 'fulfilled' ? settled.value : undefined
|
|
44
35
|
}
|
|
45
36
|
|
|
46
|
-
export class CryptoNftCollectionWitness<
|
|
47
|
-
TParams,
|
|
48
|
-
|
|
49
|
-
NftCollectionInfo
|
|
50
|
-
> {
|
|
37
|
+
export class CryptoNftCollectionWitness<
|
|
38
|
+
TParams extends CryptoNftCollectionWitnessParams = CryptoNftCollectionWitnessParams,
|
|
39
|
+
> extends AbstractBlockchainWitness<TParams, NftCollectionWitnessQuery, NftCollectionInfo> {
|
|
51
40
|
static override configSchemas = [NftCollectionWitnessConfigSchema]
|
|
52
41
|
|
|
53
|
-
protected providers: Record<number, WebSocketProvider | InfuraProvider> = {}
|
|
54
|
-
|
|
55
|
-
protected getProvider(chainId: number) {
|
|
56
|
-
this.providers[chainId] = this.providers[chainId] ?? getProviderFromEnv(chainId)
|
|
57
|
-
return this.providers[chainId]
|
|
58
|
-
}
|
|
59
|
-
|
|
60
42
|
protected override async observeHandler(payloads?: NftCollectionWitnessQuery[]): Promise<NftCollectionInfo[]> {
|
|
61
43
|
await this.started('throw')
|
|
44
|
+
await this.getProviders() //make sure cache clears
|
|
62
45
|
const queries = payloads?.filter(isNftCollectionWitnessQuery) ?? []
|
|
63
46
|
const observations = await Promise.all(
|
|
64
47
|
queries.map<Promise<NftCollectionInfo>>(async (query) => {
|
|
65
48
|
const chainId = assertEx(query?.chainId || this.config.chainId, 'params.chainId is required')
|
|
66
|
-
const provider = this.getProvider(
|
|
49
|
+
const provider = await this.getProvider(true, true)
|
|
67
50
|
const address = assertEx(
|
|
68
51
|
EthAddress.parse(assertEx(query?.address || this.config.address, 'params.address is required')),
|
|
69
52
|
'Failed to parse params.address',
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { BaseProvider } from '@ethersproject/providers'
|
|
2
|
+
import { AxiosJson } from '@xylabs/axios'
|
|
2
3
|
import { exists } from '@xylabs/exists'
|
|
3
|
-
import {
|
|
4
|
+
import { getErc1967Status } from '@xyo-network/blockchain-erc1967-witness'
|
|
4
5
|
import { NftInfo, NftMetadata, NftSchema, TokenType, toTokenType } from '@xyo-network/crypto-nft-payload-plugin'
|
|
5
6
|
import { ERC721Enumerable__factory, ERC721URIStorage__factory, ERC1155Supply__factory } from '@xyo-network/open-zeppelin-typechain'
|
|
6
|
-
import { checkIpfsUrl
|
|
7
|
+
import { checkIpfsUrl } from '@xyo-network/witness-blockchain-abstract'
|
|
7
8
|
|
|
8
9
|
import { tokenTypes } from './tokenTypes'
|
|
9
10
|
import { tryCall } from './tryCall'
|