diff --git a/.github/workflows/ts-client-integration-test.yml b/.github/workflows/ts-client-integration-test.yml index 24d997f..369efd4 100644 --- a/.github/workflows/ts-client-integration-test.yml +++ b/.github/workflows/ts-client-integration-test.yml @@ -16,7 +16,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 - + - name: Set Node.js 16.x uses: actions/setup-node@v3 with: @@ -24,11 +24,11 @@ jobs: - name: Install Dev Dependencies working-directory: ./ts-client - run: npm install + run: yarn install --frozen-lockfile - name: Run Anvil Node run: anvil & - name: Run tests working-directory: ./ts-client - run: npm run integration-test \ No newline at end of file + run: yarn run test:integration diff --git a/.gitignore b/.gitignore index c5077c4..5bb89b1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,9 @@ node_modules/ /broadcast/**/dry-run/ # ts-client files -ts-client/node_modules -ts-client/types +ts-client/dist/ +ts-client/node_modules/ +ts-client/src/contracts/typechain-types/ ts-client/yarn.lock # Dotenv file .env diff --git a/ts-client/README.md b/ts-client/README.md index 027ffff..588d0ac 100644 --- a/ts-client/README.md +++ b/ts-client/README.md @@ -1,9 +1,172 @@ -# DID bnb typescript client +# `did:bnb` Client + +A typescript client library for registering, manipulating, and resolving DIDs +using the `did:bnb` method. + +## Features +The `@identity.com/did-bnb-client` library provides the following features: + +1. A W3C [DID core spec (v1.0)](https://www.w3.org/TR/did-core/) compliant DID method and resolver operating on the Binance Smart Chain (BSC). +2. TS Client for creating, manipulating, and resolving `did:bnb`. +3. Generic Support for VerificationMethods of any Type and Key length. +4. Native on-chain support for `EcdsaSecp256k1RecoveryMethod2020`. +5. A web-service driver, compatible with [uniresolver.io](https://unresolver.io) and [uniregistrar.io](https://uniregistrar.io). +6. Introduced `OWNERSHIP_PROOF` to indicate that a Verification Method Key signature was verified on-chain. +7. Introduced `DID_DOC_HIDDEN` flag that enables hiding a Verification Method from the DID resolution. + +## Client library +### Installation +In the command line of the project folder, type the following and then press **Enter**: +```shell +yarn add @identity.com/did-bnb-client # +``` + +or + +```shell +npm install @identity.com/did-bnb-client +``` + +### Contract Addresses +The BNB DID Registry contract is deployed at the following address (via proxy): +- Testnet: [0x88a05b4370BbB90c9F3EEa72A65c77131a7bc18d](https://testnet.bscscan.com/address/0x88a05b4370BbB90c9F3EEa72A65c77131a7bc18d) +- Mainnet: TODO + +### Usage - Setup and Resolution +Create a service for a `did:bnb` by using the following code snippet: + +#### Via Provider (read-only) +```typescript +const address = "0x88a05b4370BbB90c9F3EEa72A65c77131a7bc18d"; +const provider = getDefaultProvider(process.env.RPC_URL); // e.g. https://bsc-testnet.publicnode.com +const chainEnv: ChainEnviroment = 'tesnet'; +const didRegistry = new DidRegistry(provider, address, {chainEnvironment: 'localnet'}); +// ... use didRegistry client +const randomDid = DidIdentifier.create( + Wallet.createRandom().address, + didRegistry.getDid().chainEnviroment +); +didRegistry.resolve(randomDid) + .then((didDocument) => { + console.log(didDocument); + }) + .catch((error) => { + console.log(error); + }); +``` + +#### Via Wallet +```typescript + const address = "0x88a05b4370BbB90c9F3EEa72A65c77131a7bc18d"; + const provider = getDefaultProvider(process.env.RPC_URL); // e.g. https://bsc-testnet.publicnode.com + const randomWallet = Wallet.createRandom().connect(provider); + const chainEnv: ChainEnviroment = 'tesnet'; + const didRegistry = new DidRegistry(randomWallet, address, {chainEnvironment: 'localnet'}); + // ... use didRegistry client + // not passing a DID will resolve the DID of the wallet address + didRegistry.resolve() + .then((didDocument) => { + console.log(didDocument); + }) + .catch((error) => { + console.log(error); + }); +``` +### DID resolution information +`did:bnb` DIDs are resolved in the following way: +1. `Generative` DIDs are DIDs that have no persisted DID account. (e.g. every valid EOA address is in this state). + This will return a generative DID document where only the public key of the Account is a valid Verification Method. +2. `Persisted` DIDs are DIDs that have a persisted DID account. Here the DID document represents the state that is found + on-chain. + +### Check generative state (read-only) +```typescript + // can optionally take a DIDIdentifier as a parameter + const isGenerative: boolean = await didRegistry.isGenerativeDidState(); +``` + +### Init a DID on-chain + +```typescript +const tx: ContractTransaction = await didRegistry.initializeDidState(); +``` + +### Add a VerificationMethod +This operation adds a new Verification Method to the DID. The `keyData` can be a generically sized `UInt8Array`, but logically it must match the `methodType` specified. + +```typescript +const verificationMethod = { + fragment: 'test', + flags: reduceVmFlagArray([ + BitwiseVerificationMethodFlag.CapabilityInvocation, + ]), + methodType: VerificationMethodType.EcdsaSecp256k1RecoveryMethod2020, + keyData: utils.arrayify(Wallet.createRandom().address), +}; +const tx: ContractTransaction = await didRegistry.addVerificationMethod(verificationMethod); +``` + +### Remove a VerificationMethod +This code removes a Verification Method with the given `fragment` from the DID. It is important to keep at least one valid Verification Method with a Capability Invocation flag to prevent a lockout. + +```typescript +const tx: ContractTransaction = await didRegistry.removeVerificationMethod('test'); +``` + +### Add a Service +This operation sets a new service on a DID. `serviceType` are strings, not enums, and can therefore be freely defined. + +```typescript + const service = { + fragment: 'test2', + service_type: 'testType', + service_endpoint: 'testEndpoint', + }; + const tx: ContractTransaction = await didRegistry.addService(service); +``` + +### Remove a Service +This operation removes a service with the given `fragment` name from the DID. + +```typescript + const tx: ContractTransaction = await didRegistry.removeService('test2'); +``` + +### Set VerificationMethodFlags +This sets/updates the flag on an existing VerificationMethod. **Important** if the flag contains `VerificationMethodFlags.OwnershipProof` +this transaction MUST use the same authority as the Verification Method. (e.g. proving that the owner can sign with +that specific VM). + +```typescript + const tx: ContractTransaction = await didRegistry + .setVerificationMethodFlags('test', [ + BitwiseVerificationMethodFlag.Authentication, + ]); +``` + +### Add Native Controller (did:bnb - DID) +```typescript + const randomWallet = Wallet.createRandom(); + const nativeController = DidIdentifier.create( + randomWallet.address, + didRegistry.getDid().chainEnviroment + ); + const tx: ContractTransaction = await didRegistry + .addNativeController(nativeController); +``` + +### Add External Controller (non-did:bnb DID) +```typescript + const externalController = `did:ethr:${Wallet.createRandom().address}`; + + const tx: ContractTransaction = await didRegistry + .addExternalController(externalController); +``` ## Local Integration Test Setup -This repository uses `jest` to run integration test. These test will run against whatever `RPC_URL` is provided in the `.env` file. +This repository uses `test:integration` to run integration test. These test will run against whatever `RPC_URL` is provided in the `.env` file. -To run the integration test navigate to the `ts-client` directory and run `yarn jest` +To run the integration test navigate to the `ts-client` directory and run `yarn run test:integration`. ### Testing with Foundry Foundry has a built in testnet node called `anvil`. You can first download foundry by following the [steps here](https://book.getfoundry.sh/getting-started/installation). diff --git a/ts-client/jest.config.ts b/ts-client/jest.config.ts deleted file mode 100644 index 4471107..0000000 --- a/ts-client/jest.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type {Config} from 'jest'; - -export default async (): Promise => { - return { - verbose: true, - preset: "ts-jest", - transform: { - "node_modules/variables/.+\\.(j|t)sx?$": "ts-jest" - }, - transformIgnorePatterns: [ - "node_modules/(?!variables/.*)" - ] - }; -}; \ No newline at end of file diff --git a/ts-client/package.json b/ts-client/package.json index 1aad3dc..655d96b 100644 --- a/ts-client/package.json +++ b/ts-client/package.json @@ -1,26 +1,67 @@ { - "name": "did-bnb-ts-client", - "version": "1.0.0", - "main": "src/index.ts", - "license": "MIT", - "scripts": { - "generate-contract-types": "typechain --target=ethers-v6 ./abi/DIDRegistry.json", - "spawn-devnet": "tenderly devnet spawn-rpc --project project --template bnb-testnet", - "integration-test": "jest" - }, - "dependencies": { - "dotenv": "^16.3.1", - "ethers": "^6.7.1" - }, - "devDependencies": { - "@typechain/ethers-v6": "^0.5.0", - "@types/jest": "^29.5.4", - "@types/node": "^20.5.1", - "jest": "^29.6.3", - "tenderly": "^0.5.3", - "ts-jest": "^29.1.1", - "ts-node": "^10.9.1", - "typechain": "^8.3.1", - "typescript": "^5.1.6" + "name": "@identity.com/did-bnb-client", + "version": "1.0.0-beta.1", + "main": "dist/src/index.js", + "typings": "dist/src/index.d.ts", + "license": "MIT", + "author": "Martin Riedel ", + "repository": "https://github.com/identity-com/did-bnb", + "homepage": "https://github.com/identity-com/did-bnb", + "files": [ + "/dist", + "/npm-shrinkwrap.json" + ], + "scripts": { + "postinstall": "$npm_execpath run generate-contract-types", + "lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w", + "lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check", + "clean": "shx rm -rf ./dist", + "compile": "tsc", + "build": "yarn clean && yarn compile", + "prepack": "yarn build", + "generate-contract-types": "typechain --target=ethers-v5 --out-dir ./src/contracts/typechain-types ./src/contracts/abi/DIDRegistry.json", + "spawn-devnet": "tenderly devnet spawn-rpc --project project --template bnb-testnet", + "test:integration": "ts-mocha test/integration/**/*.test.ts" + }, + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/providers": "^5.7.2", + "bignumber.js": "^9.1.2", + "did-resolver": "^4.1.0", + "dotenv": "^16.3.1", + "ethers": "^5.7.2", + "ramda": "^0.29.0" + }, + "devDependencies": { + "@typechain/ethers-v5": "^11.1.1", + "@types/chai": "^4.3.6", + "@types/chai-as-promised": "^7.1.6", + "@types/mocha": "^10.0.1", + "@types/node": "^20.5.1", + "@types/ramda": "^0.29.4", + "chai": "^4.3.8", + "chai-as-promised": "^7.1.1", + "husky": "^8.0.3", + "mocha": "^10.0.0", + "nyc": "^15.1.0", + "prettier": "^3.0.3", + "shx": "^0.3.4", + "tenderly": "^0.5.3", + "ts-mocha": "^10.0.0", + "ts-node": "^10.9.1", + "typechain": "^8.3.1", + "typescript": "^5.1.6" + }, + "husky": { + "hooks": { + "pre-commit": "yarn lint" } - } \ No newline at end of file + }, + "prettier": { + "printWidth": 80, + "semi": true, + "singleQuote": true, + "trailingComma": "es5" + } +} diff --git a/ts-client/abi/DIDRegistry.json b/ts-client/src/contracts/abi/DIDRegistry.json similarity index 100% rename from ts-client/abi/DIDRegistry.json rename to ts-client/src/contracts/abi/DIDRegistry.json diff --git a/ts-client/src/index.ts b/ts-client/src/index.ts new file mode 100644 index 0000000..8795ee0 --- /dev/null +++ b/ts-client/src/index.ts @@ -0,0 +1,2 @@ +export * from './service'; +export * from './utils'; diff --git a/ts-client/src/service/DidDocument.ts b/ts-client/src/service/DidDocument.ts new file mode 100644 index 0000000..0a53a9b --- /dev/null +++ b/ts-client/src/service/DidDocument.ts @@ -0,0 +1,190 @@ +import { + DIDDocument, + Service, + VerificationMethod as DidVerificationMethod, +} from 'did-resolver'; +import { + BitwiseVerificationMethodFlag, + DEFAULT_KEY_ID, + getBnbContextPrefix, + mapControllers, + mapServices, + mapVerificationMethodsToDidComponents, + VerificationMethod, + VerificationMethodType, + W3ID_CONTEXT, +} from '../utils'; +import { DidIdentifier } from './DidIdentifier'; +import { DIDRegistry } from '../contracts/typechain-types'; + +/** + * A class representing a did:sol document + * The document is less permissive than the DIDDocument specification that it implements. + */ +export class DidDocument implements DIDDocument { + public '@context'?: 'https://www.w3.org/ns/did/v1' | string | string[] = + DidDocument.defaultContext(); + public id: string; + // public alsoKnownAs?: string[]; + public controller?: string[] = []; + public verificationMethod?: DidVerificationMethod[] = []; + public authentication?: string[] = []; + public assertionMethod?: string[] = []; + public keyAgreement?: string[] = []; + public capabilityInvocation?: string[] = []; + public capabilityDelegation?: string[] = []; + public service?: Service[] = []; + + constructor(identifier: DidIdentifier) { + this.id = identifier.toString(); + + // default to generative case + Object.assign( + this, + mapVerificationMethodsToDidComponents( + [defaultVerificationMethod(identifier)], + identifier + ) + ); + } + + static defaultContext(version: string = '1.0'): string[] { + return [W3ID_CONTEXT, getBnbContextPrefix(version)]; + } + + static sparse(identifier: DidIdentifier): DidDocument { + return new DidDocument(identifier); + } + + static from( + identifier: DidIdentifier, + didState: DIDRegistry.DidStateStructOutput + ): DidDocument { + const doc = DidDocument.sparse(identifier); + // VM related + + Object.assign( + doc, + mapVerificationMethodsToDidComponents( + didState.verificationMethods.map((vm) => VerificationMethod.from(vm)), + identifier + ) + ); + + // Services + doc.service = mapServices(didState.services, identifier); + // Controllers + doc.controller = mapControllers( + didState.nativeControllers, + didState.externalControllers, + identifier.chainEnviroment + ); + return doc; + } + + static fromDoc(document: DIDDocument): DidDocument { + const didDocument = new DidDocument(DidIdentifier.parse(document.id)); + // check requirements + if (document.controller && !Array.isArray(document.controller)) { + throw new Error('DIDDocument.controller must be an string array'); + } + + if ( + document.authentication && + !document.authentication.every((id) => typeof id === 'string') + ) { + throw new Error('DIDDocument.authentication must be an string array'); + } + + if ( + document.assertionMethod && + !document.assertionMethod.every((id) => typeof id === 'string') + ) { + throw new Error('DIDDocument.assertionMethod must be an string array'); + } + + if ( + document.keyAgreement && + !document.keyAgreement.every((id) => typeof id === 'string') + ) { + throw new Error('DIDDocument.keyAgreement must be an string array'); + } + + if ( + document.capabilityInvocation && + !document.capabilityInvocation.every((id) => typeof id === 'string') + ) { + throw new Error( + 'DIDDocument.capabilityInvocation must be an string array' + ); + } + + if ( + document.capabilityDelegation && + !document.capabilityDelegation.every((id) => typeof id === 'string') + ) { + throw new Error( + 'DIDDocument.capabilityDelegation must be an string array' + ); + } + + Object.assign(didDocument, document); + return didDocument; + } + + getFlagsFromVerificationMethod( + fragment: string + ): BitwiseVerificationMethodFlag { + let flags = 0; + + if ( + this.authentication && + this.authentication.find((id) => id.endsWith(`#${fragment}`)) + ) { + flags |= BitwiseVerificationMethodFlag.Authentication; + } + + if ( + this.assertionMethod && + this.assertionMethod.find((id) => id.endsWith(`#${fragment}`)) + ) { + flags |= BitwiseVerificationMethodFlag.Assertion; + } + + if ( + this.keyAgreement && + this.keyAgreement.find((id) => id.endsWith(`#${fragment}`)) + ) { + flags |= BitwiseVerificationMethodFlag.KeyAgreement; + } + + if ( + this.capabilityInvocation && + this.capabilityInvocation.find((id) => id.endsWith(`#${fragment}`)) + ) { + flags |= BitwiseVerificationMethodFlag.CapabilityInvocation; + } + + if ( + this.capabilityDelegation && + this.capabilityDelegation.find((id) => id.endsWith(`#${fragment}`)) + ) { + flags |= BitwiseVerificationMethodFlag.CapabilityDelegation; + } + + return flags; + } +} + +export const defaultVerificationMethod = ( + identifier: DidIdentifier +): VerificationMethod => + VerificationMethod.from({ + fragment: DEFAULT_KEY_ID, + methodType: VerificationMethodType.EcdsaSecp256k1RecoveryMethod2020, + flags: + BitwiseVerificationMethodFlag.CapabilityInvocation | + BitwiseVerificationMethodFlag.OwnershipProof | + BitwiseVerificationMethodFlag.Protected, + keyData: identifier.toString(false), + }); diff --git a/ts-client/src/service/DidIdentifier.ts b/ts-client/src/service/DidIdentifier.ts new file mode 100644 index 0000000..f1eb80f --- /dev/null +++ b/ts-client/src/service/DidIdentifier.ts @@ -0,0 +1,148 @@ +/** + * A class representing a Did Identifier + */ +import { VerificationMethod } from 'did-resolver'; +import { ChainEnviroment, DID_BNB_PREFIX } from '../utils'; + +export type DidIdentifierConstructor = { + chainEnviroment: ChainEnviroment | undefined; + identifier: string; + fragment?: string; +}; + +export class DidIdentifier { + /** + * The cluster the DID points to + */ + chainEnviroment: ChainEnviroment | undefined; + /** + * The method specific identifier of the did + */ + identifier: string; + /** + * The optional field following the DID address and `#` + */ + fragment?: string; + + constructor(constructor: DidIdentifierConstructor) { + this.chainEnviroment = constructor.chainEnviroment; + this.identifier = constructor.identifier; + this.fragment = constructor.fragment; + } + + /** + * Clones this + */ + clone(): DidIdentifier { + return new DidIdentifier({ + chainEnviroment: this.chainEnviroment, + identifier: this.identifier, + fragment: this.fragment, + }); + } + + /** + * Returns a new `DecentralizedIdentifier` but with `urlField` swapped to the parameter + * @param urlField The new url field + */ + withUrl(urlField: string): DidIdentifier { + return new DidIdentifier({ + ...this, + fragment: urlField, + }); + } + + private get didMethodSuffixString(): string { + if (!this.chainEnviroment) { + return 'unknown:'; + } + if (this.chainEnviroment === 'mainnet') { + return ''; + } + return `${this.chainEnviroment}:`; + } + + toString(includeURL = true): string { + const path = ''; // TODO + const query = ''; // TODO + const fragment = + !this.fragment || this.fragment === '' ? '' : `#${this.fragment}`; + + let urlExtension = ''; + if (includeURL) { + urlExtension = `${path}${query}${fragment}`; + } + return `${DID_BNB_PREFIX}:${this.didMethodSuffixString}${this.identifier}${urlExtension}`; + } + + // Note fragment is always the last field in the URI. + // https://www.rfc-editor.org/rfc/rfc3986#section-3.5 + // TODO: Note, this REGEX is not robust towards URI spec, specifically paths and queries. + // TODO add support for / urls and ? query params + static REGEX = new RegExp(`^${DID_BNB_PREFIX}:?(\\w*):(\\w+)#?(\\w*)$`); + + /** + * Parses a given did string + * @param did the did string + */ + static parse(did: string | VerificationMethod): DidIdentifier { + if (isStringDID(did)) { + const matches = DidIdentifier.REGEX.exec(did); + + if (!matches) throw new Error('Invalid DID'); + + const identifier = matches[2]; + + return new DidIdentifier({ + chainEnviroment: mapDidSuffix(matches[1]), + identifier, + fragment: matches[3], + }); + } else { + throw new Error('Provided DID is not a string'); + } + } + + static valid(did: string): boolean { + try { + DidIdentifier.parse(did); + return true; + } catch { + return false; + } + } + + /** + * Creates a new did + * @param authority The authority and key of the did + * @param clusterType The cluster the did points to + * @param urlField An optional extra field + */ + static create( + identifier: string, + chainEnviroment: ChainEnviroment | undefined, + urlField?: string + ): DidIdentifier { + return new DidIdentifier({ + chainEnviroment, + identifier, + fragment: urlField, + }); + } +} + +export const mapDidSuffix = ( + didSuffix: string +): ChainEnviroment | undefined => { + switch (didSuffix) { + case '': + return 'mainnet'; + case 'testnet': + return 'testnet'; + } + // return undefined if not found +}; + +export const isStringDID = ( + identifier: VerificationMethod | DidIdentifier | string +): identifier is string => typeof identifier === 'string'; diff --git a/ts-client/src/service/DidRegistry.ts b/ts-client/src/service/DidRegistry.ts new file mode 100644 index 0000000..77e7640 --- /dev/null +++ b/ts-client/src/service/DidRegistry.ts @@ -0,0 +1,70 @@ +import { DidRegistryInternal } from './DidRegistryInternal'; +import { + DIDRegistry as DIDRegistryTypechain, + DIDRegistry__factory, +} from '../contracts/typechain-types'; +import { ContractTransaction, Wallet } from 'ethers'; +import { Options } from '../utils/types'; +import { Provider } from '@ethersproject/providers'; +import { DidIdentifier } from './DidIdentifier'; +import { Signer } from '@ethersproject/abstract-signer'; +import { ChainEnviroment } from '../utils'; + +export class DidRegistry extends DidRegistryInternal< + DIDRegistryTypechain, + ContractTransaction +> { + readonly providerOrWallet: Provider | Wallet; + private chainEnviorment: ChainEnviroment = 'mainnet'; + private did?: DidIdentifier; + + constructor( + // ethers.js requires a Wallet instead of Signer for the _signTypedData function, until v6 + providerOrWallet: Provider | Wallet, + didRegistryContractAddress: string, + options: Options = {} + ) { + const didRegistryContract = DIDRegistry__factory.connect( + didRegistryContractAddress, + providerOrWallet + ); + super(didRegistryContract, options); + + if (options.chainEnvironment) { + this.chainEnviorment = options.chainEnvironment; + } + + this.providerOrWallet = providerOrWallet; + } + + /** + * Can be used to optionally set a DID in Read-Only Setups (when passed a Provider) + */ + setDidIdentifier(identifier: string | undefined) { + if (identifier) { + this.did = DidIdentifier.create(identifier, this.chainEnviorment); + } else { + this.did = undefined; + } + } + + get address(): string | undefined { + const anyProviderOrWallet = this.providerOrWallet as any; + if (anyProviderOrWallet.address) { + // Address property of Wallet + return anyProviderOrWallet.address; + } + } + + getDid(): DidIdentifier { + if (this.did) { + return this.did; + } + + if (this.address) { + return DidIdentifier.create(this.address, this.chainEnviorment); + } + + throw new Error('No Signer to access DID'); + } +} diff --git a/ts-client/src/service/DidRegistryInternal.ts b/ts-client/src/service/DidRegistryInternal.ts new file mode 100644 index 0000000..b56f212 --- /dev/null +++ b/ts-client/src/service/DidRegistryInternal.ts @@ -0,0 +1,169 @@ +import { Overrides } from 'ethers'; + +import { + MappedWriteOperation, + Options, + ReadOnlyOperation, +} from '../utils'; +import { omit } from 'ramda'; +import { DIDRegistry } from '../contracts/typechain-types'; +import { DidIdentifier } from './DidIdentifier'; +import { DidDocument } from './DidDocument'; +import { + BitwiseVerificationMethodFlag, + RawService, + reduceVmFlagArray, + validateExternalController, +} from '../utils'; + +/** + * The main API of the Ethereum DID Client. + * This class expects a contract object, that contains the methods specified in the + * DID smart contract, but is agnostic to the return values of those methods. + * + * This allows it to be used with a contract object that returns a transaction receipt + * (i.e. creates, signs and sends the transaction) or a PopulatedTransaction, or others. + * + */ +export abstract class DidRegistryInternal< + I extends MappedWriteOperation & ReadOnlyOperation, + O, +> { + protected didRegistryContract: I; + protected options: Options; + + protected constructor(didRegistryContract: I, options?: Options) { + this.didRegistryContract = didRegistryContract; + this.options = options ?? {}; + } + + abstract getDid(): DidIdentifier; + + private get overrides(): Overrides { + return omit(['chainEnvironment'], this.options); + } + + /** + * Overrides that are safe to use for read-only operations. + * Some chains / RPC providers (e.g. Polygon zkEVM) do not allow gasPrice to be set + * for read-only operations. + * @private + */ + private get readOnlyOverrides(): Overrides { + return omit(['gasPrice'], this.overrides); + } + + public async resolve(did?: DidIdentifier): Promise { + if (!did) { + did = this.getDid(); + } + const didState = await this.didRegistryContract.resolveDidState( + did.identifier, + this.readOnlyOverrides + ); + + return DidDocument.from(did, didState); + } + + public async isGenerativeDidState(did?: DidIdentifier): Promise { + if (!did) { + did = this.getDid(); + } + + return this.didRegistryContract.isGenerativeDidState( + did.identifier, + this.readOnlyOverrides + ); + } + + public async addExternalController(externalController: string): Promise { + validateExternalController(externalController); + + return this.didRegistryContract.addExternalController( + this.getDid().identifier, + externalController, + this.overrides + ); + } + + public async addNativeController(controller: DidIdentifier): Promise { + return this.didRegistryContract.addNativeController( + this.getDid().identifier, + controller.identifier, + this.overrides + ); + } + + public async addService(service: RawService): Promise { + return this.didRegistryContract.addService( + this.getDid().identifier, + service, + this.overrides + ); + } + + public async addVerificationMethod( + verificationMethod: DIDRegistry.VerificationMethodStruct + ): Promise { + return this.didRegistryContract.addVerificationMethod( + this.getDid().identifier, + verificationMethod, + this.overrides + ); + } + + public async initializeDidState(): Promise { + return this.didRegistryContract.initializeDidState( + this.getDid().identifier, + this.overrides + ); + } + + public async removeExternalController( + externalController: string + ): Promise { + return this.didRegistryContract.removeExternalController( + this.getDid().identifier, + externalController, + this.overrides + ); + } + + public async removeNativeController( + nativeController: DidIdentifier + ): Promise { + return this.didRegistryContract.removeNativeController( + this.getDid().identifier, + nativeController.identifier, + this.overrides + ); + } + + public async removeService(fragment: string): Promise { + return this.didRegistryContract.removeService( + this.getDid().identifier, + fragment, + this.overrides + ); + } + + public async removeVerificationMethod(fragment: string): Promise { + return this.didRegistryContract.removeVerificationMethod( + this.getDid().identifier, + fragment, + this.overrides + ); + } + + public async setVerificationMethodFlags( + fragment: string, + flags: BitwiseVerificationMethodFlag[] + ): Promise { + return this.didRegistryContract.updateVerificationMethodFlags( + this.getDid().identifier, + fragment, + reduceVmFlagArray(flags), + this.overrides + ); + } +} diff --git a/ts-client/src/service/index.ts b/ts-client/src/service/index.ts new file mode 100644 index 0000000..60cd9d9 --- /dev/null +++ b/ts-client/src/service/index.ts @@ -0,0 +1 @@ +export * from './DidRegistry'; diff --git a/ts-client/src/utils/constants.ts b/ts-client/src/utils/constants.ts new file mode 100644 index 0000000..c0ab6e9 --- /dev/null +++ b/ts-client/src/utils/constants.ts @@ -0,0 +1,16 @@ +import { BigNumber } from 'ethers'; +export const DEFAULT_DID_CONTRACT_ADDRESS = + '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'; // Proxy address + +export const DEFAULT_KEY_ID = 'default'; +export const VALID_DID_REGEX = /^did:([a-z\d:]*):([a-zA-z\d]+)$/; + +export const DID_BNB_PREFIX = 'did:bnb'; + +export const W3ID_CONTEXT = 'https://w3id.org/did/v1.0'; +export const getBnbContextPrefix = (version: string) => + `https://w3id.org/bnb/v${version}`; + +export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; +export const ZERO_BN = BigNumber.from('0'); +export const ONE_BN = BigNumber.from('1'); diff --git a/ts-client/src/utils/doc.ts b/ts-client/src/utils/doc.ts new file mode 100644 index 0000000..ad8ad57 --- /dev/null +++ b/ts-client/src/utils/doc.ts @@ -0,0 +1,164 @@ +import { + VerificationMethod as DidVerificationMethod, + Service as DidService, +} from 'did-resolver'; +import { DidIdentifier } from '../service/DidIdentifier'; +import { VerificationMethod } from './wrappers'; +import { DID_BNB_PREFIX, VALID_DID_REGEX } from './constants'; + +export type DidVerificationMethodComponents = { + verificationMethod: DidVerificationMethod[]; + authentication: (string | DidVerificationMethod)[]; + assertionMethod: (string | DidVerificationMethod)[]; + keyAgreement: (string | DidVerificationMethod)[]; + capabilityInvocation: (string | DidVerificationMethod)[]; + capabilityDelegation: (string | DidVerificationMethod)[]; +}; + +export enum BitwiseVerificationMethodFlag { + KeyAgreement = 1 << 0, + Authentication = 1 << 1, + Assertion = 1 << 2, + CapabilityInvocation = 1 << 3, + CapabilityDelegation = 1 << 4, + OwnershipProof = 1 << 5, + Protected = 1 << 6, +} + +export enum VerificationMethodType { + // TODO: Verify that this mapping is right. + // The main Ed25519Verification Method. + // https://w3c-ccg.github.io/lds-ed25519-2018/ + // Ed25519VerificationKey2018, + // Verification Method for For 20-bytes Ethereum Keys + EcdsaSecp256k1RecoveryMethod2020, + // Verification Method for a full 32 bytes Secp256k1 Verification Key + EcdsaSecp256k1VerificationKey2019, +} + +export const mapControllers = ( + nativeControllers: string[], + otherControllers: string[], + chainEnv: ChainEnviroment | undefined +): string[] => { + return [ + ...nativeControllers.map((identifier) => + DidIdentifier.create(identifier, chainEnv).toString() + ), + ...otherControllers, + ]; +}; + +export type RawVerificationMethod = { + fragment: string; + flags: number; + methodType: number; + keyData: string; +}; + +export type ChainEnviroment = 'mainnet' | 'testnet' | 'localnet' + +export type RawService = { + fragment: string; + service_type: string; + service_endpoint: string; +}; + +export const mapVerificationMethodsToDidComponents = ( + methods: VerificationMethod[], + identifier: DidIdentifier +): DidVerificationMethodComponents => { + const didComponents: DidVerificationMethodComponents = { + verificationMethod: new Array(), + authentication: new Array(), + assertionMethod: new Array(), + keyAgreement: new Array(), + capabilityInvocation: new Array(), + capabilityDelegation: new Array(), + }; + + for (const method of methods) { + // skip hidden methods (TODO: do we want to suppor this again?) + // if (method.flags.has(BitwiseVerificationMethodFlag.DidDocHidden)) { + // continue; + // } + if (method.flags.has(BitwiseVerificationMethodFlag.Authentication)) { + didComponents.authentication.push( + `${identifier.toString()}#${method.fragment}` + ); + } + if (method.flags.has(BitwiseVerificationMethodFlag.Assertion)) { + didComponents.assertionMethod.push( + `${identifier.toString()}#${method.fragment}` + ); + } + if (method.flags.has(BitwiseVerificationMethodFlag.KeyAgreement)) { + didComponents.keyAgreement.push( + `${identifier.toString()}#${method.fragment}` + ); + } + if (method.flags.has(BitwiseVerificationMethodFlag.CapabilityInvocation)) { + didComponents.capabilityInvocation.push( + `${identifier.toString()}#${method.fragment}` + ); + } + if (method.flags.has(BitwiseVerificationMethodFlag.CapabilityDelegation)) { + didComponents.capabilityDelegation.push( + `${identifier.toString()}#${method.fragment}` + ); + } + + let vm: DidVerificationMethod = { + id: identifier.withUrl(method.fragment).toString(), + type: VerificationMethodType[method.methodType], + controller: identifier.toString(), + }; + + switch (method.methodType) { + case VerificationMethodType.EcdsaSecp256k1RecoveryMethod2020: + vm.ethereumAddress = method.keyData; // TODO: Update if that should be changed back to a Buffer + break; + case VerificationMethodType.EcdsaSecp256k1VerificationKey2019: + vm.publicKeyHex = method.keyData; // TODO: Update if that should be changed back to a Buffer + break; + default: + throw new Error( + `Verification method type '${method.methodType}' not recognized` + ); + } + + didComponents.verificationMethod.push(vm); + } + + return didComponents; +}; + +export const mapServices = ( + services: RawService[], + identifier: DidIdentifier +): DidService[] => + services.map((service) => ({ + id: `${identifier.toString()}#${service.fragment}`, + type: service.service_type, + serviceEndpoint: service.service_endpoint, + })); + +export const reduceVmFlagArray = ( + flags: BitwiseVerificationMethodFlag[] +): number => flags.reduce((acc, flag) => acc | flag, 0); + +export const isValidDid = (did: string): boolean => VALID_DID_REGEX.test(did); + +export const isDidBnb = (did: string): boolean => + did.startsWith(DID_BNB_PREFIX); +export const validateExternalController = (externalController: string) => { + if (!isValidDid(externalController)) { + throw new Error('Invalid DID'); + } + + if (isDidBnb(externalController)) { + throw new Error( + 'did:bnb: cannot be used as an external controller. Add it as a native controller' + ); + } +}; diff --git a/ts-client/src/utils/index.ts b/ts-client/src/utils/index.ts index 4788586..96faace 100644 --- a/ts-client/src/utils/index.ts +++ b/ts-client/src/utils/index.ts @@ -1,22 +1,5 @@ -import 'dotenv/config'; -import { JsonRpcProvider, Wallet, ethers } from 'ethers'; -import { DIDRegistry, DIDRegistry__factory } from '../../types/ethers-contracts'; - - -export const fetchRpcProvider = (): JsonRpcProvider => { - return new ethers.JsonRpcProvider(process.env.RPC_URL); -} - -export const fetchRpcWallet = (signerKey: string): Wallet => { - const provider = new ethers.JsonRpcProvider(process.env.RPC_URL); - return new ethers.Wallet(signerKey, provider); -} - -export const fetchDidRegistryContractInstance = (didRegistryAddress: string, privateKey: string): DIDRegistry => { - const wallet = fetchRpcWallet(privateKey); - return DIDRegistry__factory.connect(didRegistryAddress, wallet.provider); -} - -export const fetchReadOnlyDidRegistryContractInstance = (didRegistryAddress: string): DIDRegistry => { - return DIDRegistry__factory.connect(didRegistryAddress, fetchRpcProvider()); -} \ No newline at end of file +export * from './constants'; +export * from './doc'; +export * from './types'; +export * from './util'; +export * from './wrappers'; diff --git a/ts-client/src/utils/types.ts b/ts-client/src/utils/types.ts new file mode 100644 index 0000000..3a82d2f --- /dev/null +++ b/ts-client/src/utils/types.ts @@ -0,0 +1,50 @@ +import { Overrides } from 'ethers'; +import { DIDRegistry } from '../contracts/typechain-types'; +import { VerificationMethod } from 'did-resolver'; +import { ChainEnviroment } from './doc'; + +export type Options = Overrides & { + chainEnvironment?: ChainEnviroment; +}; + +// List of the write operations on the Did contract that are exposed via this library +export type WriteOps = + | 'addExternalController' + | 'addNativeController' + | 'addService' + | 'addVerificationMethod' + | 'initializeDidState' + | 'removeExternalController' + | 'removeNativeController' + | 'removeService' + | 'removeVerificationMethod' + | 'updateVerificationMethodFlags'; +export const mappedOpNames = [ + 'addExternalController', + 'addNativeController', + 'addService', + 'addVerificationMethod', + 'initializeDidState', + 'removeExternalController', + 'removeNativeController', + 'removeService', + 'removeVerificationMethod', + 'updateVerificationMethodFlags', +]; + +type SubsetMappedWriteOps = Pick; + +// A GatewayToken contract instance with the write operations converted from their default +// ethers.js return values to the type passed as O +export type MappedWriteOperation = { + [Property in keyof SubsetMappedWriteOps]: ( + ...args: Parameters + ) => Promise; +}; + +// List of the read operations on the GatewayToken contract that are exposed via this library +export type ReadOnlyOps = 'resolveDidState' | 'isGenerativeDidState'; +export const readOnlyOpNames = ['resolveDidState', 'isGenerativeDidState']; + +// A GatewayToken contract instance with the read operations exposed +export type ReadOnlyOperation = Pick; diff --git a/ts-client/src/utils/util.ts b/ts-client/src/utils/util.ts new file mode 100644 index 0000000..a212714 --- /dev/null +++ b/ts-client/src/utils/util.ts @@ -0,0 +1,30 @@ +import 'dotenv/config'; +import { Wallet, ethers } from 'ethers'; +import { + DIDRegistry, + DIDRegistry__factory, +} from '../contracts/typechain-types'; +import { JsonRpcProvider } from '@ethersproject/providers'; + +export const fetchRpcProvider = (): JsonRpcProvider => { + return new JsonRpcProvider(process.env.RPC_URL); +}; + +export const fetchRpcWallet = (signerKey: string): Wallet => { + const provider = new JsonRpcProvider(process.env.RPC_URL); + return new ethers.Wallet(signerKey, provider); +}; + +export const fetchDidRegistryContractInstance = ( + didRegistryAddress: string, + privateKey: string +): DIDRegistry => { + const wallet = fetchRpcWallet(privateKey); + return DIDRegistry__factory.connect(didRegistryAddress, wallet.provider); +}; + +export const fetchReadOnlyDidRegistryContractInstance = ( + didRegistryAddress: string +): DIDRegistry => { + return DIDRegistry__factory.connect(didRegistryAddress, fetchRpcProvider()); +}; diff --git a/ts-client/src/utils/wrappers.ts b/ts-client/src/utils/wrappers.ts new file mode 100644 index 0000000..ba2ee21 --- /dev/null +++ b/ts-client/src/utils/wrappers.ts @@ -0,0 +1,82 @@ +import { + RawVerificationMethod, + VerificationMethodType, + BitwiseVerificationMethodFlag, +} from './doc'; +import { DIDRegistry } from '../contracts/typechain-types'; + +export class VerificationMethod { + private constructor(private _rawVerificationMethod: RawVerificationMethod) {} + + get raw(): RawVerificationMethod { + return this._rawVerificationMethod; + } + + static from( + rawVerificationMethod: RawVerificationMethod + ): VerificationMethod { + return new VerificationMethod(rawVerificationMethod); + } + + get fragment(): string { + return this._rawVerificationMethod.fragment; + } + + get keyData(): string { + // TODO, this should be generates as a Byteslike from Typechain. + return this._rawVerificationMethod.keyData; + } + + get methodType(): VerificationMethodType { + return this._rawVerificationMethod.methodType; + } + + get flags(): VerificationMethodFlags { + return new VerificationMethodFlags(this._rawVerificationMethod.flags); + } +} + +export class VerificationMethodFlags { + constructor(private _flags: number) {} + + static none() { + return new VerificationMethodFlags(0); + } + + static of(flags: number) { + return new VerificationMethodFlags(flags); + } + + get raw(): number { + return this._flags; + } + + static ofArray( + flags: BitwiseVerificationMethodFlag[] + ): VerificationMethodFlags { + return flags.reduce( + (acc, flag) => acc.set(flag), + VerificationMethodFlags.none() + ); + } + + get array(): BitwiseVerificationMethodFlag[] { + return Object.keys(BitwiseVerificationMethodFlag) + .map((i) => parseInt(i)) + .filter((i) => !isNaN(i) && this.has(i)); + } + + has(flag: BitwiseVerificationMethodFlag): boolean { + return (this._flags & flag) === flag; + } + + set(flag: BitwiseVerificationMethodFlag): VerificationMethodFlags { + this._flags |= flag; + return this; + } + + clear(flag: BitwiseVerificationMethodFlag): VerificationMethodFlags { + this._flags &= ~flag; + return this; + } +} diff --git a/ts-client/test/integration/DidRegistry.test.ts b/ts-client/test/integration/DidRegistry.test.ts new file mode 100644 index 0000000..7d7bcda --- /dev/null +++ b/ts-client/test/integration/DidRegistry.test.ts @@ -0,0 +1,300 @@ +import * as dotenv from 'dotenv'; +import chai, { expect } from 'chai'; +import chaiAsPromised from 'chai-as-promised'; + +import { + addBalanceToTenderlyAccount, + deployDidRegistryContractInstance, + getDeployerWallet, + getGeneratedDidDocument, + getMainDidWallet, + getSecondaryDidWallet, + getUnauthorizedDidWallet, +} from './testUtils'; +import { getDefaultProvider, Provider } from '@ethersproject/providers'; +import { utils, Wallet } from 'ethers'; +import { + BitwiseVerificationMethodFlag, + DEFAULT_KEY_ID, + DidRegistry, + reduceVmFlagArray, + VerificationMethodType, +} from '../../src'; +import { DidIdentifier } from '../../src/service/DidIdentifier'; + +dotenv.config(); +chai.use(chaiAsPromised); + +describe('Native TS Client Integration Test', () => { + let didRegistry: DidRegistry; + let otherDidRegistry: DidRegistry; + let unauthorizedDidRegistry: DidRegistry; + let provider: Provider; + let didWallet: Wallet; + let otherDidWallet: Wallet; + let unauthorizedWallet: Wallet; + + const SECONDARY_KEY_ID = 'secondary'; + + before(async () => { + provider = getDefaultProvider(process.env.RPC_URL); + const deployerWallet = getDeployerWallet(provider); + didWallet = getMainDidWallet(provider); + otherDidWallet = getSecondaryDidWallet(provider); + unauthorizedWallet = getUnauthorizedDidWallet(provider); + + if (process.env.RPC_URL?.includes('tenderly')) { + await addBalanceToTenderlyAccount(deployerWallet); + await addBalanceToTenderlyAccount(didWallet); + await addBalanceToTenderlyAccount(otherDidWallet); + await addBalanceToTenderlyAccount(unauthorizedWallet); + } + + const { address } = await deployDidRegistryContractInstance(deployerWallet); + + // Connect didWallet and otherDidWallet to didRegistryContract + didRegistry = new DidRegistry(didWallet, address, {chainEnvironment: 'localnet'}); + otherDidRegistry = new DidRegistry(otherDidWallet, address, {chainEnvironment: 'localnet'}); + otherDidRegistry.setDidIdentifier(didWallet.address); // otherDidWallet is message sender, but DID is still from didWallet + unauthorizedDidRegistry = new DidRegistry(unauthorizedWallet, address, {chainEnvironment: 'localnet'}); + unauthorizedDidRegistry.setDidIdentifier(didWallet.address); // unauthorizedDidWallet is message sender, but DID is still from didWallet + }); + + it('should generate DIDs with the correct prefix', () => { + expect(didRegistry.getDid().toString()).to.be.a('string').and.satisfy((did: string) => did.startsWith('did:bnb:localnet:')); + }); + + it('should resolve an initial DID State of the didWallet', async () => { + const isGenerative: boolean = await didRegistry.isGenerativeDidState(); + expect(isGenerative).to.equal(true); + const doc = await didRegistry.resolve(); + expect(doc).to.deep.equal( + getGeneratedDidDocument(didWallet.address, 'did:bnb:localnet:') + ); + }); + + it('should resolve an a random external (generative) external DID', async () => { + const randomWallet = Wallet.createRandom(); + const randomDid = DidIdentifier.create( + randomWallet.address, + didRegistry.getDid().chainEnviroment + ); + const isGenerative: boolean = + await didRegistry.isGenerativeDidState(randomDid); + expect(isGenerative).to.equal(true); + const doc = await didRegistry.resolve(randomDid); + expect(doc).to.deep.equal( + getGeneratedDidDocument(randomDid.identifier, 'did:bnb:localnet:') + ); + }); + + it('should initialize a DID method on-chain', async () => { + const tx = await didRegistry.initializeDidState().then((tx) => tx.wait()); + expect(tx.status).to.equal(1); + + const isGenerative: boolean = await didRegistry.isGenerativeDidState(); + expect(isGenerative).to.equal(false); + }); + + it('should be able to add a service to the DID', async () => { + const service = { + fragment: 'test', + service_type: 'testType', + service_endpoint: 'testEndpoint', + }; + const tx = await didRegistry.addService(service).then((tx) => tx.wait()); + expect(tx.status).to.equal(1); + + const doc = await didRegistry.resolve(); + expect(doc.service).to.have.lengthOf(1); + const didWithFragment = DidIdentifier.create( + didRegistry.getDid().identifier, + didRegistry.getDid().chainEnviroment, + service.fragment + ); + expect(doc.service?.[0]).to.deep.equal({ + id: didWithFragment.toString(), + serviceEndpoint: service.service_endpoint, + type: service.service_type, + }); + }); + + it('should be able to add a verificationMethod to the DID', async () => { + const verificationMethod = { + fragment: SECONDARY_KEY_ID, + flags: reduceVmFlagArray([ + BitwiseVerificationMethodFlag.CapabilityInvocation, + ]), + methodType: VerificationMethodType.EcdsaSecp256k1RecoveryMethod2020, + keyData: utils.arrayify(otherDidWallet.address), + }; + const tx = await didRegistry + .addVerificationMethod(verificationMethod) + .then((tx) => tx.wait()); + expect(tx.status).to.equal(1); + const doc = await didRegistry.resolve(); + expect(doc.verificationMethod).to.have.lengthOf(2); + const didWithFragment = DidIdentifier.create( + didRegistry.getDid().identifier, + didRegistry.getDid().chainEnviroment, + verificationMethod.fragment + ); + expect(doc.verificationMethod?.[1]).to.deep.equal({ + id: didWithFragment.toString(), + controller: didRegistry.getDid().toString(), + ethereumAddress: otherDidWallet.address.toLowerCase(), + type: 'EcdsaSecp256k1RecoveryMethod2020', + }); + }); + + it('should be able to add a third verificationMethod with the new key', async () => { + const randomWallet = Wallet.createRandom(); + const verificationMethod = { + fragment: 'third', + flags: reduceVmFlagArray([]), + methodType: VerificationMethodType.EcdsaSecp256k1RecoveryMethod2020, + keyData: utils.arrayify(randomWallet.address), + }; + + const tx = await otherDidRegistry + .addVerificationMethod(verificationMethod) + .then((tx) => tx.wait()); + expect(tx.status).to.equal(1); + const doc = await otherDidRegistry.resolve(); + expect(doc.verificationMethod).to.have.lengthOf(3); + const didWithFragment = DidIdentifier.create( + otherDidRegistry.getDid().identifier, + otherDidRegistry.getDid().chainEnviroment, + verificationMethod.fragment + ); + expect(doc.verificationMethod?.[2]).to.deep.equal({ + id: didWithFragment.toString(), + controller: otherDidRegistry.getDid().toString(), + ethereumAddress: randomWallet.address.toLowerCase(), + type: 'EcdsaSecp256k1RecoveryMethod2020', + }); + }); + + it('should be able to add native controller', async () => { + const randomWallet = Wallet.createRandom(); + const nativeController = DidIdentifier.create( + randomWallet.address, + didRegistry.getDid().chainEnviroment + ); + + const tx = await otherDidRegistry + .addNativeController(nativeController) + .then((tx) => tx.wait()); + expect(tx.status).to.equal(1); + + const doc = await otherDidRegistry.resolve(); + expect(doc.controller).to.have.lengthOf(1); + expect(doc.controller?.[0]).to.equal(nativeController.toString()); + }); + + it('should be able to add external controller', async () => { + const externalController = `did:ethr:${Wallet.createRandom().address}`; + + const tx = await otherDidRegistry + .addExternalController(externalController) + .then((tx) => tx.wait()); + expect(tx.status).to.equal(1); + + const doc = await otherDidRegistry.resolve(); + expect(doc.controller).to.have.lengthOf(2); + expect(doc.controller?.[1]).to.equal(externalController); + }); + + it('should not able remove a protected key', async () => { + return expect( + didRegistry.removeVerificationMethod(DEFAULT_KEY_ID) + ).to.be.rejectedWith( + 'Cannot remove verification method because of protected flag' + ); + }); + + it('should be able set Verification Method flags', async () => { + const tx = await didRegistry + .setVerificationMethodFlags(DEFAULT_KEY_ID, [ + BitwiseVerificationMethodFlag.Authentication, + ]) + .then((tx) => tx.wait()); + expect(tx.status).to.equal(1); + + const doc = await didRegistry.resolve(); + const didWithFragment = DidIdentifier.create( + didRegistry.getDid().identifier, + didRegistry.getDid().chainEnviroment, + DEFAULT_KEY_ID + ); + expect(doc.authentication?.[0]).to.equal(didWithFragment.toString()); + expect(doc.capabilityInvocation?.[0]).to.not.equal( + didWithFragment.toString() + ); + }); + + it('should not able set Ownership proof for a different key', async () => { + return expect( + didRegistry.setVerificationMethodFlags(SECONDARY_KEY_ID, [ + BitwiseVerificationMethodFlag.CapabilityInvocation, + BitwiseVerificationMethodFlag.OwnershipProof, + ]) + ).to.be.rejectedWith( + 'Message sender is not an authorized user of this did' + ); + }); + + it('should fail if an external controller has the wrong format', async () => { + const noDid = 'adfhakjsdfhjew4'; + + return expect( + otherDidRegistry.addExternalController(noDid) + ).to.be.rejectedWith('Invalid DID'); + }); + + it('should fail if an external controller id a did:bnb', async () => { + const randomWallet = Wallet.createRandom(); + const wrongExternalController = DidIdentifier.create( + randomWallet.address, + didRegistry.getDid().chainEnviroment + ).toString(); + return expect( + otherDidRegistry.addExternalController(wrongExternalController) + ).to.be.rejectedWith( + 'did:bnb: cannot be used as an external controller. Add it as a native controller' + ); + }); + + it('should fail with an unauthorized key (add VM)', async () => { + const randomWallet = Wallet.createRandom(); + + const verificationMethod = { + fragment: 'will-fail', + flags: reduceVmFlagArray([ + BitwiseVerificationMethodFlag.CapabilityInvocation, + ]), + methodType: VerificationMethodType.EcdsaSecp256k1RecoveryMethod2020, + keyData: utils.arrayify(randomWallet.address), + }; + + return expect( + unauthorizedDidRegistry.addVerificationMethod(verificationMethod) + ).to.be.rejectedWith( + 'Message sender is not an authorized user of this did' + ); + }); + + it('should fail with an unauthorized key (add Service)', async () => { + const service = { + fragment: 'test', + service_type: 'testType', + service_endpoint: 'testEndpoint', + }; + + return expect( + unauthorizedDidRegistry.addService(service) + ).to.be.rejectedWith( + 'Message sender is not an authorized user of this did' + ); + }); +}); diff --git a/ts-client/test/integration/didCreation.spec.ts b/ts-client/test/integration/didCreation.spec.ts deleted file mode 100644 index ffd2ad8..0000000 --- a/ts-client/test/integration/didCreation.spec.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { ContractTransactionResponse, HDNodeWallet, JsonRpcProvider, Wallet, ethers } from "ethers" -import 'dotenv/config'; -import { fetchRpcWallet } from "../../src/utils"; -import { setAccountBalance, deployDidRegistryContractInstance } from "./util"; -import { DIDRegistry } from "../../types/ethers-contracts"; - -const FOUNDRY_DEFAULT_PRIVATE_KEY_ONE = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; -const FOUNDRY_DEFAULT_PUBLIC_KEY_ONE = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" - -describe('TS-client Integration test', () => { - let didRegistryContract: DIDRegistry; - - beforeAll(async () => { - if(process.env.RPC_URL.includes("tenderly")) { - await addBalanceToTenderlyAccount(FOUNDRY_DEFAULT_PUBLIC_KEY_ONE, FOUNDRY_DEFAULT_PRIVATE_KEY_ONE); - } - - didRegistryContract = await deployDidRegistryContractInstance(FOUNDRY_DEFAULT_PRIVATE_KEY_ONE); - }, 15000) - - test('should verify initial did on state', async () => { - const isGenerative: boolean = await didRegistryContract.isGenerativeDidState(FOUNDRY_DEFAULT_PUBLIC_KEY_ONE,{gasLimit: 30000000}); - expect(isGenerative).toBe(true); - }, 5000) - - test('should initialize did on chain', async () => { - const tx = await didRegistryContract.initializeDidState(FOUNDRY_DEFAULT_PUBLIC_KEY_ONE,{gasLimit: 30000000}); - await tx.wait(); - - const isGenerative: boolean = await didRegistryContract.isGenerativeDidState(FOUNDRY_DEFAULT_PUBLIC_KEY_ONE,{gasLimit: 30000000}); - expect(isGenerative).toBe(false); - }, 15000) - - test('should create verification method on chain', async () => { - - const vmTx = await didRegistryContract.addVerificationMethod(FOUNDRY_DEFAULT_PUBLIC_KEY_ONE, {fragment: "test", flags: 0, methodType: 0, keyData: FOUNDRY_DEFAULT_PUBLIC_KEY_ONE}, {gasLimit: 30000000}); - await vmTx.wait(); - - const didState = await didRegistryContract.resolveDidState(FOUNDRY_DEFAULT_PUBLIC_KEY_ONE, {gasLimit: 30000000}) - expect(didState.verificationMethods.length).toBe(2); - }, 15000) - - const addBalanceToTenderlyAccount = async (address: string, privateKey: string): Promise => { - const signedWallet = fetchRpcWallet(privateKey); - return await setAccountBalance(signedWallet.provider as JsonRpcProvider, address, "0xDE0B6B3A7640000"); - } -}) \ No newline at end of file diff --git a/ts-client/test/integration/didCreation.test.ts b/ts-client/test/integration/didCreation.test.ts new file mode 100644 index 0000000..f4411b4 --- /dev/null +++ b/ts-client/test/integration/didCreation.test.ts @@ -0,0 +1,78 @@ +import * as assert from 'assert'; +import * as dotenv from 'dotenv'; + +dotenv.config(); + +import { + deployDidRegistryContractInstance, + getDeployerWallet, + getMainDidWallet, + addBalanceToTenderlyAccount, +} from './testUtils'; +import { DIDRegistry } from '../../src/contracts/typechain-types'; +import { getDefaultProvider, Provider } from '@ethersproject/providers'; +import { Wallet } from 'ethers'; + +describe('TypeChain Client Integration Test', () => { + let didRegistryContract: DIDRegistry; + let provider: Provider; + let didWallet: Wallet; + + before(async () => { + provider = getDefaultProvider(process.env.RPC_URL); + const deployerWallet = getDeployerWallet(provider); + didWallet = getMainDidWallet(provider); + + if (process.env.RPC_URL?.includes('tenderly')) { + await addBalanceToTenderlyAccount(deployerWallet); + await addBalanceToTenderlyAccount(didWallet); + } + + didRegistryContract = + await deployDidRegistryContractInstance(deployerWallet); + + // Connect didWallet to didRegistryContract + didRegistryContract = didRegistryContract.connect(didWallet); + }); + + it('should verify initial did on state', async () => { + const isGenerative: boolean = + await didRegistryContract.isGenerativeDidState(didWallet.address, { + gasLimit: 30000000, + }); + assert.equal(isGenerative, true); + }); + + it('should initialize did on chain', async () => { + const tx = await didRegistryContract.initializeDidState(didWallet.address, { + gasLimit: 30000000, + }); + await tx.wait(); + + const isGenerative: boolean = + await didRegistryContract.isGenerativeDidState(didWallet.address, { + gasLimit: 30000000, + }); + assert.equal(isGenerative, false); + }); + + it('should create verification method on chain', async () => { + const vmTx = await didRegistryContract.addVerificationMethod( + didWallet.address, + { + fragment: 'test', + flags: 0, + methodType: 0, + keyData: didWallet.address, + }, + { gasLimit: 30000000 } + ); + await vmTx.wait(); + + const didState = await didRegistryContract.resolveDidState( + didWallet.address, + { gasLimit: 30000000 } + ); + assert.equal(didState.verificationMethods.length, 2); + }); +}); diff --git a/ts-client/test/integration/testUtils.ts b/ts-client/test/integration/testUtils.ts new file mode 100644 index 0000000..d17ed9f --- /dev/null +++ b/ts-client/test/integration/testUtils.ts @@ -0,0 +1,71 @@ +import { + DIDRegistry, + DIDRegistry__factory, +} from '../../src/contracts/typechain-types'; +import { JsonRpcProvider } from '@ethersproject/providers'; + +import { Wallet } from 'ethers'; +import { Provider } from '@ethersproject/providers'; + +export const DEFAULT_MNEMONIC = + 'test test test test test test test test test test test junk'; + +// During testing, the 0th index is the deployer key, the 2nd index is used as the did wallet key +export const getDeployerWallet = (provider: Provider) => + Wallet.fromMnemonic(DEFAULT_MNEMONIC, "m/44'/60'/0'/0/0").connect(provider); +export const getMainDidWallet = (provider: Provider) => + Wallet.fromMnemonic(DEFAULT_MNEMONIC, "m/44'/60'/0'/0/2").connect(provider); +export const getSecondaryDidWallet = (provider: Provider) => + Wallet.fromMnemonic(DEFAULT_MNEMONIC, "m/44'/60'/0'/0/3").connect(provider); +export const getUnauthorizedDidWallet = (provider: Provider) => + Wallet.fromMnemonic(DEFAULT_MNEMONIC, "m/44'/60'/0'/0/4").connect(provider); + +export const setAccountBalance = async ( + provider: Provider, + address: string, + amount: string +) => { + // TODO: Verify provider is a JsonRpcProvider + const rpcProvider = provider as JsonRpcProvider; + const test = await rpcProvider.send('tenderly_setBalance', [address, amount]); +}; + +export const deployDidRegistryContractInstance = async ( + wallet: Wallet +): Promise => { + const result = await new DIDRegistry__factory(wallet).deploy({ + gasLimit: 4000000, + }); + await result.deployTransaction.wait(); + return result; +}; + +export const addBalanceToTenderlyAccount = async ( + wallet: Wallet, + amount = '0xDE0B6B3A7640000' +): Promise => { + return await setAccountBalance(wallet.provider, wallet.address, amount); +}; + +export const getGeneratedDidDocument = ( + didIdentifier: string, + didMethodPrefix: string +) => ({ + '@context': ['https://w3id.org/did/v1.0', 'https://w3id.org/bnb/v1.0'], + controller: [], + verificationMethod: [ + { + id: `${didMethodPrefix}${didIdentifier}#default`, + type: 'EcdsaSecp256k1RecoveryMethod2020', + controller: `${didMethodPrefix}${didIdentifier}`, + ethereumAddress: didIdentifier.toLowerCase(), + }, + ], + authentication: [], + assertionMethod: [], + keyAgreement: [], + capabilityInvocation: [`${didMethodPrefix}${didIdentifier}#default`], + capabilityDelegation: [], + service: [], + id: `${didMethodPrefix}${didIdentifier}`, +}); diff --git a/ts-client/test/integration/util.ts b/ts-client/test/integration/util.ts deleted file mode 100644 index 4c072f0..0000000 --- a/ts-client/test/integration/util.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { JsonRpcProvider, ethers } from "ethers"; -import { fetchRpcWallet } from "../../src/utils" -import { DIDRegistry, DIDRegistry__factory } from "../../types/ethers-contracts"; - - -export const setAccountBalance = async (rpcProvider: JsonRpcProvider, address: string, amount: string) => { - const test = await rpcProvider.send("tenderly_setBalance",[address, amount]); -} - -export const deployDidRegistryContractInstance = async (signer: string): Promise => { - const wallet = fetchRpcWallet(signer); - const result = await new DIDRegistry__factory(wallet).deploy({gasLimit: 4000000}); - await result.deploymentTransaction().wait(); - return result; -} \ No newline at end of file diff --git a/ts-client/tsconfig.json b/ts-client/tsconfig.json index 6f363fc..dd1b9d3 100644 --- a/ts-client/tsconfig.json +++ b/ts-client/tsconfig.json @@ -1,109 +1,121 @@ { + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + "lib": ["es2020"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + "rootDir": ".", /* Specify the root folder within your source files. */ + // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "./dist", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules", + "dist" + ], + "ts-node": { "compilerOptions": { - /* Visit https://aka.ms/tsconfig to read more about this file */ - - /* Projects */ - // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ - // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ - // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ - // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ - // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ - // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ - - /* Language and Environment */ - "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "lib": ["es2020"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - // "jsx": "preserve", /* Specify what JSX code is generated. */ - // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ - // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ - // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ - // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ - // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ - // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ - // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ - // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ - // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ - - /* Modules */ - "module": "commonjs", /* Specify what module code is generated. */ - "rootDir": "src", /* Specify the root folder within your source files. */ - // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */ - // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ - // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ - // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ - // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ - // "types": [], /* Specify type package names to be included without being referenced in a source file. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ - // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ - // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ - // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ - // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ - // "resolveJsonModule": true, /* Enable importing .json files. */ - // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ - // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ - - /* JavaScript Support */ - // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ - // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ - // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ - - /* Emit */ - // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ - // "declarationMap": true, /* Create sourcemaps for d.ts files. */ - // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ - // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ - // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./bin", /* Specify an output folder for all emitted files. */ - // "removeComments": true, /* Disable emitting comments. */ - // "noEmit": true, /* Disable emitting files from a compilation. */ - // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ - // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ - // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ - // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ - // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ - // "newLine": "crlf", /* Set the newline character for emitting files. */ - // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ - // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ - // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ - // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ - // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ - // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ - - /* Interop Constraints */ - // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ - // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ - // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ - // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ - - /* Type Checking */ - "strict": false, /* Enable all strict type-checking options. */ - "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ - // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ - // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ - // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ - // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ - // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ - // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ - // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ - // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ - // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ - // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ - // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ - // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ - // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ - // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ - - /* Completeness */ - // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "module": "commonjs" } - } \ No newline at end of file + } +} diff --git a/ts-client/types/ethers-contracts/DIDRegistry.ts b/ts-client/types/ethers-contracts/DIDRegistry.ts deleted file mode 100644 index 6da41b9..0000000 --- a/ts-client/types/ethers-contracts/DIDRegistry.ts +++ /dev/null @@ -1,911 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - BaseContract, - BigNumberish, - BytesLike, - FunctionFragment, - Result, - Interface, - EventFragment, - AddressLike, - ContractRunner, - ContractMethod, - Listener, -} from "ethers"; -import type { - TypedContractEvent, - TypedDeferredTopicFilter, - TypedEventLog, - TypedLogDescription, - TypedListener, - TypedContractMethod, -} from "./common"; - -export declare namespace DIDRegistry { - export type ServiceStruct = { - fragment: string; - service_type: string; - service_endpoint: string; - }; - - export type ServiceStructOutput = [ - fragment: string, - service_type: string, - service_endpoint: string - ] & { fragment: string; service_type: string; service_endpoint: string }; - - export type VerificationMethodStruct = { - fragment: string; - flags: BigNumberish; - methodType: BigNumberish; - keyData: BytesLike; - }; - - export type VerificationMethodStructOutput = [ - fragment: string, - flags: bigint, - methodType: bigint, - keyData: string - ] & { fragment: string; flags: bigint; methodType: bigint; keyData: string }; - - export type DidStateStruct = { - verificationMethods: DIDRegistry.VerificationMethodStruct[]; - services: DIDRegistry.ServiceStruct[]; - nativeControllers: AddressLike[]; - externalControllers: string[]; - }; - - export type DidStateStructOutput = [ - verificationMethods: DIDRegistry.VerificationMethodStructOutput[], - services: DIDRegistry.ServiceStructOutput[], - nativeControllers: string[], - externalControllers: string[] - ] & { - verificationMethods: DIDRegistry.VerificationMethodStructOutput[]; - services: DIDRegistry.ServiceStructOutput[]; - nativeControllers: string[]; - externalControllers: string[]; - }; -} - -export interface DIDRegistryInterface extends Interface { - getFunction( - nameOrSignature: - | "addExternalController" - | "addNativeController" - | "addService" - | "addVerificationMethod" - | "initialize" - | "initializeDidState" - | "isGenerativeDidState" - | "owner" - | "proxiableUUID" - | "removeExternalController" - | "removeNativeController" - | "removeService" - | "removeVerificationMethod" - | "renounceOwnership" - | "resolveDidState" - | "transferOwnership" - | "updateVerificationMethodFlags" - | "upgradeTo" - | "upgradeToAndCall" - ): FunctionFragment; - - getEvent( - nameOrSignatureOrTopic: - | "AdminChanged" - | "BeaconUpgraded" - | "ControllerAdded" - | "ControllerRemoved" - | "Initialized" - | "OwnershipTransferred" - | "ServiceAdded" - | "ServiceRemoved" - | "Upgraded" - | "VerificationMethodAdded" - | "VerificationMethodFlagsUpdated" - | "VerificationMethodRemoved" - ): EventFragment; - - encodeFunctionData( - functionFragment: "addExternalController", - values: [AddressLike, string] - ): string; - encodeFunctionData( - functionFragment: "addNativeController", - values: [AddressLike, AddressLike] - ): string; - encodeFunctionData( - functionFragment: "addService", - values: [AddressLike, DIDRegistry.ServiceStruct] - ): string; - encodeFunctionData( - functionFragment: "addVerificationMethod", - values: [AddressLike, DIDRegistry.VerificationMethodStruct] - ): string; - encodeFunctionData( - functionFragment: "initialize", - values?: undefined - ): string; - encodeFunctionData( - functionFragment: "initializeDidState", - values: [AddressLike] - ): string; - encodeFunctionData( - functionFragment: "isGenerativeDidState", - values: [AddressLike] - ): string; - encodeFunctionData(functionFragment: "owner", values?: undefined): string; - encodeFunctionData( - functionFragment: "proxiableUUID", - values?: undefined - ): string; - encodeFunctionData( - functionFragment: "removeExternalController", - values: [AddressLike, string] - ): string; - encodeFunctionData( - functionFragment: "removeNativeController", - values: [AddressLike, AddressLike] - ): string; - encodeFunctionData( - functionFragment: "removeService", - values: [AddressLike, string] - ): string; - encodeFunctionData( - functionFragment: "removeVerificationMethod", - values: [AddressLike, string] - ): string; - encodeFunctionData( - functionFragment: "renounceOwnership", - values?: undefined - ): string; - encodeFunctionData( - functionFragment: "resolveDidState", - values: [AddressLike] - ): string; - encodeFunctionData( - functionFragment: "transferOwnership", - values: [AddressLike] - ): string; - encodeFunctionData( - functionFragment: "updateVerificationMethodFlags", - values: [AddressLike, string, BigNumberish] - ): string; - encodeFunctionData( - functionFragment: "upgradeTo", - values: [AddressLike] - ): string; - encodeFunctionData( - functionFragment: "upgradeToAndCall", - values: [AddressLike, BytesLike] - ): string; - - decodeFunctionResult( - functionFragment: "addExternalController", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "addNativeController", - data: BytesLike - ): Result; - decodeFunctionResult(functionFragment: "addService", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "addVerificationMethod", - data: BytesLike - ): Result; - decodeFunctionResult(functionFragment: "initialize", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "initializeDidState", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "isGenerativeDidState", - data: BytesLike - ): Result; - decodeFunctionResult(functionFragment: "owner", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "proxiableUUID", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "removeExternalController", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "removeNativeController", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "removeService", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "removeVerificationMethod", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "renounceOwnership", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "resolveDidState", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "transferOwnership", - data: BytesLike - ): Result; - decodeFunctionResult( - functionFragment: "updateVerificationMethodFlags", - data: BytesLike - ): Result; - decodeFunctionResult(functionFragment: "upgradeTo", data: BytesLike): Result; - decodeFunctionResult( - functionFragment: "upgradeToAndCall", - data: BytesLike - ): Result; -} - -export namespace AdminChangedEvent { - export type InputTuple = [previousAdmin: AddressLike, newAdmin: AddressLike]; - export type OutputTuple = [previousAdmin: string, newAdmin: string]; - export interface OutputObject { - previousAdmin: string; - newAdmin: string; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace BeaconUpgradedEvent { - export type InputTuple = [beacon: AddressLike]; - export type OutputTuple = [beacon: string]; - export interface OutputObject { - beacon: string; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace ControllerAddedEvent { - export type InputTuple = [ - didIdentifier: AddressLike, - newController: BytesLike, - isNative: boolean - ]; - export type OutputTuple = [ - didIdentifier: string, - newController: string, - isNative: boolean - ]; - export interface OutputObject { - didIdentifier: string; - newController: string; - isNative: boolean; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace ControllerRemovedEvent { - export type InputTuple = [ - didIdentifier: AddressLike, - removedController: BytesLike, - isNative: boolean - ]; - export type OutputTuple = [ - didIdentifier: string, - removedController: string, - isNative: boolean - ]; - export interface OutputObject { - didIdentifier: string; - removedController: string; - isNative: boolean; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace InitializedEvent { - export type InputTuple = [version: BigNumberish]; - export type OutputTuple = [version: bigint]; - export interface OutputObject { - version: bigint; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace OwnershipTransferredEvent { - export type InputTuple = [previousOwner: AddressLike, newOwner: AddressLike]; - export type OutputTuple = [previousOwner: string, newOwner: string]; - export interface OutputObject { - previousOwner: string; - newOwner: string; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace ServiceAddedEvent { - export type InputTuple = [didIdentifier: AddressLike, fragment: string]; - export type OutputTuple = [didIdentifier: string, fragment: string]; - export interface OutputObject { - didIdentifier: string; - fragment: string; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace ServiceRemovedEvent { - export type InputTuple = [didIdentifier: AddressLike, fragment: string]; - export type OutputTuple = [didIdentifier: string, fragment: string]; - export interface OutputObject { - didIdentifier: string; - fragment: string; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace UpgradedEvent { - export type InputTuple = [implementation: AddressLike]; - export type OutputTuple = [implementation: string]; - export interface OutputObject { - implementation: string; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace VerificationMethodAddedEvent { - export type InputTuple = [didIdentifier: AddressLike, fragment: string]; - export type OutputTuple = [didIdentifier: string, fragment: string]; - export interface OutputObject { - didIdentifier: string; - fragment: string; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace VerificationMethodFlagsUpdatedEvent { - export type InputTuple = [ - didIdentifier: AddressLike, - fragment: string, - oldFlags: BigNumberish, - newFlags: BigNumberish - ]; - export type OutputTuple = [ - didIdentifier: string, - fragment: string, - oldFlags: bigint, - newFlags: bigint - ]; - export interface OutputObject { - didIdentifier: string; - fragment: string; - oldFlags: bigint; - newFlags: bigint; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export namespace VerificationMethodRemovedEvent { - export type InputTuple = [didIdentifier: AddressLike, fragment: string]; - export type OutputTuple = [didIdentifier: string, fragment: string]; - export interface OutputObject { - didIdentifier: string; - fragment: string; - } - export type Event = TypedContractEvent; - export type Filter = TypedDeferredTopicFilter; - export type Log = TypedEventLog; - export type LogDescription = TypedLogDescription; -} - -export interface DIDRegistry extends BaseContract { - connect(runner?: ContractRunner | null): DIDRegistry; - waitForDeployment(): Promise; - - interface: DIDRegistryInterface; - - queryFilter( - event: TCEvent, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined - ): Promise>>; - queryFilter( - filter: TypedDeferredTopicFilter, - fromBlockOrBlockhash?: string | number | undefined, - toBlock?: string | number | undefined - ): Promise>>; - - on( - event: TCEvent, - listener: TypedListener - ): Promise; - on( - filter: TypedDeferredTopicFilter, - listener: TypedListener - ): Promise; - - once( - event: TCEvent, - listener: TypedListener - ): Promise; - once( - filter: TypedDeferredTopicFilter, - listener: TypedListener - ): Promise; - - listeners( - event: TCEvent - ): Promise>>; - listeners(eventName?: string): Promise>; - removeAllListeners( - event?: TCEvent - ): Promise; - - addExternalController: TypedContractMethod< - [didIdentifier: AddressLike, controller: string], - [void], - "nonpayable" - >; - - addNativeController: TypedContractMethod< - [didIdentifier: AddressLike, controller: AddressLike], - [void], - "nonpayable" - >; - - addService: TypedContractMethod< - [didIdentifier: AddressLike, service: DIDRegistry.ServiceStruct], - [void], - "nonpayable" - >; - - addVerificationMethod: TypedContractMethod< - [ - didIdentifier: AddressLike, - verificationMethod: DIDRegistry.VerificationMethodStruct - ], - [void], - "nonpayable" - >; - - initialize: TypedContractMethod<[], [void], "nonpayable">; - - initializeDidState: TypedContractMethod< - [didIdentifier: AddressLike], - [void], - "nonpayable" - >; - - isGenerativeDidState: TypedContractMethod< - [didIdentifier: AddressLike], - [boolean], - "view" - >; - - owner: TypedContractMethod<[], [string], "view">; - - proxiableUUID: TypedContractMethod<[], [string], "view">; - - removeExternalController: TypedContractMethod< - [didIdentifier: AddressLike, controller: string], - [boolean], - "nonpayable" - >; - - removeNativeController: TypedContractMethod< - [didIdentifier: AddressLike, controller: AddressLike], - [boolean], - "nonpayable" - >; - - removeService: TypedContractMethod< - [didIdentifier: AddressLike, fragment: string], - [boolean], - "nonpayable" - >; - - removeVerificationMethod: TypedContractMethod< - [didIdentifier: AddressLike, fragment: string], - [boolean], - "nonpayable" - >; - - renounceOwnership: TypedContractMethod<[], [void], "nonpayable">; - - resolveDidState: TypedContractMethod< - [didIdentifier: AddressLike], - [DIDRegistry.DidStateStructOutput], - "view" - >; - - transferOwnership: TypedContractMethod< - [newOwner: AddressLike], - [void], - "nonpayable" - >; - - updateVerificationMethodFlags: TypedContractMethod< - [didIdentifier: AddressLike, fragment: string, flags: BigNumberish], - [boolean], - "nonpayable" - >; - - upgradeTo: TypedContractMethod< - [newImplementation: AddressLike], - [void], - "nonpayable" - >; - - upgradeToAndCall: TypedContractMethod< - [newImplementation: AddressLike, data: BytesLike], - [void], - "payable" - >; - - getFunction( - key: string | FunctionFragment - ): T; - - getFunction( - nameOrSignature: "addExternalController" - ): TypedContractMethod< - [didIdentifier: AddressLike, controller: string], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "addNativeController" - ): TypedContractMethod< - [didIdentifier: AddressLike, controller: AddressLike], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "addService" - ): TypedContractMethod< - [didIdentifier: AddressLike, service: DIDRegistry.ServiceStruct], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "addVerificationMethod" - ): TypedContractMethod< - [ - didIdentifier: AddressLike, - verificationMethod: DIDRegistry.VerificationMethodStruct - ], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "initialize" - ): TypedContractMethod<[], [void], "nonpayable">; - getFunction( - nameOrSignature: "initializeDidState" - ): TypedContractMethod<[didIdentifier: AddressLike], [void], "nonpayable">; - getFunction( - nameOrSignature: "isGenerativeDidState" - ): TypedContractMethod<[didIdentifier: AddressLike], [boolean], "view">; - getFunction( - nameOrSignature: "owner" - ): TypedContractMethod<[], [string], "view">; - getFunction( - nameOrSignature: "proxiableUUID" - ): TypedContractMethod<[], [string], "view">; - getFunction( - nameOrSignature: "removeExternalController" - ): TypedContractMethod< - [didIdentifier: AddressLike, controller: string], - [boolean], - "nonpayable" - >; - getFunction( - nameOrSignature: "removeNativeController" - ): TypedContractMethod< - [didIdentifier: AddressLike, controller: AddressLike], - [boolean], - "nonpayable" - >; - getFunction( - nameOrSignature: "removeService" - ): TypedContractMethod< - [didIdentifier: AddressLike, fragment: string], - [boolean], - "nonpayable" - >; - getFunction( - nameOrSignature: "removeVerificationMethod" - ): TypedContractMethod< - [didIdentifier: AddressLike, fragment: string], - [boolean], - "nonpayable" - >; - getFunction( - nameOrSignature: "renounceOwnership" - ): TypedContractMethod<[], [void], "nonpayable">; - getFunction( - nameOrSignature: "resolveDidState" - ): TypedContractMethod< - [didIdentifier: AddressLike], - [DIDRegistry.DidStateStructOutput], - "view" - >; - getFunction( - nameOrSignature: "transferOwnership" - ): TypedContractMethod<[newOwner: AddressLike], [void], "nonpayable">; - getFunction( - nameOrSignature: "updateVerificationMethodFlags" - ): TypedContractMethod< - [didIdentifier: AddressLike, fragment: string, flags: BigNumberish], - [boolean], - "nonpayable" - >; - getFunction( - nameOrSignature: "upgradeTo" - ): TypedContractMethod< - [newImplementation: AddressLike], - [void], - "nonpayable" - >; - getFunction( - nameOrSignature: "upgradeToAndCall" - ): TypedContractMethod< - [newImplementation: AddressLike, data: BytesLike], - [void], - "payable" - >; - - getEvent( - key: "AdminChanged" - ): TypedContractEvent< - AdminChangedEvent.InputTuple, - AdminChangedEvent.OutputTuple, - AdminChangedEvent.OutputObject - >; - getEvent( - key: "BeaconUpgraded" - ): TypedContractEvent< - BeaconUpgradedEvent.InputTuple, - BeaconUpgradedEvent.OutputTuple, - BeaconUpgradedEvent.OutputObject - >; - getEvent( - key: "ControllerAdded" - ): TypedContractEvent< - ControllerAddedEvent.InputTuple, - ControllerAddedEvent.OutputTuple, - ControllerAddedEvent.OutputObject - >; - getEvent( - key: "ControllerRemoved" - ): TypedContractEvent< - ControllerRemovedEvent.InputTuple, - ControllerRemovedEvent.OutputTuple, - ControllerRemovedEvent.OutputObject - >; - getEvent( - key: "Initialized" - ): TypedContractEvent< - InitializedEvent.InputTuple, - InitializedEvent.OutputTuple, - InitializedEvent.OutputObject - >; - getEvent( - key: "OwnershipTransferred" - ): TypedContractEvent< - OwnershipTransferredEvent.InputTuple, - OwnershipTransferredEvent.OutputTuple, - OwnershipTransferredEvent.OutputObject - >; - getEvent( - key: "ServiceAdded" - ): TypedContractEvent< - ServiceAddedEvent.InputTuple, - ServiceAddedEvent.OutputTuple, - ServiceAddedEvent.OutputObject - >; - getEvent( - key: "ServiceRemoved" - ): TypedContractEvent< - ServiceRemovedEvent.InputTuple, - ServiceRemovedEvent.OutputTuple, - ServiceRemovedEvent.OutputObject - >; - getEvent( - key: "Upgraded" - ): TypedContractEvent< - UpgradedEvent.InputTuple, - UpgradedEvent.OutputTuple, - UpgradedEvent.OutputObject - >; - getEvent( - key: "VerificationMethodAdded" - ): TypedContractEvent< - VerificationMethodAddedEvent.InputTuple, - VerificationMethodAddedEvent.OutputTuple, - VerificationMethodAddedEvent.OutputObject - >; - getEvent( - key: "VerificationMethodFlagsUpdated" - ): TypedContractEvent< - VerificationMethodFlagsUpdatedEvent.InputTuple, - VerificationMethodFlagsUpdatedEvent.OutputTuple, - VerificationMethodFlagsUpdatedEvent.OutputObject - >; - getEvent( - key: "VerificationMethodRemoved" - ): TypedContractEvent< - VerificationMethodRemovedEvent.InputTuple, - VerificationMethodRemovedEvent.OutputTuple, - VerificationMethodRemovedEvent.OutputObject - >; - - filters: { - "AdminChanged(address,address)": TypedContractEvent< - AdminChangedEvent.InputTuple, - AdminChangedEvent.OutputTuple, - AdminChangedEvent.OutputObject - >; - AdminChanged: TypedContractEvent< - AdminChangedEvent.InputTuple, - AdminChangedEvent.OutputTuple, - AdminChangedEvent.OutputObject - >; - - "BeaconUpgraded(address)": TypedContractEvent< - BeaconUpgradedEvent.InputTuple, - BeaconUpgradedEvent.OutputTuple, - BeaconUpgradedEvent.OutputObject - >; - BeaconUpgraded: TypedContractEvent< - BeaconUpgradedEvent.InputTuple, - BeaconUpgradedEvent.OutputTuple, - BeaconUpgradedEvent.OutputObject - >; - - "ControllerAdded(address,bytes,bool)": TypedContractEvent< - ControllerAddedEvent.InputTuple, - ControllerAddedEvent.OutputTuple, - ControllerAddedEvent.OutputObject - >; - ControllerAdded: TypedContractEvent< - ControllerAddedEvent.InputTuple, - ControllerAddedEvent.OutputTuple, - ControllerAddedEvent.OutputObject - >; - - "ControllerRemoved(address,bytes,bool)": TypedContractEvent< - ControllerRemovedEvent.InputTuple, - ControllerRemovedEvent.OutputTuple, - ControllerRemovedEvent.OutputObject - >; - ControllerRemoved: TypedContractEvent< - ControllerRemovedEvent.InputTuple, - ControllerRemovedEvent.OutputTuple, - ControllerRemovedEvent.OutputObject - >; - - "Initialized(uint8)": TypedContractEvent< - InitializedEvent.InputTuple, - InitializedEvent.OutputTuple, - InitializedEvent.OutputObject - >; - Initialized: TypedContractEvent< - InitializedEvent.InputTuple, - InitializedEvent.OutputTuple, - InitializedEvent.OutputObject - >; - - "OwnershipTransferred(address,address)": TypedContractEvent< - OwnershipTransferredEvent.InputTuple, - OwnershipTransferredEvent.OutputTuple, - OwnershipTransferredEvent.OutputObject - >; - OwnershipTransferred: TypedContractEvent< - OwnershipTransferredEvent.InputTuple, - OwnershipTransferredEvent.OutputTuple, - OwnershipTransferredEvent.OutputObject - >; - - "ServiceAdded(address,string)": TypedContractEvent< - ServiceAddedEvent.InputTuple, - ServiceAddedEvent.OutputTuple, - ServiceAddedEvent.OutputObject - >; - ServiceAdded: TypedContractEvent< - ServiceAddedEvent.InputTuple, - ServiceAddedEvent.OutputTuple, - ServiceAddedEvent.OutputObject - >; - - "ServiceRemoved(address,string)": TypedContractEvent< - ServiceRemovedEvent.InputTuple, - ServiceRemovedEvent.OutputTuple, - ServiceRemovedEvent.OutputObject - >; - ServiceRemoved: TypedContractEvent< - ServiceRemovedEvent.InputTuple, - ServiceRemovedEvent.OutputTuple, - ServiceRemovedEvent.OutputObject - >; - - "Upgraded(address)": TypedContractEvent< - UpgradedEvent.InputTuple, - UpgradedEvent.OutputTuple, - UpgradedEvent.OutputObject - >; - Upgraded: TypedContractEvent< - UpgradedEvent.InputTuple, - UpgradedEvent.OutputTuple, - UpgradedEvent.OutputObject - >; - - "VerificationMethodAdded(address,string)": TypedContractEvent< - VerificationMethodAddedEvent.InputTuple, - VerificationMethodAddedEvent.OutputTuple, - VerificationMethodAddedEvent.OutputObject - >; - VerificationMethodAdded: TypedContractEvent< - VerificationMethodAddedEvent.InputTuple, - VerificationMethodAddedEvent.OutputTuple, - VerificationMethodAddedEvent.OutputObject - >; - - "VerificationMethodFlagsUpdated(address,string,uint16,uint16)": TypedContractEvent< - VerificationMethodFlagsUpdatedEvent.InputTuple, - VerificationMethodFlagsUpdatedEvent.OutputTuple, - VerificationMethodFlagsUpdatedEvent.OutputObject - >; - VerificationMethodFlagsUpdated: TypedContractEvent< - VerificationMethodFlagsUpdatedEvent.InputTuple, - VerificationMethodFlagsUpdatedEvent.OutputTuple, - VerificationMethodFlagsUpdatedEvent.OutputObject - >; - - "VerificationMethodRemoved(address,string)": TypedContractEvent< - VerificationMethodRemovedEvent.InputTuple, - VerificationMethodRemovedEvent.OutputTuple, - VerificationMethodRemovedEvent.OutputObject - >; - VerificationMethodRemoved: TypedContractEvent< - VerificationMethodRemovedEvent.InputTuple, - VerificationMethodRemovedEvent.OutputTuple, - VerificationMethodRemovedEvent.OutputObject - >; - }; -} diff --git a/ts-client/types/ethers-contracts/common.ts b/ts-client/types/ethers-contracts/common.ts deleted file mode 100644 index 56b5f21..0000000 --- a/ts-client/types/ethers-contracts/common.ts +++ /dev/null @@ -1,131 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import type { - FunctionFragment, - Typed, - EventFragment, - ContractTransaction, - ContractTransactionResponse, - DeferredTopicFilter, - EventLog, - TransactionRequest, - LogDescription, -} from "ethers"; - -export interface TypedDeferredTopicFilter<_TCEvent extends TypedContractEvent> - extends DeferredTopicFilter {} - -export interface TypedContractEvent< - InputTuple extends Array = any, - OutputTuple extends Array = any, - OutputObject = any -> { - (...args: Partial): TypedDeferredTopicFilter< - TypedContractEvent - >; - name: string; - fragment: EventFragment; - getFragment(...args: Partial): EventFragment; -} - -type __TypechainAOutputTuple = T extends TypedContractEvent< - infer _U, - infer W -> - ? W - : never; -type __TypechainOutputObject = T extends TypedContractEvent< - infer _U, - infer _W, - infer V -> - ? V - : never; - -export interface TypedEventLog - extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} - -export interface TypedLogDescription - extends Omit { - args: __TypechainAOutputTuple & __TypechainOutputObject; -} - -export type TypedListener = ( - ...listenerArg: [ - ...__TypechainAOutputTuple, - TypedEventLog, - ...undefined[] - ] -) => void; - -export type MinEthersFactory = { - deploy(...a: ARGS[]): Promise; -}; - -export type GetContractTypeFromFactory = F extends MinEthersFactory< - infer C, - any -> - ? C - : never; -export type GetARGsTypeFromFactory = F extends MinEthersFactory - ? Parameters - : never; - -export type StateMutability = "nonpayable" | "payable" | "view"; - -export type BaseOverrides = Omit; -export type NonPayableOverrides = Omit< - BaseOverrides, - "value" | "blockTag" | "enableCcipRead" ->; -export type PayableOverrides = Omit< - BaseOverrides, - "blockTag" | "enableCcipRead" ->; -export type ViewOverrides = Omit; -export type Overrides = S extends "nonpayable" - ? NonPayableOverrides - : S extends "payable" - ? PayableOverrides - : ViewOverrides; - -export type PostfixOverrides, S extends StateMutability> = - | A - | [...A, Overrides]; -export type ContractMethodArgs< - A extends Array, - S extends StateMutability -> = PostfixOverrides<{ [I in keyof A]-?: A[I] | Typed }, S>; - -export type DefaultReturnType = R extends Array ? R[0] : R; - -// export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { -export interface TypedContractMethod< - A extends Array = Array, - R = any, - S extends StateMutability = "payable" -> { - (...args: ContractMethodArgs): S extends "view" - ? Promise> - : Promise; - - name: string; - - fragment: FunctionFragment; - - getFragment(...args: ContractMethodArgs): FunctionFragment; - - populateTransaction( - ...args: ContractMethodArgs - ): Promise; - staticCall( - ...args: ContractMethodArgs - ): Promise>; - send(...args: ContractMethodArgs): Promise; - estimateGas(...args: ContractMethodArgs): Promise; - staticCallResult(...args: ContractMethodArgs): Promise; -} diff --git a/ts-client/types/ethers-contracts/factories/DIDRegistry__factory.ts b/ts-client/types/ethers-contracts/factories/DIDRegistry__factory.ts deleted file mode 100644 index 6d634aa..0000000 --- a/ts-client/types/ethers-contracts/factories/DIDRegistry__factory.ts +++ /dev/null @@ -1,732 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -import { - Contract, - ContractFactory, - ContractTransactionResponse, - Interface, -} from "ethers"; -import type { Signer, ContractDeployTransaction, ContractRunner } from "ethers"; -import type { NonPayableOverrides } from "../common"; -import type { DIDRegistry, DIDRegistryInterface } from "../DIDRegistry"; - -const _abi = [ - { - inputs: [], - stateMutability: "nonpayable", - type: "constructor", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "address", - name: "previousAdmin", - type: "address", - }, - { - indexed: false, - internalType: "address", - name: "newAdmin", - type: "address", - }, - ], - name: "AdminChanged", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "beacon", - type: "address", - }, - ], - name: "BeaconUpgraded", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - indexed: false, - internalType: "bytes", - name: "newController", - type: "bytes", - }, - { - indexed: false, - internalType: "bool", - name: "isNative", - type: "bool", - }, - ], - name: "ControllerAdded", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - indexed: false, - internalType: "bytes", - name: "removedController", - type: "bytes", - }, - { - indexed: false, - internalType: "bool", - name: "isNative", - type: "bool", - }, - ], - name: "ControllerRemoved", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint8", - name: "version", - type: "uint8", - }, - ], - name: "Initialized", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "previousOwner", - type: "address", - }, - { - indexed: true, - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "OwnershipTransferred", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - indexed: true, - internalType: "string", - name: "fragment", - type: "string", - }, - ], - name: "ServiceAdded", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - indexed: true, - internalType: "string", - name: "fragment", - type: "string", - }, - ], - name: "ServiceRemoved", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "implementation", - type: "address", - }, - ], - name: "Upgraded", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - indexed: true, - internalType: "string", - name: "fragment", - type: "string", - }, - ], - name: "VerificationMethodAdded", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - indexed: true, - internalType: "string", - name: "fragment", - type: "string", - }, - { - indexed: false, - internalType: "uint16", - name: "oldFlags", - type: "uint16", - }, - { - indexed: false, - internalType: "uint16", - name: "newFlags", - type: "uint16", - }, - ], - name: "VerificationMethodFlagsUpdated", - type: "event", - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - indexed: true, - internalType: "string", - name: "fragment", - type: "string", - }, - ], - name: "VerificationMethodRemoved", - type: "event", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - internalType: "string", - name: "controller", - type: "string", - }, - ], - name: "addExternalController", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - internalType: "address", - name: "controller", - type: "address", - }, - ], - name: "addNativeController", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - components: [ - { - internalType: "string", - name: "fragment", - type: "string", - }, - { - internalType: "string", - name: "service_type", - type: "string", - }, - { - internalType: "string", - name: "service_endpoint", - type: "string", - }, - ], - internalType: "struct DIDRegistry.Service", - name: "service", - type: "tuple", - }, - ], - name: "addService", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - components: [ - { - internalType: "string", - name: "fragment", - type: "string", - }, - { - internalType: "uint16", - name: "flags", - type: "uint16", - }, - { - internalType: "enum DIDRegistry.VerificationMethodType", - name: "methodType", - type: "uint8", - }, - { - internalType: "bytes", - name: "keyData", - type: "bytes", - }, - ], - internalType: "struct DIDRegistry.VerificationMethod", - name: "verificationMethod", - type: "tuple", - }, - ], - name: "addVerificationMethod", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "initialize", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - ], - name: "initializeDidState", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - ], - name: "isGenerativeDidState", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "owner", - outputs: [ - { - internalType: "address", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "proxiableUUID", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - internalType: "string", - name: "controller", - type: "string", - }, - ], - name: "removeExternalController", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - internalType: "address", - name: "controller", - type: "address", - }, - ], - name: "removeNativeController", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - internalType: "string", - name: "fragment", - type: "string", - }, - ], - name: "removeService", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - internalType: "string", - name: "fragment", - type: "string", - }, - ], - name: "removeVerificationMethod", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - ], - name: "resolveDidState", - outputs: [ - { - components: [ - { - components: [ - { - internalType: "string", - name: "fragment", - type: "string", - }, - { - internalType: "uint16", - name: "flags", - type: "uint16", - }, - { - internalType: "enum DIDRegistry.VerificationMethodType", - name: "methodType", - type: "uint8", - }, - { - internalType: "bytes", - name: "keyData", - type: "bytes", - }, - ], - internalType: "struct DIDRegistry.VerificationMethod[]", - name: "verificationMethods", - type: "tuple[]", - }, - { - components: [ - { - internalType: "string", - name: "fragment", - type: "string", - }, - { - internalType: "string", - name: "service_type", - type: "string", - }, - { - internalType: "string", - name: "service_endpoint", - type: "string", - }, - ], - internalType: "struct DIDRegistry.Service[]", - name: "services", - type: "tuple[]", - }, - { - internalType: "address[]", - name: "nativeControllers", - type: "address[]", - }, - { - internalType: "string[]", - name: "externalControllers", - type: "string[]", - }, - ], - internalType: "struct DIDRegistry.DidState", - name: "", - type: "tuple", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newOwner", - type: "address", - }, - ], - name: "transferOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "didIdentifier", - type: "address", - }, - { - internalType: "string", - name: "fragment", - type: "string", - }, - { - internalType: "uint16", - name: "flags", - type: "uint16", - }, - ], - name: "updateVerificationMethodFlags", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newImplementation", - type: "address", - }, - ], - name: "upgradeTo", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "newImplementation", - type: "address", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "upgradeToAndCall", - outputs: [], - stateMutability: "payable", - type: "function", - }, -] as const; - -const _bytecode = - "0x60a0604052306080523480156200001557600080fd5b506200002062000026565b620000e7565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e5576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6080516144026200011f6000396000818161038f015281816103d801528181610477015281816104b7015261081501526144026000f3fe6080604052600436106101145760003560e01c8063767187aa116100a0578063b601162311610064578063b6011623146102e5578063c44d9e6314610305578063cc3cfb1514610325578063f2fde38b14610345578063fa3454f91461036557600080fd5b8063767187aa1461023b5780638129fc1c146102685780638da5cb5b1461027d578063969ef575146102a55780639d627c70146102c557600080fd5b80635533e7e0116100e75780635533e7e0146101a657806358cfec5f146101c65780635ab618ea146101e65780636940d8e614610206578063715018a61461022657600080fd5b80633659cfe6146101195780634f1ef2861461013b5780634f86df821461014e57806352d1902d14610183575b600080fd5b34801561012557600080fd5b50610139610134366004613479565b610385565b005b6101396101493660046134aa565b61046d565b34801561015a57600080fd5b5061016e61016936600461356c565b61053d565b60405190151581526020015b60405180910390f35b34801561018f57600080fd5b50610198610808565b60405190815260200161017a565b3480156101b257600080fd5b506101396101c136600461356c565b6108bb565b3480156101d257600080fd5b506101396101e13660046135e8565b610a0f565b3480156101f257600080fd5b5061016e6102013660046135e8565b610b60565b34801561021257600080fd5b5061013961022136600461363b565b610fc4565b34801561023257600080fd5b5061013961111a565b34801561024757600080fd5b5061025b610256366004613479565b61112e565b60405161017a9190613818565b34801561027457600080fd5b506101396116a7565b34801561028957600080fd5b506097546040516001600160a01b03909116815260200161017a565b3480156102b157600080fd5b5061016e6102c03660046135e8565b6117bf565b3480156102d157600080fd5b506101396102e0366004613939565b611ab8565b3480156102f157600080fd5b50610139610300366004613479565b611cbe565b34801561031157600080fd5b5061016e610320366004613993565b611ddc565b34801561033157600080fd5b5061016e6103403660046135e8565b6121b2565b34801561035157600080fd5b50610139610360366004613479565b6123c5565b34801561037157600080fd5b5061016e610380366004613479565b61243b565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036103d65760405162461bcd60e51b81526004016103cd906139f9565b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661041f600080516020614386833981519152546001600160a01b031690565b6001600160a01b0316146104455760405162461bcd60e51b81526004016103cd90613a45565b61044e8161296f565b6040805160008082526020820190925261046a91839190612977565b50565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036104b55760405162461bcd60e51b81526004016103cd906139f9565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166104fe600080516020614386833981519152546001600160a01b031690565b6001600160a01b0316146105245760405162461bcd60e51b81526004016103cd90613a45565b61052d8261296f565b61053982826001612977565b5050565b6000826105498161243b565b156105665760405162461bcd60e51b81526004016103cd90613a91565b836105718133612ae7565b61058d5760405162461bcd60e51b81526004016103cd90613aee565b836001600160a01b0316856001600160a01b0316036105fa5760405162461bcd60e51b815260206004820152602360248201527f43616e6e6f742072656d6f76652064656661756c7420617574686f72697479206044820152626b657960e81b60648201526084016103cd565b6106048585612ba7565b6106505760405162461bcd60e51b815260206004820181905260248201527f4e617469766520636f6e74726f6c6c657220646f6573206e6f7420657869737460448201526064016103cd565b6001600160a01b038516600090815260c960205260408120905b60028201548110156107f957856001600160a01b031682600201828154811061069557610695613b42565b6000918252602090912001546001600160a01b0316036107e7576002820180546106c190600190613b6e565b815481106106d1576106d1613b42565b6000918252602090912001546002830180546001600160a01b0390921691839081106106ff576106ff613b42565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055508160020180548061074057610740613b81565b6001900381819060005260206000200160006101000a8154906001600160a01b0302191690559055866001600160a01b03167f9a55813d7cd2d2b9253e319e832bd00a0b8743de9d6d759dcb42293aebedb735876040516020016107b7919060609190911b6001600160601b031916815260140190565b60408051601f19818403018152908290526107d491600190613b97565b60405180910390a2600194505050610800565b806107f181613bbb565b91505061066a565b5060009350505b505092915050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108a85760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c000000000000000060648201526084016103cd565b5060008051602061438683398151915290565b816108c58161243b565b156108e25760405162461bcd60e51b81526004016103cd90613a91565b826108ed8133612ae7565b6109095760405162461bcd60e51b81526004016103cd90613aee565b6109138484612ba7565b156109605760405162461bcd60e51b815260206004820152601f60248201527f4e617469766520636f6e74726f6c6c657220616c72656164792065786973740060448201526064016103cd565b6001600160a01b03848116600081815260c96020908152604080832060020180546001810182559084529282902090920180546001600160a01b03191694881694909417909355516001600160601b0319606087901b1692810192909252907fee1ff2642b3d131f35b912f6a759192b10643f6bf93c6b9c732a2aa01ae199419060340160408051601f1981840301815290829052610a0191600190613b97565b60405180910390a250505050565b82610a198161243b565b15610a365760405162461bcd60e51b81526004016103cd90613a91565b83610a418133612ae7565b610a5d5760405162461bcd60e51b81526004016103cd90613aee565b610a68858585612c23565b15610abf5760405162461bcd60e51b815260206004820152602160248201527f45787465726e616c20636f6e74726f6c6c657220616c726561647920657869736044820152601d60fa1b60648201526084016103cd565b6001600160a01b038516600090815260c96020908152604082206003018054600181018255908352912001610af5848683613c71565b50846001600160a01b03167fee1ff2642b3d131f35b912f6a759192b10643f6bf93c6b9c732a2aa01ae199418585604051602001610b34929190613d2b565b60408051601f1981840301815290829052610b5191600090613b97565b60405180910390a25050505050565b600083610b6c8161243b565b15610b895760405162461bcd60e51b81526004016103cd90613a91565b84610b948133612ae7565b610bb05760405162461bcd60e51b81526004016103cd90613aee565b6001600160a01b038616600090815260c9602052604090208054600110610c5e5760405162461bcd60e51b815260206004820152605660248201527f43616e6e6f742072656d6f766520766572696669636174696f6e206d6574686f60448201527f642e20446964206d75737420616c776179732068617665206174206c65617374606482015275080c481d995c9a599a58d85d1a5bdb881b595d1a1bd960521b608482015260a4016103cd565b610c69878787612d60565b610c855760405162461bcd60e51b81526004016103cd90613d3b565b60005b8154811015610fb4576000826000018281548110610ca857610ca8613b42565b90600052602060002090600302019050610d84816000018054610cca90613bd4565b80601f0160208091040260200160405190810160405280929190818152602001828054610cf690613bd4565b8015610d435780601f10610d1857610100808354040283529160200191610d43565b820191906000526020600020905b815481529060010190602001808311610d2657829003601f168201915b505050505089898080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612e2392505050565b15610fa1576001810154600090610da09061ffff166006612e8d565b90508015610e165760405162461bcd60e51b815260206004820152603b60248201527f43616e6e6f742072656d6f766520766572696669636174696f6e206d6574686f60448201527f642062656361757365206f662070726f74656374656420666c6167000000000060648201526084016103cd565b83548490610e2690600190613b6e565b81548110610e3657610e36613b42565b9060005260206000209060030201846000018481548110610e5957610e59613b42565b6000918252602090912060039091020180610e748382613d98565b5060018281018054918301805461ffff19811661ffff9094169384178255915460ff62010000918290041693919262ffffff191690911790838015610ebb57610ebb6136e0565b0217905550600281810190610ed290840182613d98565b5050845485915080610ee657610ee6613b81565b60008281526020812060001990920191600383020190610f06828261340f565b60018201805462ffffff19169055610f2260028301600061340f565b50509055610f2f8a612eb7565b610f4b5760405162461bcd60e51b81526004016103cd90613e6f565b604051610f59908390613ebf565b604051908190038120906001600160a01b038c16907f13aaf98b5e53496b16e04d43802aa43f08c53f27d33c40cf33b55ad473c3812490600090a36001965050505050610fbb565b5080610fac81613bbb565b915050610c88565b5060009350505b50509392505050565b81610fce8161243b565b15610feb5760405162461bcd60e51b81526004016103cd90613a91565b82610ff68133612ae7565b6110125760405162461bcd60e51b81526004016103cd90613aee565b611025846110208580613f35565b612d60565b156110845760405162461bcd60e51b815260206004820152602960248201527f467261676d656e7420616c7265616479206578697374206f6e20616e6f74686560448201526872207365727669636560b81b60648201526084016103cd565b6001600160a01b038416600090815260c9602090815260408220600190810180549182018155835291208491600302016110be8282613f7c565b506110cb90508380613f35565b6040516110d9929190613d2b565b604051908190038120906001600160a01b038616907fb33be4898b3eae72be50da48dea4d99c1e830cd6f31f9d534998c4fcaa91b62e90600090a350505050565b611122612f1d565b61112c6000612f77565b565b6111596040518060800160405280606081526020016060815260200160608152602001606081525090565b6111628261243b565b156111765761117082612fc9565b92915050565b6001600160a01b038216600090815260c9602090815260408083208151815460a09481028201850190935260808101838152909491938593919285929185015b8282101561134957838290600052602060002090600302016040518060800160405290816000820180546111e990613bd4565b80601f016020809104026020016040519081016040528092919081815260200182805461121590613bd4565b80156112625780601f1061123757610100808354040283529160200191611262565b820191906000526020600020905b81548152906001019060200180831161124557829003601f168201915b5050509183525050600182015461ffff8116602083015260409091019062010000900460ff168015611296576112966136e0565b80156112a4576112a46136e0565b81526020016002820180546112b890613bd4565b80601f01602080910402602001604051908101604052809291908181526020018280546112e490613bd4565b80156113315780601f1061130657610100808354040283529160200191611331565b820191906000526020600020905b81548152906001019060200180831161131457829003601f168201915b505050505081525050815260200190600101906111b6565b50505050815260200160018201805480602002602001604051908101604052809291908181526020016000905b8282101561155e57838290600052602060002090600302016040518060600160405290816000820180546113a990613bd4565b80601f01602080910402602001604051908101604052809291908181526020018280546113d590613bd4565b80156114225780601f106113f757610100808354040283529160200191611422565b820191906000526020600020905b81548152906001019060200180831161140557829003601f168201915b5050505050815260200160018201805461143b90613bd4565b80601f016020809104026020016040519081016040528092919081815260200182805461146790613bd4565b80156114b45780601f10611489576101008083540402835291602001916114b4565b820191906000526020600020905b81548152906001019060200180831161149757829003601f168201915b505050505081526020016002820180546114cd90613bd4565b80601f01602080910402602001604051908101604052809291908181526020018280546114f990613bd4565b80156115465780601f1061151b57610100808354040283529160200191611546565b820191906000526020600020905b81548152906001019060200180831161152957829003601f168201915b50505050508152505081526020019060010190611376565b505050508152602001600282018054806020026020016040519081016040528092919081815260200182805480156115bf57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115a1575b5050505050815260200160038201805480602002602001604051908101604052809291908181526020016000905b8282101561169957838290600052602060002001805461160c90613bd4565b80601f016020809104026020016040519081016040528092919081815260200182805461163890613bd4565b80156116855780601f1061165a57610100808354040283529160200191611685565b820191906000526020600020905b81548152906001019060200180831161166857829003601f168201915b5050505050815260200190600101906115ed565b505050915250909392505050565b600054610100900460ff16158080156116c75750600054600160ff909116105b806116e15750303b1580156116e1575060005460ff166001145b6117445760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103cd565b6000805460ff191660011790558015611767576000805461ff0019166101001790555b61176f6130a1565b6117776130d0565b801561046a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6000836117cb8161243b565b156117e85760405162461bcd60e51b81526004016103cd90613a91565b846117f38133612ae7565b61180f5760405162461bcd60e51b81526004016103cd90613aee565b61181a868686612d60565b61185b5760405162461bcd60e51b8152602060048201526012602482015271119c9859db595b9d081b9bdd08199bdd5b9960721b60448201526064016103cd565b6001600160a01b038616600090815260c960205260408120905b6001820154811015610fb45761196f82600101828154811061189957611899613b42565b906000526020600020906003020160000180546118b590613bd4565b80601f01602080910402602001604051908101604052809291908181526020018280546118e190613bd4565b801561192e5780601f106119035761010080835404028352916020019161192e565b820191906000526020600020905b81548152906001019060200180831161191157829003601f168201915b505050505088888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612e2392505050565b15611aa65760018083018054909161198691613b6e565b8154811061199657611996613b42565b90600052602060002090600302018260010182815481106119b9576119b9613b42565b60009182526020909120600390910201806119d48382613d98565b506001818101906119e790840182613d98565b506002818101906119fa90840182613d98565b50505060018201805480611a1057611a10613b81565b60008281526020812060001990920191600383020190611a30828261340f565b611a3e60018301600061340f565b611a4c60028301600061340f565b505090558686604051611a60929190613d2b565b604051908190038120906001600160a01b038a16907f68026479739e3662c0651578523384b94455e79bfb701ce111a3164591ceba7390600090a3600194505050610fbb565b80611ab081613bbb565b915050611875565b81611ac28161243b565b15611adf5760405162461bcd60e51b81526004016103cd90613a91565b82611aea8133612ae7565b611b065760405162461bcd60e51b81526004016103cd90613aee565b611b14846110208580613f35565b15611b5a5760405162461bcd60e51b8152602060048201526016602482015275119c9859db595b9d08185b1c9958591e48195e1a5cdd60521b60448201526064016103cd565b6000611b76611b6f6040860160208701614076565b6005612e8d565b90506000611b94611b8d6040870160208801614076565b6006612e8d565b9050600082158015611ba4575081155b905080611c285760405162461bcd60e51b815260206004820152604660248201527f43616e6e6f742061646420766572696669636174696f6e206d6574686f64207760448201527f697468206f776e6572736869705f70726f6f66206f722070726f74656374656460648201526520666c61677360d01b608482015260a4016103cd565b6001600160a01b038716600090815260c960209081526040822080546001810182559083529120879160030201611c5f82826140e9565b50611c6c90508680613f35565b604051611c7a929190613d2b565b604051908190038120906001600160a01b038916907f2a2c19e8d9546d05ca1cb9bab27129d2ca2785f6e25f655c8a8c1f98e06f163590600090a350505050505050565b611cc78161243b565b611d135760405162461bcd60e51b815260206004820152601760248201527f44696420737461746520616c726561647920657869737400000000000000000060448201526064016103cd565b6000611d1e82612fc9565b6001600160a01b038316600090815260c960205260408120825180519394509092909190611d4e57611d4e613b42565b60209081029190910181015182546001810184556000938452919092208251600390920201908190611d8090826141ee565b50602082015160018201805461ffff90921661ffff1983168117825560408501519262ffffff19161762010000838015611dbc57611dbc6136e0565b021790555060608201516002820190611dd590826141ee565b5050505050565b600084611de88161243b565b15611e055760405162461bcd60e51b81526004016103cd90613a91565b85611e108133612ae7565b611e2c5760405162461bcd60e51b81526004016103cd90613aee565b611e37878787612d60565b611e535760405162461bcd60e51b81526004016103cd90613d3b565b6001600160a01b038716600090815260c960205260408120905b81548110156121a1576000826000018281548110611e8d57611e8d613b42565b90600052602060002090600302019050611f69816000018054611eaf90613bd4565b80601f0160208091040260200160405190810160405280929190818152602001828054611edb90613bd4565b8015611f285780601f10611efd57610100808354040283529160200191611f28565b820191906000526020600020905b815481529060010190602001808311611f0b57829003601f168201915b50505050508a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612e2392505050565b1561218e576000611f7b886005612e8d565b600183015490151590611f939061ffff166005612e8d565b1515141590506000611fa6896006612e8d565b600184015490151590611fbe9061ffff166006612e8d565b1515141590508180611fcd5750805b1561207b5733611fdf600285016142a0565b60601c1461207b5760405162461bcd60e51b815260206004820152605960248201527f4f6e6c792074686520766572696669636174696f6e206d6574686f642061757460448201527f686f72697479206b65792063616e2073657420746865206f776e65727368697060648201527f2070726f6f66206f722070726f74656374656420666c61677300000000000000608482015260a4016103cd565b600085600001858154811061209257612092613b42565b6000918252602090912060016003909202010154865461ffff90911691508a908790879081106120c4576120c4613b42565b906000526020600020906003020160010160006101000a81548161ffff021916908361ffff1602179055506120f88d612eb7565b6121145760405162461bcd60e51b81526004016103cd90613e6f565b8b8b604051612124929190613d2b565b60405180910390208d6001600160a01b03167f41b06123da5d53e60f2b1756bcc6bf2c59195904c2f3be74c903cd2ef0655542838d60405161217792919061ffff92831681529116602082015260400190565b60405180910390a3600198505050505050506121a8565b508061219981613bbb565b915050611e6d565b5060009350505b5050949350505050565b6000836121be8161243b565b156121db5760405162461bcd60e51b81526004016103cd90613a91565b846121e68133612ae7565b6122025760405162461bcd60e51b81526004016103cd90613aee565b61220d868686612c23565b6122645760405162461bcd60e51b815260206004820152602260248201527f45787465726e616c20636f6e74726f6c6c657220646f6573206e6f74206578696044820152611cdd60f21b60648201526084016103cd565b6001600160a01b038616600090815260c960205260408120905b6003820154811015610fb4576122b78260030182815481106122a2576122a2613b42565b9060005260206000200180546118b590613bd4565b156123b3576003820180546122ce90600190613b6e565b815481106122de576122de613b42565b906000526020600020018260030182815481106122fd576122fd613b42565b9060005260206000200190816123139190613d98565b508160030180548061232757612327613b81565b600190038181906000526020600020016000612343919061340f565b9055876001600160a01b03167f9a55813d7cd2d2b9253e319e832bd00a0b8743de9d6d759dcb42293aebedb7358888604051602001612383929190613d2b565b60408051601f19818403018152908290526123a091600090613b97565b60405180910390a2600194505050610fbb565b806123bd81613bbb565b91505061227e565b6123cd612f1d565b6001600160a01b0381166124325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103cd565b61046a81612f77565b6001600160a01b038116600090815260c9602090815260408083208151815460a09481028201850190935260808101838152859491938492849190879085015b8282101561260e57838290600052602060002090600302016040518060800160405290816000820180546124ae90613bd4565b80601f01602080910402602001604051908101604052809291908181526020018280546124da90613bd4565b80156125275780601f106124fc57610100808354040283529160200191612527565b820191906000526020600020905b81548152906001019060200180831161250a57829003601f168201915b5050509183525050600182015461ffff8116602083015260409091019062010000900460ff16801561255b5761255b6136e0565b8015612569576125696136e0565b815260200160028201805461257d90613bd4565b80601f01602080910402602001604051908101604052809291908181526020018280546125a990613bd4565b80156125f65780601f106125cb576101008083540402835291602001916125f6565b820191906000526020600020905b8154815290600101906020018083116125d957829003601f168201915b5050505050815250508152602001906001019061247b565b50505050815260200160018201805480602002602001604051908101604052809291908181526020016000905b82821015612823578382906000526020600020906003020160405180606001604052908160008201805461266e90613bd4565b80601f016020809104026020016040519081016040528092919081815260200182805461269a90613bd4565b80156126e75780601f106126bc576101008083540402835291602001916126e7565b820191906000526020600020905b8154815290600101906020018083116126ca57829003601f168201915b5050505050815260200160018201805461270090613bd4565b80601f016020809104026020016040519081016040528092919081815260200182805461272c90613bd4565b80156127795780601f1061274e57610100808354040283529160200191612779565b820191906000526020600020905b81548152906001019060200180831161275c57829003601f168201915b5050505050815260200160028201805461279290613bd4565b80601f01602080910402602001604051908101604052809291908181526020018280546127be90613bd4565b801561280b5780601f106127e05761010080835404028352916020019161280b565b820191906000526020600020905b8154815290600101906020018083116127ee57829003601f168201915b5050505050815250508152602001906001019061263b565b5050505081526020016002820180548060200260200160405190810160405280929190818152602001828054801561288457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612866575b5050505050815260200160038201805480602002602001604051908101604052809291908181526020016000905b8282101561295e5783829060005260206000200180546128d190613bd4565b80601f01602080910402602001604051908101604052809291908181526020018280546128fd90613bd4565b801561294a5780601f1061291f5761010080835404028352916020019161294a565b820191906000526020600020905b81548152906001019060200180831161292d57829003601f168201915b5050505050815260200190600101906128b2565b505050915250505151159392505050565b61046a612f1d565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156129af576129aa836130f7565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015612a09575060408051601f3d908101601f19168201909252612a06918101906142f2565b60015b612a6c5760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b60648201526084016103cd565b6000805160206143868339815191528114612adb5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b60648201526084016103cd565b506129aa838383613193565b6001600160a01b038216600090815260c960205260408120815b8154811015612b9c57836001600160a01b0316826000018281548110612b2957612b29613b42565b9060005260206000209060030201600201612b43906142a0565b60601c03612b8a57612b81826000018281548110612b6357612b63613b42565b600091825260209091206003918202016001015461ffff1690612e8d565b92505050611170565b80612b9481613bbb565b915050612b01565b506000949350505050565b6001600160a01b038216600090815260c960205260408120815b6002820154811015612b9c57836001600160a01b0316826002018281548110612bec57612bec613b42565b6000918252602090912001546001600160a01b031603612c1157600192505050611170565b80612c1b81613bbb565b915050612bc1565b6001600160a01b038316600090815260c960205260408120815b6003820154811015612d5257612d30826003018281548110612c6157612c61613b42565b906000526020600020018054612c7690613bd4565b80601f0160208091040260200160405190810160405280929190818152602001828054612ca290613bd4565b8015612cef5780601f10612cc457610100808354040283529160200191612cef565b820191906000526020600020905b815481529060010190602001808311612cd257829003601f168201915b505050505086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612e2392505050565b15612d4057600192505050612d59565b80612d4a81613bbb565b915050612c3d565b5060009150505b9392505050565b6001600160a01b038316600090815260c960205260408120815b6001820154811015612ddc57612dba826001018281548110612d9e57612d9e613b42565b90600052602060002090600302016000018054612c7690613bd4565b15612dca57600192505050612d59565b80612dd481613bbb565b915050612d7a565b5060005b8154811015612d5257612e01826000018281548110612d9e57612d9e613b42565b15612e1157600192505050612d59565b80612e1b81613bbb565b915050612de0565b60008151835114612e3657506000611170565b81604051602001612e47919061430b565b6040516020818303038152906040528051906020012083604051602001612e6e919061430b565b6040516020818303038152906040528051906020012014905092915050565b6000816006811115612ea157612ea16136e0565b600161ffff9182161b8416161515905092915050565b6001600160a01b038116600090815260c960205260408120815b8154811015612f1357612ef2826000018281548110612b6357612b63613b42565b15612f01575060019392505050565b80612f0b81613bbb565b915050612ed1565b5060009392505050565b6097546001600160a01b0316331461112c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103cd565b609780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b612ff46040518060800160405280606081526020016060815260200160608152602001606081525090565b61301f6040518060800160405280606081526020016060815260200160608152602001606081525090565b60408051600180825281830190925290816020015b613060604080516080810182526060815260006020820181905290918201908152602001606081525090565b815260200190600190039081613034575050815261307d836131be565b8151805160009061309057613090613b42565b602090810291909101015292915050565b600054610100900460ff166130c85760405162461bcd60e51b81526004016103cd90614327565b61112c61325c565b600054610100900460ff1661112c5760405162461bcd60e51b81526004016103cd90614327565b6001600160a01b0381163b6131645760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b60648201526084016103cd565b60008051602061438683398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b61319c8361328c565b6000825111806131a95750805b156129aa576131b883836132cc565b50505050565b6131ea604080516080810182526060815260006020820181905290918201908152602001606081525090565b6040805160c08101825260076080820190815266191959985d5b1d60ca1b60a08301528152606860208201529081016000815260200183604051602001613244919060609190911b6001600160601b031916815260140190565b60408051601f19818403018152919052905292915050565b600054610100900460ff166132835760405162461bcd60e51b81526004016103cd90614327565b61112c33612f77565b613295816130f7565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6060612d5983836040518060600160405280602781526020016143a6602791396060600080856001600160a01b031685604051613309919061430b565b600060405180830381855af49150503d8060008114613344576040519150601f19603f3d011682016040523d82523d6000602084013e613349565b606091505b509150915061335a86838387613364565b9695505050505050565b606083156133d35782516000036133cc576001600160a01b0385163b6133cc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103cd565b50816133dd565b6133dd83836133e5565b949350505050565b8151156133f55781518083602001fd5b8060405162461bcd60e51b81526004016103cd9190614372565b50805461341b90613bd4565b6000825580601f1061342b575050565b601f01602090049060005260206000209081019061046a91905b808211156134595760008155600101613445565b5090565b80356001600160a01b038116811461347457600080fd5b919050565b60006020828403121561348b57600080fd5b612d598261345d565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156134bd57600080fd5b6134c68361345d565b9150602083013567ffffffffffffffff808211156134e357600080fd5b818501915085601f8301126134f757600080fd5b81358181111561350957613509613494565b604051601f8201601f19908116603f0116810190838211818310171561353157613531613494565b8160405282815288602084870101111561354a57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000806040838503121561357f57600080fd5b6135888361345d565b91506135966020840161345d565b90509250929050565b60008083601f8401126135b157600080fd5b50813567ffffffffffffffff8111156135c957600080fd5b6020830191508360208285010111156135e157600080fd5b9250929050565b6000806000604084860312156135fd57600080fd5b6136068461345d565b9250602084013567ffffffffffffffff81111561362257600080fd5b61362e8682870161359f565b9497909650939450505050565b6000806040838503121561364e57600080fd5b6136578361345d565b9150602083013567ffffffffffffffff81111561367357600080fd5b83016060818603121561368557600080fd5b809150509250929050565b60005b838110156136ab578181015183820152602001613693565b50506000910152565b600081518084526136cc816020860160208601613690565b601f01601f19169290920160200192915050565b634e487b7160e01b600052602160045260246000fd5b600081518084526020808501808196508360051b8101915082860160005b8581101561377f578284038952815160608151818752613736828801826136b4565b915050868201518682038888015261374e82826136b4565b9150506040808301519250868203818801525061376b81836136b4565b9a87019a9550505090840190600101613714565b5091979650505050505050565b600081518084526020808501945080840160005b838110156137c55781516001600160a01b0316875295820195908201906001016137a0565b509495945050505050565b600081518084526020808501808196508360051b8101915082860160005b8581101561377f5782840389526138068483516136b4565b988501989350908401906001016137ee565b6000602080835260a0830184516080808487015282825180855260c08801915060c08160051b890101945085840193506000805b828110156138d25789870360bf1901845285518051868952613870878a01826136b4565b905061ffff8a830151168a8a0152604080830151600181106138a057634e487b7160e01b86526021600452602486fd5b908a0152606091820151898203928a01929092526138be81836136b4565b98505050948701949287019260010161384c565b50505050838701519350601f199150818684030160408701526138f583856136f6565b93506040870151925081868503016060870152613912848461378c565b935060608701519250818685030181870152505061393082826137d0565b95945050505050565b6000806040838503121561394c57600080fd5b6139558361345d565b9150602083013567ffffffffffffffff81111561397157600080fd5b83016080818603121561368557600080fd5b61ffff8116811461046a57600080fd5b600080600080606085870312156139a957600080fd5b6139b28561345d565b9350602085013567ffffffffffffffff8111156139ce57600080fd5b6139da8782880161359f565b90945092505060408501356139ee81613983565b939692955090935050565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b60208082526037908201527f4f6e6c79206e6f6e2d67656e657261746976652064696453746174657320617260408201527f6520616c6c6f77656420666f7220746869732063616c6c000000000000000000606082015260800190565b60208082526034908201527f4d6573736167652073656e646572206973206e6f7420616e20617574686f72696040820152731e9959081d5cd95c881bd9881d1a1a5cc8191a5960621b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b8181038181111561117057611170613b58565b634e487b7160e01b600052603160045260246000fd5b604081526000613baa60408301856136b4565b905082151560208301529392505050565b600060018201613bcd57613bcd613b58565b5060010190565b600181811c90821680613be857607f821691505b602082108103613c0857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156129aa57600081815260208120601f850160051c81016020861015613c355750805b601f850160051c820191505b81811015613c5457828155600101613c41565b505050505050565b600019600383901b1c191660019190911b1790565b67ffffffffffffffff831115613c8957613c89613494565b613c9d83613c978354613bd4565b83613c0e565b6000601f841160018114613ccb5760008515613cb95750838201355b613cc38682613c5c565b845550611dd5565b600083815260209020601f19861690835b82811015613cfc5786850135825560209485019460019092019101613cdc565b5086821015613d195760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b8183823760009101908152919050565b6020808252603e908201527f467261676d656e7420646f6573206e6f74206d6174636820616e79207665726960408201527f6669636174696f6e206d6574686f647320776974682074686973206469640000606082015260800190565b818103613da3575050565b613dad8254613bd4565b67ffffffffffffffff811115613dc557613dc5613494565b613dd981613dd38454613bd4565b84613c0e565b6000601f821160018114613e075760008315613df55750848201545b613dff8482613c5c565b855550611dd5565b600085815260209020601f19841690600086815260209020845b83811015613e415782860154825560019586019590910190602001613e21565b5085831015613e5f5781850154600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208082526030908201527f43616e6e6f742072656d6f7665206c61737420617574686f726974792076657260408201526f1a599a58d85d1a5bdb881b595d1a1bd960821b606082015260800190565b6000808354613ecd81613bd4565b60018281168015613ee55760018114613efa57613f29565b60ff1984168752821515830287019450613f29565b8760005260208060002060005b85811015613f205781548a820152908401908201613f07565b50505082870194505b50929695505050505050565b6000808335601e19843603018112613f4c57600080fd5b83018035915067ffffffffffffffff821115613f6757600080fd5b6020019150368190038213156135e157600080fd5b613f868283613f35565b67ffffffffffffffff811115613f9e57613f9e613494565b613fb281613fac8554613bd4565b85613c0e565b6000601f821160018114613fe05760008315613fce5750838201355b613fd88482613c5c565b86555061403a565b600085815260209020601f19841690835b828110156140115786850135825560209485019460019092019101613ff1565b508482101561402e5760001960f88660031b161c19848701351681555b505060018360011b0185555b5050505061404b6020830183613f35565b614059818360018601613c71565b50506140686040830183613f35565b6131b8818360028601613c71565b60006020828403121561408857600080fd5b8135612d5981613983565b6000813561117081613983565b600081356001811061117057600080fd5b600182106140cf57634e487b7160e01b600052602160045260246000fd5b805462ff00008360101b1662ff0000198216178255505050565b6140f38283613f35565b67ffffffffffffffff81111561410b5761410b613494565b61411981613fac8554613bd4565b6000601f82116001811461414757600083156141355750838201355b61413f8482613c5c565b8655506141a1565b600085815260209020601f19841690835b828110156141785786850135825560209485019460019092019101614158565b50848210156141955760001960f88660031b161c19848701351681555b505060018360011b0185555b50505050600181016141cb6141b860208501614093565b825461ffff191661ffff91909116178255565b6141e06141da604085016140a0565b826140b1565b506140686060830183613f35565b815167ffffffffffffffff81111561420857614208613494565b61421681613dd38454613bd4565b602080601f83116001811461424557600084156142335750858301515b61423d8582613c5c565b865550613c54565b600085815260208120601f198616915b8281101561427457888601518255948401946001909101908401614255565b5085821015613e5f57939096015160001960f8600387901b161c19169092555050600190811b01905550565b60006142ac8254613bd4565b82601f8211156142c25783600052602060002090505b546001600160601b0319808216935060148310156142ea5780818460140360031b1b83161693505b505050919050565b60006020828403121561430457600080fd5b5051919050565b6000825161431d818460208701613690565b9190910192915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b602081526000612d5960208301846136b456fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220f08f9ed39774835d2b18022a531e701d44fbf1c32f882af4ecd5e3d1d81dfc6964736f6c63430008130033"; - -type DIDRegistryConstructorParams = - | [signer?: Signer] - | ConstructorParameters; - -const isSuperArgs = ( - xs: DIDRegistryConstructorParams -): xs is ConstructorParameters => xs.length > 1; - -export class DIDRegistry__factory extends ContractFactory { - constructor(...args: DIDRegistryConstructorParams) { - if (isSuperArgs(args)) { - super(...args); - } else { - super(_abi, _bytecode, args[0]); - } - } - - override getDeployTransaction( - overrides?: NonPayableOverrides & { from?: string } - ): Promise { - return super.getDeployTransaction(overrides || {}); - } - override deploy(overrides?: NonPayableOverrides & { from?: string }) { - return super.deploy(overrides || {}) as Promise< - DIDRegistry & { - deploymentTransaction(): ContractTransactionResponse; - } - >; - } - override connect(runner: ContractRunner | null): DIDRegistry__factory { - return super.connect(runner) as DIDRegistry__factory; - } - - static readonly bytecode = _bytecode; - static readonly abi = _abi; - static createInterface(): DIDRegistryInterface { - return new Interface(_abi) as DIDRegistryInterface; - } - static connect(address: string, runner?: ContractRunner | null): DIDRegistry { - return new Contract(address, _abi, runner) as unknown as DIDRegistry; - } -} diff --git a/ts-client/types/ethers-contracts/factories/index.ts b/ts-client/types/ethers-contracts/factories/index.ts deleted file mode 100644 index b011f01..0000000 --- a/ts-client/types/ethers-contracts/factories/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export { DIDRegistry__factory } from "./DIDRegistry__factory"; diff --git a/ts-client/types/ethers-contracts/index.ts b/ts-client/types/ethers-contracts/index.ts deleted file mode 100644 index d0ffb12..0000000 --- a/ts-client/types/ethers-contracts/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* Autogenerated file. Do not edit manually. */ -/* tslint:disable */ -/* eslint-disable */ -export type { DIDRegistry } from "./DIDRegistry"; -export * as factories from "./factories"; -export { DIDRegistry__factory } from "./factories/DIDRegistry__factory";