@xyo-network/erc1822-witness 2.87.11 → 2.88.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/dist/browser/Payload.d.cts +1 -2
- package/dist/browser/Payload.d.cts.map +1 -1
- package/dist/browser/Payload.d.mts +1 -2
- package/dist/browser/Payload.d.mts.map +1 -1
- package/dist/browser/Payload.d.ts +1 -2
- package/dist/browser/Payload.d.ts.map +1 -1
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/lib/getErc1822SlotStatus.d.cts +2 -2
- package/dist/browser/lib/getErc1822SlotStatus.d.cts.map +1 -1
- package/dist/browser/lib/getErc1822SlotStatus.d.mts +2 -2
- package/dist/browser/lib/getErc1822SlotStatus.d.mts.map +1 -1
- package/dist/browser/lib/getErc1822SlotStatus.d.ts +2 -2
- package/dist/browser/lib/getErc1822SlotStatus.d.ts.map +1 -1
- package/dist/node/Payload.d.cts +1 -2
- package/dist/node/Payload.d.cts.map +1 -1
- package/dist/node/Payload.d.mts +1 -2
- package/dist/node/Payload.d.mts.map +1 -1
- package/dist/node/Payload.d.ts +1 -2
- package/dist/node/Payload.d.ts.map +1 -1
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js.map +1 -1
- package/dist/node/lib/getErc1822SlotStatus.d.cts +2 -2
- package/dist/node/lib/getErc1822SlotStatus.d.cts.map +1 -1
- package/dist/node/lib/getErc1822SlotStatus.d.mts +2 -2
- package/dist/node/lib/getErc1822SlotStatus.d.mts.map +1 -1
- package/dist/node/lib/getErc1822SlotStatus.d.ts +2 -2
- package/dist/node/lib/getErc1822SlotStatus.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/Payload.ts +1 -2
- package/src/lib/getErc1822SlotStatus.ts +3 -3
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex';
|
|
2
1
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
2
|
import { Erc1822SlotStatus } from './lib';
|
|
4
3
|
export declare const Erc1822StatusSchema = "network.xyo.erc1822.status";
|
|
5
4
|
export type Erc1822StatusSchema = typeof Erc1822StatusSchema;
|
|
6
5
|
export type Erc1822Status = Payload<{
|
|
7
|
-
address:
|
|
6
|
+
address: string;
|
|
8
7
|
block: number;
|
|
9
8
|
chainId: number;
|
|
10
9
|
implementation?: Erc1822SlotStatus['implementation'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,mBAAmB,+BAA+B,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,MAAM,MAAM,aAAa,GAAG,OAAO,CACjC;IACE,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;CACnC,EACD,mBAAmB,CACpB,CAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex';
|
|
2
1
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
2
|
import { Erc1822SlotStatus } from './lib';
|
|
4
3
|
export declare const Erc1822StatusSchema = "network.xyo.erc1822.status";
|
|
5
4
|
export type Erc1822StatusSchema = typeof Erc1822StatusSchema;
|
|
6
5
|
export type Erc1822Status = Payload<{
|
|
7
|
-
address:
|
|
6
|
+
address: string;
|
|
8
7
|
block: number;
|
|
9
8
|
chainId: number;
|
|
10
9
|
implementation?: Erc1822SlotStatus['implementation'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,mBAAmB,+BAA+B,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,MAAM,MAAM,aAAa,GAAG,OAAO,CACjC;IACE,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;CACnC,EACD,mBAAmB,CACpB,CAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex';
|
|
2
1
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
2
|
import { Erc1822SlotStatus } from './lib';
|
|
4
3
|
export declare const Erc1822StatusSchema = "network.xyo.erc1822.status";
|
|
5
4
|
export type Erc1822StatusSchema = typeof Erc1822StatusSchema;
|
|
6
5
|
export type Erc1822Status = Payload<{
|
|
7
|
-
address:
|
|
6
|
+
address: string;
|
|
8
7
|
block: number;
|
|
9
8
|
chainId: number;
|
|
10
9
|
implementation?: Erc1822SlotStatus['implementation'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,mBAAmB,+BAA+B,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,MAAM,MAAM,aAAa,GAAG,OAAO,CACjC;IACE,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;CACnC,EACD,mBAAmB,CACpB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/lib/getErc1822SlotStatus.ts","../../src/Payload.ts","../../src/Witness.ts"],"sourcesContent":["export * from './lib'\nexport * from './Payload'\nexport * from './Witness'\n","import { Address, hexFromHexString, isHexZero } from '@xylabs/hex'\nimport type { Provider } from 'ethers'\n\nexport const ERC1822_PROXY_LOGIC_SLOT = '0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7'\n\nexport interface Erc1822DataSlots {\n implementation?: Address\n}\n\nexport interface Erc1822SlotStatus {\n address:
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/lib/getErc1822SlotStatus.ts","../../src/Payload.ts","../../src/Witness.ts"],"sourcesContent":["export * from './lib'\nexport * from './Payload'\nexport * from './Witness'\n","import { Address, hexFromHexString, isHexZero } from '@xylabs/hex'\nimport type { Provider } from 'ethers'\n\nexport const ERC1822_PROXY_LOGIC_SLOT = '0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7'\n\nexport interface Erc1822DataSlots {\n implementation?: Address\n}\n\nexport interface Erc1822SlotStatus {\n address: string\n implementation: string\n slots: Erc1822DataSlots\n}\n\nconst readAddressFromSlot = async (provider: Provider, address: string, slot: string, block?: number) => {\n try {\n const slotValue = await provider.getStorage(address, slot, block)\n return hexFromHexString(slotValue, { prefix: true })\n } catch {\n return\n }\n}\n\nexport const getErc1822SlotStatus = async (provider: Provider, address: string, block?: number): Promise<Erc1822SlotStatus> => {\n const status: Erc1822SlotStatus = {\n address,\n implementation: address,\n slots: {\n implementation: await readAddressFromSlot(provider, address, ERC1822_PROXY_LOGIC_SLOT, block),\n },\n }\n\n if (status.slots.implementation && !isHexZero(status.slots.implementation)) {\n status.implementation = status.slots.implementation\n }\n\n return status\n}\n","import { Payload } from '@xyo-network/payload-model'\n\nimport { Erc1822SlotStatus } from './lib'\n\nexport const Erc1822StatusSchema = 'network.xyo.erc1822.status'\nexport type Erc1822StatusSchema = typeof Erc1822StatusSchema\n\nexport type Erc1822Status = Payload<\n {\n address: string\n block: number\n chainId: number\n implementation?: Erc1822SlotStatus['implementation']\n slots?: Erc1822SlotStatus['slots']\n },\n Erc1822StatusSchema\n>\n","import { assertEx } from '@xylabs/assert'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { AbstractEvmWitness, EvmAddress, EvmAddressSchema, EvmWitnessConfig, EvmWitnessParams } from '@xyo-network/witness-evm-abstract'\n\nimport { getErc1822SlotStatus } from './lib'\nimport { Erc1822Status, Erc1822StatusSchema } from './Payload'\n\nexport const Erc1822WitnessConfigSchema = 'network.xyo.erc1822.witness.config'\nexport type Erc1822WitnessConfigSchema = typeof Erc1822WitnessConfigSchema\n\nexport type Erc1822WitnessConfig = EvmWitnessConfig<{ address?: string }, Erc1822WitnessConfigSchema>\n\nexport type Erc1822WitnessParams = EvmWitnessParams<Erc1822WitnessConfig>\n\nexport class Erc1822Witness<TParams extends Erc1822WitnessParams = Erc1822WitnessParams> extends AbstractEvmWitness<\n TParams,\n EvmAddress,\n Erc1822Status\n> {\n static override configSchemas = [Erc1822WitnessConfigSchema]\n\n protected override async observeHandler(inPayloads: EvmAddress[] = []): Promise<Erc1822Status[]> {\n await this.started('throw')\n //calling it here to make sure we rests the cache\n await this.getProviders()\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType(EvmAddressSchema)).map(async ({ address }) => {\n const validatedAddress = assertEx(address ?? this.config.address, 'Missing address').toLowerCase()\n\n const provider = await this.getProvider(true, true)\n\n const block = await provider.getBlockNumber()\n\n const { implementation, slots } = await getErc1822SlotStatus(provider, validatedAddress, block)\n\n const observation: Erc1822Status = {\n address: validatedAddress,\n block,\n chainId: Number((await provider.getNetwork()).chainId),\n implementation,\n schema: Erc1822StatusSchema,\n slots,\n }\n return observation\n }),\n )\n return observations\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAqD;AAG9C,IAAM,2BAA2B;AAYxC,IAAM,sBAAsB,OAAO,UAAoB,SAAiB,MAAc,UAAmB;AACvG,MAAI;AACF,UAAM,YAAY,MAAM,SAAS,WAAW,SAAS,MAAM,KAAK;AAChE,eAAO,6BAAiB,WAAW,EAAE,QAAQ,KAAK,CAAC;AAAA,EACrD,QAAQ;AACN;AAAA,EACF;AACF;AAEO,IAAM,uBAAuB,OAAO,UAAoB,SAAiB,UAA+C;AAC7H,QAAM,SAA4B;AAAA,IAChC;AAAA,IACA,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACL,gBAAgB,MAAM,oBAAoB,UAAU,SAAS,0BAA0B,KAAK;AAAA,IAC9F;AAAA,EACF;AAEA,MAAI,OAAO,MAAM,kBAAkB,KAAC,sBAAU,OAAO,MAAM,cAAc,GAAG;AAC1E,WAAO,iBAAiB,OAAO,MAAM;AAAA,EACvC;AAEA,SAAO;AACT;;;AClCO,IAAM,sBAAsB;;;ACJnC,oBAAyB;AACzB,2BAAsC;AACtC,kCAAqG;AAK9F,IAAM,6BAA6B;AAOnC,IAAM,iBAAN,cAA0F,+CAI/F;AAAA,EACA,OAAgB,gBAAgB,CAAC,0BAA0B;AAAA,EAE3D,MAAyB,eAAe,aAA2B,CAAC,GAA6B;AAC/F,UAAM,KAAK,QAAQ,OAAO;AAE1B,UAAM,KAAK,aAAa;AACxB,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,WAAO,4CAAsB,4CAAgB,CAAC,EAAE,IAAI,OAAO,EAAE,QAAQ,MAAM;AACpF,gBAAM,uBAAmB,wBAAS,WAAW,KAAK,OAAO,SAAS,iBAAiB,EAAE,YAAY;AAEjG,gBAAM,WAAW,MAAM,KAAK,YAAY,MAAM,IAAI;AAElD,gBAAM,QAAQ,MAAM,SAAS,eAAe;AAE5C,gBAAM,EAAE,gBAAgB,MAAM,IAAI,MAAM,qBAAqB,UAAU,kBAAkB,KAAK;AAE9F,gBAAM,cAA6B;AAAA,YACjC,SAAS;AAAA,YACT;AAAA,YACA,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,YACrD;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,UACF;AACA,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/getErc1822SlotStatus.ts","../../src/Payload.ts","../../src/Witness.ts"],"sourcesContent":["import { Address, hexFromHexString, isHexZero } from '@xylabs/hex'\nimport type { Provider } from 'ethers'\n\nexport const ERC1822_PROXY_LOGIC_SLOT = '0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7'\n\nexport interface Erc1822DataSlots {\n implementation?: Address\n}\n\nexport interface Erc1822SlotStatus {\n address:
|
|
1
|
+
{"version":3,"sources":["../../src/lib/getErc1822SlotStatus.ts","../../src/Payload.ts","../../src/Witness.ts"],"sourcesContent":["import { Address, hexFromHexString, isHexZero } from '@xylabs/hex'\nimport type { Provider } from 'ethers'\n\nexport const ERC1822_PROXY_LOGIC_SLOT = '0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7'\n\nexport interface Erc1822DataSlots {\n implementation?: Address\n}\n\nexport interface Erc1822SlotStatus {\n address: string\n implementation: string\n slots: Erc1822DataSlots\n}\n\nconst readAddressFromSlot = async (provider: Provider, address: string, slot: string, block?: number) => {\n try {\n const slotValue = await provider.getStorage(address, slot, block)\n return hexFromHexString(slotValue, { prefix: true })\n } catch {\n return\n }\n}\n\nexport const getErc1822SlotStatus = async (provider: Provider, address: string, block?: number): Promise<Erc1822SlotStatus> => {\n const status: Erc1822SlotStatus = {\n address,\n implementation: address,\n slots: {\n implementation: await readAddressFromSlot(provider, address, ERC1822_PROXY_LOGIC_SLOT, block),\n },\n }\n\n if (status.slots.implementation && !isHexZero(status.slots.implementation)) {\n status.implementation = status.slots.implementation\n }\n\n return status\n}\n","import { Payload } from '@xyo-network/payload-model'\n\nimport { Erc1822SlotStatus } from './lib'\n\nexport const Erc1822StatusSchema = 'network.xyo.erc1822.status'\nexport type Erc1822StatusSchema = typeof Erc1822StatusSchema\n\nexport type Erc1822Status = Payload<\n {\n address: string\n block: number\n chainId: number\n implementation?: Erc1822SlotStatus['implementation']\n slots?: Erc1822SlotStatus['slots']\n },\n Erc1822StatusSchema\n>\n","import { assertEx } from '@xylabs/assert'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { AbstractEvmWitness, EvmAddress, EvmAddressSchema, EvmWitnessConfig, EvmWitnessParams } from '@xyo-network/witness-evm-abstract'\n\nimport { getErc1822SlotStatus } from './lib'\nimport { Erc1822Status, Erc1822StatusSchema } from './Payload'\n\nexport const Erc1822WitnessConfigSchema = 'network.xyo.erc1822.witness.config'\nexport type Erc1822WitnessConfigSchema = typeof Erc1822WitnessConfigSchema\n\nexport type Erc1822WitnessConfig = EvmWitnessConfig<{ address?: string }, Erc1822WitnessConfigSchema>\n\nexport type Erc1822WitnessParams = EvmWitnessParams<Erc1822WitnessConfig>\n\nexport class Erc1822Witness<TParams extends Erc1822WitnessParams = Erc1822WitnessParams> extends AbstractEvmWitness<\n TParams,\n EvmAddress,\n Erc1822Status\n> {\n static override configSchemas = [Erc1822WitnessConfigSchema]\n\n protected override async observeHandler(inPayloads: EvmAddress[] = []): Promise<Erc1822Status[]> {\n await this.started('throw')\n //calling it here to make sure we rests the cache\n await this.getProviders()\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType(EvmAddressSchema)).map(async ({ address }) => {\n const validatedAddress = assertEx(address ?? this.config.address, 'Missing address').toLowerCase()\n\n const provider = await this.getProvider(true, true)\n\n const block = await provider.getBlockNumber()\n\n const { implementation, slots } = await getErc1822SlotStatus(provider, validatedAddress, block)\n\n const observation: Erc1822Status = {\n address: validatedAddress,\n block,\n chainId: Number((await provider.getNetwork()).chainId),\n implementation,\n schema: Erc1822StatusSchema,\n slots,\n }\n return observation\n }),\n )\n return observations\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n"],"mappings":";AAAA,SAAkB,kBAAkB,iBAAiB;AAG9C,IAAM,2BAA2B;AAYxC,IAAM,sBAAsB,OAAO,UAAoB,SAAiB,MAAc,UAAmB;AACvG,MAAI;AACF,UAAM,YAAY,MAAM,SAAS,WAAW,SAAS,MAAM,KAAK;AAChE,WAAO,iBAAiB,WAAW,EAAE,QAAQ,KAAK,CAAC;AAAA,EACrD,QAAQ;AACN;AAAA,EACF;AACF;AAEO,IAAM,uBAAuB,OAAO,UAAoB,SAAiB,UAA+C;AAC7H,QAAM,SAA4B;AAAA,IAChC;AAAA,IACA,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACL,gBAAgB,MAAM,oBAAoB,UAAU,SAAS,0BAA0B,KAAK;AAAA,IAC9F;AAAA,EACF;AAEA,MAAI,OAAO,MAAM,kBAAkB,CAAC,UAAU,OAAO,MAAM,cAAc,GAAG;AAC1E,WAAO,iBAAiB,OAAO,MAAM;AAAA,EACvC;AAEA,SAAO;AACT;;;AClCO,IAAM,sBAAsB;;;ACJnC,SAAS,gBAAgB;AACzB,SAAS,6BAA6B;AACtC,SAAS,oBAAgC,wBAA4D;AAK9F,IAAM,6BAA6B;AAOnC,IAAM,iBAAN,cAA0F,mBAI/F;AAAA,EACA,OAAgB,gBAAgB,CAAC,0BAA0B;AAAA,EAE3D,MAAyB,eAAe,aAA2B,CAAC,GAA6B;AAC/F,UAAM,KAAK,QAAQ,OAAO;AAE1B,UAAM,KAAK,aAAa;AACxB,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,OAAO,sBAAsB,gBAAgB,CAAC,EAAE,IAAI,OAAO,EAAE,QAAQ,MAAM;AACpF,gBAAM,mBAAmB,SAAS,WAAW,KAAK,OAAO,SAAS,iBAAiB,EAAE,YAAY;AAEjG,gBAAM,WAAW,MAAM,KAAK,YAAY,MAAM,IAAI;AAElD,gBAAM,QAAQ,MAAM,SAAS,eAAe;AAE5C,gBAAM,EAAE,gBAAgB,MAAM,IAAI,MAAM,qBAAqB,UAAU,kBAAkB,KAAK;AAE9F,gBAAM,cAA6B;AAAA,YACjC,SAAS;AAAA,YACT;AAAA,YACA,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,YACrD;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,UACF;AACA,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
|
@@ -5,8 +5,8 @@ export interface Erc1822DataSlots {
|
|
|
5
5
|
implementation?: Address;
|
|
6
6
|
}
|
|
7
7
|
export interface Erc1822SlotStatus {
|
|
8
|
-
address:
|
|
9
|
-
implementation:
|
|
8
|
+
address: string;
|
|
9
|
+
implementation: string;
|
|
10
10
|
slots: Erc1822DataSlots;
|
|
11
11
|
}
|
|
12
12
|
export declare const getErc1822SlotStatus: (provider: Provider, address: string, block?: number) => Promise<Erc1822SlotStatus>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,gBAAgB,CAAA;CACxB;AAWD,eAAO,MAAM,oBAAoB,aAAoB,QAAQ,WAAW,MAAM,UAAU,MAAM,KAAG,QAAQ,iBAAiB,CAczH,CAAA"}
|
|
@@ -5,8 +5,8 @@ export interface Erc1822DataSlots {
|
|
|
5
5
|
implementation?: Address;
|
|
6
6
|
}
|
|
7
7
|
export interface Erc1822SlotStatus {
|
|
8
|
-
address:
|
|
9
|
-
implementation:
|
|
8
|
+
address: string;
|
|
9
|
+
implementation: string;
|
|
10
10
|
slots: Erc1822DataSlots;
|
|
11
11
|
}
|
|
12
12
|
export declare const getErc1822SlotStatus: (provider: Provider, address: string, block?: number) => Promise<Erc1822SlotStatus>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,gBAAgB,CAAA;CACxB;AAWD,eAAO,MAAM,oBAAoB,aAAoB,QAAQ,WAAW,MAAM,UAAU,MAAM,KAAG,QAAQ,iBAAiB,CAczH,CAAA"}
|
|
@@ -5,8 +5,8 @@ export interface Erc1822DataSlots {
|
|
|
5
5
|
implementation?: Address;
|
|
6
6
|
}
|
|
7
7
|
export interface Erc1822SlotStatus {
|
|
8
|
-
address:
|
|
9
|
-
implementation:
|
|
8
|
+
address: string;
|
|
9
|
+
implementation: string;
|
|
10
10
|
slots: Erc1822DataSlots;
|
|
11
11
|
}
|
|
12
12
|
export declare const getErc1822SlotStatus: (provider: Provider, address: string, block?: number) => Promise<Erc1822SlotStatus>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,gBAAgB,CAAA;CACxB;AAWD,eAAO,MAAM,oBAAoB,aAAoB,QAAQ,WAAW,MAAM,UAAU,MAAM,KAAG,QAAQ,iBAAiB,CAczH,CAAA"}
|
package/dist/node/Payload.d.cts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex';
|
|
2
1
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
2
|
import { Erc1822SlotStatus } from './lib';
|
|
4
3
|
export declare const Erc1822StatusSchema = "network.xyo.erc1822.status";
|
|
5
4
|
export type Erc1822StatusSchema = typeof Erc1822StatusSchema;
|
|
6
5
|
export type Erc1822Status = Payload<{
|
|
7
|
-
address:
|
|
6
|
+
address: string;
|
|
8
7
|
block: number;
|
|
9
8
|
chainId: number;
|
|
10
9
|
implementation?: Erc1822SlotStatus['implementation'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,mBAAmB,+BAA+B,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,MAAM,MAAM,aAAa,GAAG,OAAO,CACjC;IACE,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;CACnC,EACD,mBAAmB,CACpB,CAAA"}
|
package/dist/node/Payload.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex';
|
|
2
1
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
2
|
import { Erc1822SlotStatus } from './lib';
|
|
4
3
|
export declare const Erc1822StatusSchema = "network.xyo.erc1822.status";
|
|
5
4
|
export type Erc1822StatusSchema = typeof Erc1822StatusSchema;
|
|
6
5
|
export type Erc1822Status = Payload<{
|
|
7
|
-
address:
|
|
6
|
+
address: string;
|
|
8
7
|
block: number;
|
|
9
8
|
chainId: number;
|
|
10
9
|
implementation?: Erc1822SlotStatus['implementation'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,mBAAmB,+BAA+B,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,MAAM,MAAM,aAAa,GAAG,OAAO,CACjC;IACE,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;CACnC,EACD,mBAAmB,CACpB,CAAA"}
|
package/dist/node/Payload.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex';
|
|
2
1
|
import { Payload } from '@xyo-network/payload-model';
|
|
3
2
|
import { Erc1822SlotStatus } from './lib';
|
|
4
3
|
export declare const Erc1822StatusSchema = "network.xyo.erc1822.status";
|
|
5
4
|
export type Erc1822StatusSchema = typeof Erc1822StatusSchema;
|
|
6
5
|
export type Erc1822Status = Payload<{
|
|
7
|
-
address:
|
|
6
|
+
address: string;
|
|
8
7
|
block: number;
|
|
9
8
|
chainId: number;
|
|
10
9
|
implementation?: Erc1822SlotStatus['implementation'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"Payload.d.ts","sourceRoot":"","sources":["../../src/Payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAEzC,eAAO,MAAM,mBAAmB,+BAA+B,CAAA;AAC/D,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAA;AAE5D,MAAM,MAAM,aAAa,GAAG,OAAO,CACjC;IACE,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IACpD,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;CACnC,EACD,mBAAmB,CACpB,CAAA"}
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.ts","../../src/lib/getErc1822SlotStatus.ts","../../src/Payload.ts","../../src/Witness.ts"],"sourcesContent":["export * from './lib'\nexport * from './Payload'\nexport * from './Witness'\n","import { Address, hexFromHexString, isHexZero } from '@xylabs/hex'\nimport type { Provider } from 'ethers'\n\nexport const ERC1822_PROXY_LOGIC_SLOT = '0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7'\n\nexport interface Erc1822DataSlots {\n implementation?: Address\n}\n\nexport interface Erc1822SlotStatus {\n address:
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts","../../src/lib/getErc1822SlotStatus.ts","../../src/Payload.ts","../../src/Witness.ts"],"sourcesContent":["export * from './lib'\nexport * from './Payload'\nexport * from './Witness'\n","import { Address, hexFromHexString, isHexZero } from '@xylabs/hex'\nimport type { Provider } from 'ethers'\n\nexport const ERC1822_PROXY_LOGIC_SLOT = '0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7'\n\nexport interface Erc1822DataSlots {\n implementation?: Address\n}\n\nexport interface Erc1822SlotStatus {\n address: string\n implementation: string\n slots: Erc1822DataSlots\n}\n\nconst readAddressFromSlot = async (provider: Provider, address: string, slot: string, block?: number) => {\n try {\n const slotValue = await provider.getStorage(address, slot, block)\n return hexFromHexString(slotValue, { prefix: true })\n } catch {\n return\n }\n}\n\nexport const getErc1822SlotStatus = async (provider: Provider, address: string, block?: number): Promise<Erc1822SlotStatus> => {\n const status: Erc1822SlotStatus = {\n address,\n implementation: address,\n slots: {\n implementation: await readAddressFromSlot(provider, address, ERC1822_PROXY_LOGIC_SLOT, block),\n },\n }\n\n if (status.slots.implementation && !isHexZero(status.slots.implementation)) {\n status.implementation = status.slots.implementation\n }\n\n return status\n}\n","import { Payload } from '@xyo-network/payload-model'\n\nimport { Erc1822SlotStatus } from './lib'\n\nexport const Erc1822StatusSchema = 'network.xyo.erc1822.status'\nexport type Erc1822StatusSchema = typeof Erc1822StatusSchema\n\nexport type Erc1822Status = Payload<\n {\n address: string\n block: number\n chainId: number\n implementation?: Erc1822SlotStatus['implementation']\n slots?: Erc1822SlotStatus['slots']\n },\n Erc1822StatusSchema\n>\n","import { assertEx } from '@xylabs/assert'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { AbstractEvmWitness, EvmAddress, EvmAddressSchema, EvmWitnessConfig, EvmWitnessParams } from '@xyo-network/witness-evm-abstract'\n\nimport { getErc1822SlotStatus } from './lib'\nimport { Erc1822Status, Erc1822StatusSchema } from './Payload'\n\nexport const Erc1822WitnessConfigSchema = 'network.xyo.erc1822.witness.config'\nexport type Erc1822WitnessConfigSchema = typeof Erc1822WitnessConfigSchema\n\nexport type Erc1822WitnessConfig = EvmWitnessConfig<{ address?: string }, Erc1822WitnessConfigSchema>\n\nexport type Erc1822WitnessParams = EvmWitnessParams<Erc1822WitnessConfig>\n\nexport class Erc1822Witness<TParams extends Erc1822WitnessParams = Erc1822WitnessParams> extends AbstractEvmWitness<\n TParams,\n EvmAddress,\n Erc1822Status\n> {\n static override configSchemas = [Erc1822WitnessConfigSchema]\n\n protected override async observeHandler(inPayloads: EvmAddress[] = []): Promise<Erc1822Status[]> {\n await this.started('throw')\n //calling it here to make sure we rests the cache\n await this.getProviders()\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType(EvmAddressSchema)).map(async ({ address }) => {\n const validatedAddress = assertEx(address ?? this.config.address, 'Missing address').toLowerCase()\n\n const provider = await this.getProvider(true, true)\n\n const block = await provider.getBlockNumber()\n\n const { implementation, slots } = await getErc1822SlotStatus(provider, validatedAddress, block)\n\n const observation: Erc1822Status = {\n address: validatedAddress,\n block,\n chainId: Number((await provider.getNetwork()).chainId),\n implementation,\n schema: Erc1822StatusSchema,\n slots,\n }\n return observation\n }),\n )\n return observations\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAqD;AAG9C,IAAM,2BAA2B;AAYxC,IAAM,sBAAsB,OAAO,UAAoB,SAAiB,MAAc,UAAmB;AACvG,MAAI;AACF,UAAM,YAAY,MAAM,SAAS,WAAW,SAAS,MAAM,KAAK;AAChE,eAAO,6BAAiB,WAAW,EAAE,QAAQ,KAAK,CAAC;AAAA,EACrD,QAAQ;AACN;AAAA,EACF;AACF;AAEO,IAAM,uBAAuB,OAAO,UAAoB,SAAiB,UAA+C;AAC7H,QAAM,SAA4B;AAAA,IAChC;AAAA,IACA,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACL,gBAAgB,MAAM,oBAAoB,UAAU,SAAS,0BAA0B,KAAK;AAAA,IAC9F;AAAA,EACF;AAEA,MAAI,OAAO,MAAM,kBAAkB,KAAC,sBAAU,OAAO,MAAM,cAAc,GAAG;AAC1E,WAAO,iBAAiB,OAAO,MAAM;AAAA,EACvC;AAEA,SAAO;AACT;;;AClCO,IAAM,sBAAsB;;;ACJnC,oBAAyB;AACzB,2BAAsC;AACtC,kCAAqG;AAK9F,IAAM,6BAA6B;AAOnC,IAAM,iBAAN,cAA0F,+CAI/F;AAAA,EACA,OAAgB,gBAAgB,CAAC,0BAA0B;AAAA,EAE3D,MAAyB,eAAe,aAA2B,CAAC,GAA6B;AAC/F,UAAM,KAAK,QAAQ,OAAO;AAE1B,UAAM,KAAK,aAAa;AACxB,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,WAAO,4CAAsB,4CAAgB,CAAC,EAAE,IAAI,OAAO,EAAE,QAAQ,MAAM;AACpF,gBAAM,uBAAmB,wBAAS,WAAW,KAAK,OAAO,SAAS,iBAAiB,EAAE,YAAY;AAEjG,gBAAM,WAAW,MAAM,KAAK,YAAY,MAAM,IAAI;AAElD,gBAAM,QAAQ,MAAM,SAAS,eAAe;AAE5C,gBAAM,EAAE,gBAAgB,MAAM,IAAI,MAAM,qBAAqB,UAAU,kBAAkB,KAAK;AAE9F,gBAAM,cAA6B;AAAA,YACjC,SAAS;AAAA,YACT;AAAA,YACA,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,YACrD;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,UACF;AACA,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
package/dist/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/getErc1822SlotStatus.ts","../../src/Payload.ts","../../src/Witness.ts"],"sourcesContent":["import { Address, hexFromHexString, isHexZero } from '@xylabs/hex'\nimport type { Provider } from 'ethers'\n\nexport const ERC1822_PROXY_LOGIC_SLOT = '0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7'\n\nexport interface Erc1822DataSlots {\n implementation?: Address\n}\n\nexport interface Erc1822SlotStatus {\n address:
|
|
1
|
+
{"version":3,"sources":["../../src/lib/getErc1822SlotStatus.ts","../../src/Payload.ts","../../src/Witness.ts"],"sourcesContent":["import { Address, hexFromHexString, isHexZero } from '@xylabs/hex'\nimport type { Provider } from 'ethers'\n\nexport const ERC1822_PROXY_LOGIC_SLOT = '0xc5f16f0fcc639fa48a6947836d9850f504798523bf8c9a3a87d5876cf622bcf7'\n\nexport interface Erc1822DataSlots {\n implementation?: Address\n}\n\nexport interface Erc1822SlotStatus {\n address: string\n implementation: string\n slots: Erc1822DataSlots\n}\n\nconst readAddressFromSlot = async (provider: Provider, address: string, slot: string, block?: number) => {\n try {\n const slotValue = await provider.getStorage(address, slot, block)\n return hexFromHexString(slotValue, { prefix: true })\n } catch {\n return\n }\n}\n\nexport const getErc1822SlotStatus = async (provider: Provider, address: string, block?: number): Promise<Erc1822SlotStatus> => {\n const status: Erc1822SlotStatus = {\n address,\n implementation: address,\n slots: {\n implementation: await readAddressFromSlot(provider, address, ERC1822_PROXY_LOGIC_SLOT, block),\n },\n }\n\n if (status.slots.implementation && !isHexZero(status.slots.implementation)) {\n status.implementation = status.slots.implementation\n }\n\n return status\n}\n","import { Payload } from '@xyo-network/payload-model'\n\nimport { Erc1822SlotStatus } from './lib'\n\nexport const Erc1822StatusSchema = 'network.xyo.erc1822.status'\nexport type Erc1822StatusSchema = typeof Erc1822StatusSchema\n\nexport type Erc1822Status = Payload<\n {\n address: string\n block: number\n chainId: number\n implementation?: Erc1822SlotStatus['implementation']\n slots?: Erc1822SlotStatus['slots']\n },\n Erc1822StatusSchema\n>\n","import { assertEx } from '@xylabs/assert'\nimport { isPayloadOfSchemaType } from '@xyo-network/payload-model'\nimport { AbstractEvmWitness, EvmAddress, EvmAddressSchema, EvmWitnessConfig, EvmWitnessParams } from '@xyo-network/witness-evm-abstract'\n\nimport { getErc1822SlotStatus } from './lib'\nimport { Erc1822Status, Erc1822StatusSchema } from './Payload'\n\nexport const Erc1822WitnessConfigSchema = 'network.xyo.erc1822.witness.config'\nexport type Erc1822WitnessConfigSchema = typeof Erc1822WitnessConfigSchema\n\nexport type Erc1822WitnessConfig = EvmWitnessConfig<{ address?: string }, Erc1822WitnessConfigSchema>\n\nexport type Erc1822WitnessParams = EvmWitnessParams<Erc1822WitnessConfig>\n\nexport class Erc1822Witness<TParams extends Erc1822WitnessParams = Erc1822WitnessParams> extends AbstractEvmWitness<\n TParams,\n EvmAddress,\n Erc1822Status\n> {\n static override configSchemas = [Erc1822WitnessConfigSchema]\n\n protected override async observeHandler(inPayloads: EvmAddress[] = []): Promise<Erc1822Status[]> {\n await this.started('throw')\n //calling it here to make sure we rests the cache\n await this.getProviders()\n try {\n const observations = await Promise.all(\n inPayloads.filter(isPayloadOfSchemaType(EvmAddressSchema)).map(async ({ address }) => {\n const validatedAddress = assertEx(address ?? this.config.address, 'Missing address').toLowerCase()\n\n const provider = await this.getProvider(true, true)\n\n const block = await provider.getBlockNumber()\n\n const { implementation, slots } = await getErc1822SlotStatus(provider, validatedAddress, block)\n\n const observation: Erc1822Status = {\n address: validatedAddress,\n block,\n chainId: Number((await provider.getNetwork()).chainId),\n implementation,\n schema: Erc1822StatusSchema,\n slots,\n }\n return observation\n }),\n )\n return observations\n } catch (ex) {\n const error = ex as Error\n console.log(`Error [${this.config.name}]: ${error.message}`)\n throw error\n }\n }\n}\n"],"mappings":";AAAA,SAAkB,kBAAkB,iBAAiB;AAG9C,IAAM,2BAA2B;AAYxC,IAAM,sBAAsB,OAAO,UAAoB,SAAiB,MAAc,UAAmB;AACvG,MAAI;AACF,UAAM,YAAY,MAAM,SAAS,WAAW,SAAS,MAAM,KAAK;AAChE,WAAO,iBAAiB,WAAW,EAAE,QAAQ,KAAK,CAAC;AAAA,EACrD,QAAQ;AACN;AAAA,EACF;AACF;AAEO,IAAM,uBAAuB,OAAO,UAAoB,SAAiB,UAA+C;AAC7H,QAAM,SAA4B;AAAA,IAChC;AAAA,IACA,gBAAgB;AAAA,IAChB,OAAO;AAAA,MACL,gBAAgB,MAAM,oBAAoB,UAAU,SAAS,0BAA0B,KAAK;AAAA,IAC9F;AAAA,EACF;AAEA,MAAI,OAAO,MAAM,kBAAkB,CAAC,UAAU,OAAO,MAAM,cAAc,GAAG;AAC1E,WAAO,iBAAiB,OAAO,MAAM;AAAA,EACvC;AAEA,SAAO;AACT;;;AClCO,IAAM,sBAAsB;;;ACJnC,SAAS,gBAAgB;AACzB,SAAS,6BAA6B;AACtC,SAAS,oBAAgC,wBAA4D;AAK9F,IAAM,6BAA6B;AAOnC,IAAM,iBAAN,cAA0F,mBAI/F;AAAA,EACA,OAAgB,gBAAgB,CAAC,0BAA0B;AAAA,EAE3D,MAAyB,eAAe,aAA2B,CAAC,GAA6B;AAC/F,UAAM,KAAK,QAAQ,OAAO;AAE1B,UAAM,KAAK,aAAa;AACxB,QAAI;AACF,YAAM,eAAe,MAAM,QAAQ;AAAA,QACjC,WAAW,OAAO,sBAAsB,gBAAgB,CAAC,EAAE,IAAI,OAAO,EAAE,QAAQ,MAAM;AACpF,gBAAM,mBAAmB,SAAS,WAAW,KAAK,OAAO,SAAS,iBAAiB,EAAE,YAAY;AAEjG,gBAAM,WAAW,MAAM,KAAK,YAAY,MAAM,IAAI;AAElD,gBAAM,QAAQ,MAAM,SAAS,eAAe;AAE5C,gBAAM,EAAE,gBAAgB,MAAM,IAAI,MAAM,qBAAqB,UAAU,kBAAkB,KAAK;AAE9F,gBAAM,cAA6B;AAAA,YACjC,SAAS;AAAA,YACT;AAAA,YACA,SAAS,QAAQ,MAAM,SAAS,WAAW,GAAG,OAAO;AAAA,YACrD;AAAA,YACA,QAAQ;AAAA,YACR;AAAA,UACF;AACA,iBAAO;AAAA,QACT,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT,SAAS,IAAI;AACX,YAAM,QAAQ;AACd,cAAQ,IAAI,UAAU,KAAK,OAAO,IAAI,MAAM,MAAM,OAAO,EAAE;AAC3D,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
|
|
@@ -5,8 +5,8 @@ export interface Erc1822DataSlots {
|
|
|
5
5
|
implementation?: Address;
|
|
6
6
|
}
|
|
7
7
|
export interface Erc1822SlotStatus {
|
|
8
|
-
address:
|
|
9
|
-
implementation:
|
|
8
|
+
address: string;
|
|
9
|
+
implementation: string;
|
|
10
10
|
slots: Erc1822DataSlots;
|
|
11
11
|
}
|
|
12
12
|
export declare const getErc1822SlotStatus: (provider: Provider, address: string, block?: number) => Promise<Erc1822SlotStatus>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,gBAAgB,CAAA;CACxB;AAWD,eAAO,MAAM,oBAAoB,aAAoB,QAAQ,WAAW,MAAM,UAAU,MAAM,KAAG,QAAQ,iBAAiB,CAczH,CAAA"}
|
|
@@ -5,8 +5,8 @@ export interface Erc1822DataSlots {
|
|
|
5
5
|
implementation?: Address;
|
|
6
6
|
}
|
|
7
7
|
export interface Erc1822SlotStatus {
|
|
8
|
-
address:
|
|
9
|
-
implementation:
|
|
8
|
+
address: string;
|
|
9
|
+
implementation: string;
|
|
10
10
|
slots: Erc1822DataSlots;
|
|
11
11
|
}
|
|
12
12
|
export declare const getErc1822SlotStatus: (provider: Provider, address: string, block?: number) => Promise<Erc1822SlotStatus>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,gBAAgB,CAAA;CACxB;AAWD,eAAO,MAAM,oBAAoB,aAAoB,QAAQ,WAAW,MAAM,UAAU,MAAM,KAAG,QAAQ,iBAAiB,CAczH,CAAA"}
|
|
@@ -5,8 +5,8 @@ export interface Erc1822DataSlots {
|
|
|
5
5
|
implementation?: Address;
|
|
6
6
|
}
|
|
7
7
|
export interface Erc1822SlotStatus {
|
|
8
|
-
address:
|
|
9
|
-
implementation:
|
|
8
|
+
address: string;
|
|
9
|
+
implementation: string;
|
|
10
10
|
slots: Erc1822DataSlots;
|
|
11
11
|
}
|
|
12
12
|
export declare const getErc1822SlotStatus: (provider: Provider, address: string, block?: number) => Promise<Erc1822SlotStatus>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"getErc1822SlotStatus.d.ts","sourceRoot":"","sources":["../../../src/lib/getErc1822SlotStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA+B,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAEtC,eAAO,MAAM,wBAAwB,uEAAuE,CAAA;AAE5G,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,gBAAgB,CAAA;CACxB;AAWD,eAAO,MAAM,oBAAoB,aAAoB,QAAQ,WAAW,MAAM,UAAU,MAAM,KAAG,QAAQ,iBAAiB,CAczH,CAAA"}
|
package/package.json
CHANGED
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
"url": "https://github.com/XYOracleNetwork/plugins/issues"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xylabs/assert": "^
|
|
14
|
-
"@xylabs/hex": "^
|
|
15
|
-
"@xyo-network/payload-model": "^2.
|
|
16
|
-
"@xyo-network/witness-evm-abstract": "^2.
|
|
13
|
+
"@xylabs/assert": "^3.0.1",
|
|
14
|
+
"@xylabs/hex": "^3.0.1",
|
|
15
|
+
"@xyo-network/payload-model": "^2.91.0",
|
|
16
|
+
"@xyo-network/witness-evm-abstract": "^2.91.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@xylabs/jest-helpers": "^
|
|
20
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
21
|
-
"@xylabs/tsconfig": "^3.
|
|
19
|
+
"@xylabs/jest-helpers": "^3.0.1",
|
|
20
|
+
"@xylabs/ts-scripts-yarn3": "^3.4.1",
|
|
21
|
+
"@xylabs/tsconfig": "^3.4.1",
|
|
22
22
|
"ethers": "^6.11.1",
|
|
23
23
|
"jest": "^29.7.0",
|
|
24
24
|
"typescript": "^5.3.3"
|
|
@@ -62,6 +62,6 @@
|
|
|
62
62
|
"url": "https://github.com/XYOracleNetwork/plugins.git"
|
|
63
63
|
},
|
|
64
64
|
"sideEffects": false,
|
|
65
|
-
"version": "2.
|
|
65
|
+
"version": "2.88.0",
|
|
66
66
|
"type": "module"
|
|
67
67
|
}
|
package/src/Payload.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Address } from '@xylabs/hex'
|
|
2
1
|
import { Payload } from '@xyo-network/payload-model'
|
|
3
2
|
|
|
4
3
|
import { Erc1822SlotStatus } from './lib'
|
|
@@ -8,7 +7,7 @@ export type Erc1822StatusSchema = typeof Erc1822StatusSchema
|
|
|
8
7
|
|
|
9
8
|
export type Erc1822Status = Payload<
|
|
10
9
|
{
|
|
11
|
-
address:
|
|
10
|
+
address: string
|
|
12
11
|
block: number
|
|
13
12
|
chainId: number
|
|
14
13
|
implementation?: Erc1822SlotStatus['implementation']
|
|
@@ -8,8 +8,8 @@ export interface Erc1822DataSlots {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export interface Erc1822SlotStatus {
|
|
11
|
-
address:
|
|
12
|
-
implementation:
|
|
11
|
+
address: string
|
|
12
|
+
implementation: string
|
|
13
13
|
slots: Erc1822DataSlots
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -32,7 +32,7 @@ export const getErc1822SlotStatus = async (provider: Provider, address: string,
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (status.slots.implementation && !isHexZero(status.slots.implementation)) {
|
|
35
|
-
status.implementation = status.slots.implementation
|
|
35
|
+
status.implementation = status.slots.implementation
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
return status
|