From 79ed9c95550580f5a2387135f792466274a7753c Mon Sep 17 00:00:00 2001 From: jawndiego Date: Tue, 5 Dec 2023 17:48:05 -0800 Subject: [PATCH] register and generated docs --- README.md | 25 ++- docs/README.md | 23 ++- docs/classes/extrinsic.default.md | 10 +- docs/classes/index.default.md | 180 ++++++++++++++---- docs/classes/programs.default.md | 82 ++++++-- docs/classes/registration.default.md | 18 +- docs/classes/signing.default.md | 58 +++--- docs/enums/types.Arch.md | 4 +- docs/interfaces/index.EntropyAccount.md | 43 +++++ docs/interfaces/index.EntropyOpts.md | 30 +-- .../interfaces/registration.RegisteredInfo.md | 32 ++++ .../registration.RegistrationParams.md | 26 +-- docs/interfaces/signing.Config.md | 8 +- docs/interfaces/signing.SigOps.md | 4 +- docs/interfaces/signing.SigTxOps.md | 4 +- .../signing_adapters_types.Adapter.md | 8 +- .../signing_adapters_types.OptAdapter.md | 8 +- docs/interfaces/types.Account.md | 4 +- docs/interfaces/types.EncMsg.md | 6 +- docs/interfaces/types.EventFilter.md | 4 +- docs/interfaces/types.ITransactionRequest.md | 4 +- docs/interfaces/types.KeyPair.md | 4 +- docs/interfaces/types.KeyShare.md | 2 +- docs/interfaces/types.ServerDHInfo.md | 2 +- docs/interfaces/types.ServerInfo.md | 6 +- docs/interfaces/types.Signer.md | 4 +- .../types.UserTransactionRequest.md | 6 +- docs/interfaces/types.ValidatorInfo.md | 6 +- docs/interfaces/utils_crypto.CryptoLib.md | 10 +- docs/modules/index.md | 1 + docs/modules/keys.md | 65 ++++++- docs/modules/registration.md | 15 ++ docs/modules/signing_adapters_default.md | 2 +- docs/modules/signing_adapters_eth.md | 33 +++- docs/modules/types.md | 12 +- docs/modules/utils.md | 76 ++++++-- docs/modules/utils_crypto.md | 6 +- src/index.ts | 4 +- src/registration/index.ts | 32 +++- src/signing/adapters/types.ts | 2 +- src/signing/index.ts | 2 +- src/utils/crypto.ts | 2 +- src/utils/index.ts | 3 +- 43 files changed, 636 insertions(+), 240 deletions(-) create mode 100644 docs/interfaces/index.EntropyAccount.md create mode 100644 docs/interfaces/registration.RegisteredInfo.md diff --git a/README.md b/README.md index 6ebbf0fa..c22d0420 100644 --- a/README.md +++ b/README.md @@ -17,16 +17,23 @@ npm i @entropyxyz/entropy-js --save ### Usage +NOTICE +`endpoint ` defaults to 'ws://127.0.0.1:9944' if no value is provided. + ```js import Entropy from '@entropyxyz/entropy-js' // initialize entropy -const seed = "SEED" -const endpoint = "endpoint" + const signer = await getWallet(charlieStashSeed) + + const entropyAccount: EntropyAccount = { + sigRequestKey: signer, + programModKey: signer + } -const entropy = new Entropy({ seed, endpoint }) -await entropy.ready + entropy = new Entropy({ account: entropyAccount}) + await entropy.ready ``` @@ -78,7 +85,7 @@ Throws if the address being registered is already in use. #### Example(s) ```js - const address = entropy.keys?.wallet.address + const address = entropy.account?.wallet.address console.log({ address }) // Can do a pre-check to see if the address is registered @@ -127,8 +134,8 @@ Creates an instance of ProgramManager. | Name | Type | | :------ | :------ | | `«destructured»` | `Object` | -| › `signer` | [`Signer`](../interfaces/types.Signer.md) | -| › `substrate` | `ApiPromise` | +| › `signer` | [`Signer`](../interfaces/types.Signer.md) | +| › `substrate` | `ApiPromise` | #### Returns @@ -206,7 +213,7 @@ The response is then processed and converted to an ArrayBuffer before being retu #### Example(s) ```js // get program - const fetchedProgram: ArrayBuffer = await entropy.programs.get(entropy.keys?.wallet.address) + const fetchedProgram: ArrayBuffer = await entropy.programs.get(entropy.account?.wallet.address) ``` #### Defined in @@ -386,4 +393,4 @@ Will throw an error if the transaction type does not have a corresponding adapte #### Defined in -[index.ts:132](https://github.com/entropyxyz/entropy-js/blob/b4c1b9b/src/index.ts#L132) +[index.ts:132](https://github.com/entropyxyz/entropy-js/blob/b4c1b9b/src/index.ts#L132) \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 52222675..57a4bc08 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,16 +19,23 @@ npm i @entropyxyz/entropy-js --save ### Usage +NOTICE +`endpoint ` defaults to 'ws://127.0.0.1:9944' if no value is provided. + ```js import Entropy from '@entropyxyz/entropy-js' // initialize entropy -const seed = "SEED" -const endpoint = "endpoint" + const signer = await getWallet(charlieStashSeed) + + const entropyAccount: EntropyAccount = { + sigRequestKey: signer, + programModKey: signer + } -const entropy = new Entropy({ seed, endpoint }) -await entropy.ready + entropy = new Entropy({ account: entropyAccount}) + await entropy.ready ``` @@ -80,7 +87,7 @@ Throws if the address being registered is already in use. #### Example(s) ```js - const address = entropy.keys?.wallet.address + const address = entropy.account?.wallet.address console.log({ address }) // Can do a pre-check to see if the address is registered @@ -127,8 +134,8 @@ Creates an instance of ProgramManager. | Name | Type | | :------ | :------ | | `«destructured»` | `Object` | -| › `signer` | [`Signer`](../interfaces/types.Signer.md) | -| › `substrate` | `ApiPromise` | +| › `signer` | [`Signer`](../interfaces/types.Signer.md) | +| › `substrate` | `ApiPromise` | #### Returns @@ -206,7 +213,7 @@ The response is then processed and converted to an ArrayBuffer before being retu #### Example(s) ```js // get program - const fetchedProgram: ArrayBuffer = await entropy.programs.get(entropy.keys?.wallet.address) + const fetchedProgram: ArrayBuffer = await entropy.programs.get(entropy.account?.wallet.address) ``` #### Defined in diff --git a/docs/classes/extrinsic.default.md b/docs/classes/extrinsic.default.md index ef3d8a72..ef53ca3f 100644 --- a/docs/classes/extrinsic.default.md +++ b/docs/classes/extrinsic.default.md @@ -53,7 +53,7 @@ Initializes a new instance of the `ExtrinsicBaseClass`. #### Defined in -[extrinsic/index.ts:30](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L30) +[extrinsic/index.ts:30](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L30) ## Properties @@ -63,7 +63,7 @@ Initializes a new instance of the `ExtrinsicBaseClass`. #### Defined in -[extrinsic/index.ts:21](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L21) +[extrinsic/index.ts:21](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L21) ___ @@ -73,7 +73,7 @@ ___ #### Defined in -[extrinsic/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L20) +[extrinsic/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L20) ## Methods @@ -109,7 +109,7 @@ If the dry run fails or there's insufficient electricity (zaps). #### Defined in -[extrinsic/index.ts:99](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L99) +[extrinsic/index.ts:99](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L99) ___ @@ -139,4 +139,4 @@ Will reject the promise if a dispatch error occurs or the filtered event is not #### Defined in -[extrinsic/index.ts:45](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L45) +[extrinsic/index.ts:45](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L45) diff --git a/docs/classes/index.default.md b/docs/classes/index.default.md index d9110af8..930a11e9 100644 --- a/docs/classes/index.default.md +++ b/docs/classes/index.default.md @@ -15,9 +15,19 @@ before performing operations. **`Example`** ```typescript -const entropy = new Entropy({ seed: 'SEED', endpoint: 'wss://localhost:8080' }) -await entropy.ready -await entropy.register({ address, keyVisibility: 'Permissioned', freeTx: false }) + + const signer = await getWallet(charlieStashSeed) + + const entropyAccount: EntropyAccount = { + sigRequestKey: signer, + programModKey: signer + } + + const entropy = new Entropy({ account: entropyAccount}) + await entropy.ready + + await entropy.register({ address, keyVisibility: 'Permissioned', freeTx: false }) + ``` ## Table of contents @@ -28,19 +38,26 @@ await entropy.register({ address, keyVisibility: 'Permissioned', freeTx: false } ### Properties +- [#allReadOnly](index.default.md##allreadonly) - [#fail](index.default.md##fail) +- [#programReadOnly](index.default.md##programreadonly) - [#ready](index.default.md##ready) +- [account](index.default.md#account) - [isRegistered](index.default.md#isregistered) -- [keys](index.default.md#keys) +- [programModPublicKey](index.default.md#programmodpublickey) - [programs](index.default.md#programs) - [ready](index.default.md#ready) - [registrationManager](index.default.md#registrationmanager) +- [sigRequestPublicKey](index.default.md#sigrequestpublickey) - [signingManager](index.default.md#signingmanager) - [substrate](index.default.md#substrate) ### Methods -- [init](index.default.md#init) +- [#init](index.default.md##init) +- [#setReadOnlyStates](index.default.md##setreadonlystates) +- [#setVerfiyingKeys](index.default.md##setverfiyingkeys) +- [getVerifyingKey](index.default.md#getverifyingkey) - [register](index.default.md#register) - [sign](index.default.md#sign) - [signTransaction](index.default.md#signtransaction) @@ -63,10 +80,20 @@ await entropy.register({ address, keyVisibility: 'Permissioned', freeTx: false } #### Defined in -[index.ts:80](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L80) +[index.ts:70](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L70) ## Properties +### #allReadOnly + +• `Private` **#allReadOnly**: `boolean` + +#### Defined in + +[index.ts:58](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L58) + +___ + ### #fail • `Private` `Optional` **#fail**: (`reason?`: `unknown`) => `void` @@ -87,7 +114,17 @@ await entropy.register({ address, keyVisibility: 'Permissioned', freeTx: false } #### Defined in -[index.ts:41](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L41) +[index.ts:56](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L56) + +___ + +### #programReadOnly + +• `Private` **#programReadOnly**: `boolean` + +#### Defined in + +[index.ts:57](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L57) ___ @@ -111,7 +148,17 @@ ___ #### Defined in -[index.ts:40](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L40) +[index.ts:55](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L55) + +___ + +### account + +• `Optional` **account**: [`EntropyAccount`](../interfaces/index.EntropyAccount.md) + +#### Defined in + +[index.ts:67](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L67) ___ @@ -135,17 +182,17 @@ ___ #### Defined in -[index.ts:47](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L47) +[index.ts:64](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L64) ___ -### keys +### programModPublicKey -• `Optional` **keys**: [`Signer`](../interfaces/types.Signer.md) +• `Optional` **programModPublicKey**: `string` #### Defined in -[index.ts:45](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L45) +[index.ts:62](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L62) ___ @@ -155,19 +202,19 @@ ___ #### Defined in -[index.ts:48](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L48) +[index.ts:65](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L65) ___ ### ready -• **ready**: `Promise`\<`void`\> +• **ready**: `Promise`\<`boolean`\> A promise that resolves once chacha20poly1305 cryptoLib has been loaded #### Defined in -[index.ts:44](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L44) +[index.ts:60](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L60) ___ @@ -177,7 +224,17 @@ ___ #### Defined in -[index.ts:46](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L46) +[index.ts:63](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L63) + +___ + +### sigRequestPublicKey + +• `Optional` **sigRequestPublicKey**: `string` + +#### Defined in + +[index.ts:61](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L61) ___ @@ -187,7 +244,7 @@ ___ #### Defined in -[index.ts:49](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L49) +[index.ts:66](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L66) ___ @@ -197,13 +254,13 @@ ___ #### Defined in -[index.ts:51](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L51) +[index.ts:68](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L68) ## Methods -### init +### #init -▸ **init**(`opts`): `Promise`\<`void`\> +▸ **#init**(`opts`): `Promise`\<`void`\> #### Parameters @@ -217,13 +274,64 @@ ___ #### Defined in -[index.ts:53](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L53) +[index.ts:81](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L81) + +___ + +### #setReadOnlyStates + +▸ **#setReadOnlyStates**(): `void` + +#### Returns + +`void` + +#### Defined in + +[index.ts:131](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L131) + +___ + +### #setVerfiyingKeys + +▸ **#setVerfiyingKeys**(): `Promise`\<`void`\> + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[index.ts:114](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L114) + +___ + +### getVerifyingKey + +▸ **getVerifyingKey**(`address`): `Promise`\<`string`\> + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `address` | [`Address`](../modules/types.md#address) | + +#### Returns + +`Promise`\<`string`\> + +A promise that returns the verifying key associated with the +registration record for the given address/account + +#### Defined in + +[index.ts:199](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L199) ___ ### register -▸ **register**(`params`): `Promise`\<`undefined`\> +▸ **register**(`params`): `Promise`\<`void`\> Registers an address to Entropy using the provided parameters. @@ -231,11 +339,11 @@ Registers an address to Entropy using the provided parameters. | Name | Type | | :------ | :------ | -| `params` | [`RegistrationParams`](../interfaces/registration.RegistrationParams.md) | +| `params` | [`RegistrationParams`](../interfaces/registration.RegistrationParams.md) & \{ `account?`: [`EntropyAccount`](../interfaces/index.EntropyAccount.md) } | #### Returns -`Promise`\<`undefined`\> +`Promise`\<`void`\> A promise indicating the completion of the registration process. @@ -249,7 +357,7 @@ Throws if the address being registered is already in use. #### Defined in -[index.ts:103](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L103) +[index.ts:170](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L170) ___ @@ -257,14 +365,14 @@ ___ ▸ **sign**(`params`): `Promise`\<`Uint8Array`\> -The `sign` method is tasked with signing a `sigRequestHash`, which is essentially a hash of the -request that needs signing. It does so by obtaining validator information based on the hash, -formatting transaction requests for these validators, and then submitting these requests for the +The `sign` method is tasked with signing a `sigRequestHash`, which is essentially a hash of the +request that needs signing. It does so by obtaining validator information based on the hash, +formatting transaction requests for these validators, and then submitting these requests for the validators to sign. The process in detail: 1. The method removes any hex prefix from the request hash. -2. Determines a set of validators corresponding to the stripped request hash. These validators +2. Determines a set of validators corresponding to the stripped request hash. These validators are tasked with validating and signing the transaction. 3. For each of these validators, the method constructs a transaction request. This request encompasses: - The stripped transaction request hash. @@ -293,7 +401,7 @@ Throws an error if there's an error at any stage in the signing routine. #### Defined in -[index.ts:163](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L163) +[index.ts:254](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L254) ___ @@ -303,10 +411,10 @@ ___ Signs a given transaction based on the provided parameters. -The `signTransaction` method invokes the appropriate adapter (chain based configuration) -based on the type specified in the `params`. This modular approach ensures that various -transaction types can be supported. The method performs a series of operations, starting -with the `preSign` function of the selected adapter, followed by the actual signing of the +The `signTransaction` method invokes the appropriate adapter (chain based configuration) +based on the type specified in the `params`. This modular approach ensures that various +transaction types can be supported. The method performs a series of operations, starting +with the `preSign` function of the selected adapter, followed by the actual signing of the transaction request hash, and if necessary, the `postSign` function of the adapter. #### Parameters @@ -319,7 +427,7 @@ transaction request hash, and if necessary, the `postSign` function of the adapt `Promise`\<`unknown`\> -A promise that returns the transaction signature. Note that the structure +A promise that returns the transaction signature. Note that the structure and format of this signature may differ based on the adapter. **`Throws`** @@ -328,4 +436,4 @@ Will throw an error if the transaction type does not have a corresponding adapte #### Defined in -[index.ts:132](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L132) +[index.ts:224](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L224) diff --git a/docs/classes/programs.default.md b/docs/classes/programs.default.md index 428974cb..da0884c8 100644 --- a/docs/classes/programs.default.md +++ b/docs/classes/programs.default.md @@ -6,7 +6,7 @@ **`Remarks`** -The ProgramManager class provides an interface to interact with the V2 Entropy Programs. +The ProgramManager class provides an interface to interact with Entropy Programs. ## Hierarchy @@ -27,6 +27,7 @@ The ProgramManager class provides an interface to interact with the V2 Entropy P ### Methods +- [checkAuthorization](programs.default.md#checkauthorization) - [get](programs.default.md#get) - [handleFreeTx](programs.default.md#handlefreetx) - [sendAndWaitFor](programs.default.md#sendandwaitfor) @@ -62,7 +63,7 @@ The constructor initializes the Substrate api and the signer. #### Defined in -[programs/index.ts:22](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/programs/index.ts#L22) +[programs/index.ts:23](https://github.com/entropyxyz/entropy-js/blob/368842b/src/programs/index.ts#L23) ## Properties @@ -76,7 +77,7 @@ The constructor initializes the Substrate api and the signer. #### Defined in -[extrinsic/index.ts:21](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L21) +[extrinsic/index.ts:21](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L21) ___ @@ -90,21 +91,60 @@ ___ #### Defined in -[extrinsic/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L20) +[extrinsic/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L20) ## Methods +### checkAuthorization + +▸ **checkAuthorization**(`programModAccount`, `sigReqAccount`): `Promise`\<`boolean`\> + +Checks if a given program modification account is authorized to modify the program associated with a specific signature request account. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `programModAccount` | `string` | The account whose authorization is to be verified. | +| `sigReqAccount` | `string` | The account for which the program modification is intended. | + +#### Returns + +`Promise`\<`boolean`\> + +- A promise that resolves if the `programModAccount` is authorized to modify the program for `sigReqAccount` + +**`Remarks`** + +This method queries Substrate to determine if the `programModAccount` is allowed to modify the program associated with the `sigReqAccount`. +The method utilizes the `allowedToModifyProgram` quert, which returns an optional value. If the value is present (`isSome`), it indicates authorization. +(I'm not sure about this as the blob that's returned is extremely long ) +The method unwraps the optional value + +**`Example`** + +```typescript +const isAuthorized = await checkAuthorization('5FHneW46...HgYb3fW', '5DAAnrj7...P5JT7zP') +console.log(isAuthorized) // Outputs: true or false +``` + +#### Defined in + +[programs/index.ts:117](https://github.com/entropyxyz/entropy-js/blob/368842b/src/programs/index.ts#L117) + +___ + ### get -▸ **get**(`deployKey?`): `Promise`\<`ArrayBuffer`\> +▸ **get**(`sigReqAccount?`): `Promise`\<`ArrayBuffer`\> -Retrieves the program associated with a given deployKey (account) +Retrieves the program associated with a given sigReqAccount (account) #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `deployKey` | `string` | The account key, defaulting to the signer's wallet address if not provided. | +| `sigReqAccount` | `string` | The account key, defaulting to the signer's wallet address if not provided. | #### Returns @@ -118,12 +158,12 @@ If no program is defined for the given account. **`Remarks`** -This method communicates with substrate to fetch bytecode associated with an account. -The response is then processed and converted to an ArrayBuffer before being returned +This method communicates with Substrate to fetch bytecode associated with an account. +The response is then procesed and converted to an ArrayBuffer before being returned #### Defined in -[programs/index.ts:39](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/programs/index.ts#L39) +[programs/index.ts:46](https://github.com/entropyxyz/entropy-js/blob/368842b/src/programs/index.ts#L46) ___ @@ -163,7 +203,7 @@ If the dry run fails or there's insufficient electricity (zaps). #### Defined in -[extrinsic/index.ts:99](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L99) +[extrinsic/index.ts:99](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L99) ___ @@ -197,35 +237,41 @@ Will reject the promise if a dispatch error occurs or the filtered event is not #### Defined in -[extrinsic/index.ts:45](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L45) +[extrinsic/index.ts:45](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L45) ___ ### set -▸ **set**(`program`): `Promise`\<`void`\> +▸ **set**(`program`, `sigReqAccount?`, `programModAccount?`): `Promise`\<`void`\> -Sets or updates a program for the current signer's account on Substrate. +Sets or updates the program of a specified account on Substrate +This method allows the current signer or an authorized account to update the program associated with the signer's account or another specified account. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | | `program` | `ArrayBuffer` | The program to be set or updated, as an ArrayBuffer. | +| `sigReqAccount?` | `string` | The account for which the program will be set or updated. Defaults to the signer's account. | +| `programModAccount?` | `string` | Optional. An authorized account to modify the program, if different from the signer's account. | #### Returns `Promise`\<`void`\> +A promise that resolves when the transaction has been included in the block. + **`Throws`** -If there's an issue setting the program. +Throws an error if the account is unauthorized or if there's a problem setting the program. **`Remarks`** -This method takes a program in the form of an ArrayBuffer, converts it (so it can be passed to Substrate), and prepares a transaction to set or update the program -for the associated account. After preparing the transaction, it's sent to Substrate, and the method waits for a confirmation event. +This method handles the conversion of a program from an ArrayBuffer to a hex string +It checks for authorization if the programModAccount is provided, ensuring that only authorized accounts can update the bytecode. +The transaction is created and sent to Substrate. This method then awaits the confirmation event 'ProgramUpdated' to ensure that the update was successful. #### Defined in -[programs/index.ts:63](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/programs/index.ts#L63) +[programs/index.ts:74](https://github.com/entropyxyz/entropy-js/blob/368842b/src/programs/index.ts#L74) diff --git a/docs/classes/registration.default.md b/docs/classes/registration.default.md index 67da8ba2..9f93b533 100644 --- a/docs/classes/registration.default.md +++ b/docs/classes/registration.default.md @@ -59,7 +59,7 @@ Constructs a new instance of the `RegistrationManager` class. #### Defined in -[registration/index.ts:29](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/registration/index.ts#L29) +[registration/index.ts:39](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L39) ## Properties @@ -73,7 +73,7 @@ Constructs a new instance of the `RegistrationManager` class. #### Defined in -[extrinsic/index.ts:21](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L21) +[extrinsic/index.ts:21](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L21) ___ @@ -87,7 +87,7 @@ ___ #### Defined in -[extrinsic/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L20) +[extrinsic/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L20) ## Methods @@ -111,7 +111,7 @@ A promise which resolves to `true` if the address is registered, otherwise `fals #### Defined in -[registration/index.ts:106](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/registration/index.ts#L106) +[registration/index.ts:125](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L125) ___ @@ -151,13 +151,13 @@ If the dry run fails or there's insufficient electricity (zaps). #### Defined in -[extrinsic/index.ts:99](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L99) +[extrinsic/index.ts:99](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L99) ___ ### register -▸ **register**(`«destructured»`): `Promise`\<`undefined`\> +▸ **register**(`«destructured»`): `Promise`\<[`RegisteredInfo`](../interfaces/registration.RegisteredInfo.md)\> Registers a user with the given parameters. @@ -169,7 +169,7 @@ Registers a user with the given parameters. #### Returns -`Promise`\<`undefined`\> +`Promise`\<[`RegisteredInfo`](../interfaces/registration.RegisteredInfo.md)\> A promise that resolves when the user is successfully registered. @@ -179,7 +179,7 @@ If the user is already registered. #### Defined in -[registration/index.ts:51](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/registration/index.ts#L51) +[registration/index.ts:61](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L61) ___ @@ -213,4 +213,4 @@ Will reject the promise if a dispatch error occurs or the filtered event is not #### Defined in -[extrinsic/index.ts:45](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/extrinsic/index.ts#L45) +[extrinsic/index.ts:45](https://github.com/entropyxyz/entropy-js/blob/368842b/src/extrinsic/index.ts#L45) diff --git a/docs/classes/signing.default.md b/docs/classes/signing.default.md index ff5689c5..638be779 100644 --- a/docs/classes/signing.default.md +++ b/docs/classes/signing.default.md @@ -36,7 +36,7 @@ This manager handles transaction signing using pre-defined adapters and cryptogr • **new default**(`«destructured»`): [`default`](signing.default.md) -Constructs a new instance of the `SignatureRequestManager` class. +Initializes a new instance of `SignatureRequestManager`. #### Parameters @@ -50,7 +50,7 @@ Constructs a new instance of the `SignatureRequestManager` class. #### Defined in -[signing/index.ts:51](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L51) +[signing/index.ts:51](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L51) ## Properties @@ -64,7 +64,7 @@ Constructs a new instance of the `SignatureRequestManager` class. #### Defined in -[signing/index.ts:37](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L37) +[signing/index.ts:37](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L37) ___ @@ -74,7 +74,7 @@ ___ #### Defined in -[signing/index.ts:38](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L38) +[signing/index.ts:38](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L38) ___ @@ -84,7 +84,7 @@ ___ #### Defined in -[signing/index.ts:39](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L39) +[signing/index.ts:39](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L39) ___ @@ -94,7 +94,7 @@ ___ #### Defined in -[signing/index.ts:40](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L40) +[signing/index.ts:40](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L40) ## Methods @@ -102,7 +102,7 @@ ___ ▸ **formatTxRequests**(`«destructured»`): `Promise`\<[`EncMsg`](../interfaces/types.EncMsg.md)[]\> -Generates formatted transaction requests suitable for validators. +Generates transaction requests formatted for validators. #### Parameters @@ -116,11 +116,11 @@ Generates formatted transaction requests suitable for validators. `Promise`\<[`EncMsg`](../interfaces/types.EncMsg.md)[]\> -A promise that resolves to an array of encrypted messages for each validator. +A promise resolving to an array of encrypted messages for validators. #### Defined in -[signing/index.ts:136](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L136) +[signing/index.ts:137](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L137) ___ @@ -143,7 +143,7 @@ An object containing `secs_since_epoch` and `nanos_since_epoch`. #### Defined in -[signing/index.ts:117](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L117) +[signing/index.ts:118](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L118) ___ @@ -151,23 +151,23 @@ ___ ▸ **pickValidators**(`sigRequest`): `Promise`\<[`ValidatorInfo`](../interfaces/types.ValidatorInfo.md)[]\> -Fetches validator information based on the signature request. +Selects validators based on the signature request. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `sigRequest` | `string` | The provided signature request. | +| `sigRequest` | `string` | The signature request hash. | #### Returns `Promise`\<[`ValidatorInfo`](../interfaces/types.ValidatorInfo.md)[]\> -A promise that resolves to an array of information related to validators. +A promise resolving to an array of validator information. #### Defined in -[signing/index.ts:221](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L221) +[signing/index.ts:223](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L223) ___ @@ -175,23 +175,23 @@ ___ ▸ **sign**(`sigRequestHash`): `Promise`\<`Uint8Array`\> -Signs the provided request hash. +Signs a given signature request hash. #### Parameters | Name | Type | Description | | :------ | :------ | :------ | -| `sigRequestHash` | [`SigOps`](../interfaces/signing.SigOps.md) | The request hash to sign. | +| `sigRequestHash` | [`SigOps`](../interfaces/signing.SigOps.md) | The hash of the signature request to be signed. | #### Returns `Promise`\<`Uint8Array`\> -A promise which resolves to the generated signature as a Uint8Array. +A promise resolving to the signed hash as a Uint8Array. #### Defined in -[signing/index.ts:96](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L96) +[signing/index.ts:97](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L97) ___ @@ -199,7 +199,7 @@ ___ ▸ **signTransaction**(`«destructured»`): `Promise`\<`unknown`\> -Signs a transaction of the specified type. +Signs a transaction using the appropriate adapter. #### Parameters @@ -211,15 +211,15 @@ Signs a transaction of the specified type. `Promise`\<`unknown`\> -A promise that resolves with the signed transaction. +A promise resolving with the signed transaction. **`Throws`** -If an adapter for the given transaction type is not found. +Error if an adapter for the transaction type is not found. #### Defined in -[signing/index.ts:70](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L70) +[signing/index.ts:70](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L70) ___ @@ -243,7 +243,7 @@ A promise that resolves to an array of arrays of signatures in string format. #### Defined in -[signing/index.ts:196](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L196) +[signing/index.ts:197](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L197) ___ @@ -251,20 +251,20 @@ ___ ▸ **verifyAndReduceSignatures**(`sigsAndProofs`): `Promise`\<`string`\> -Verifies the signatures from the tss_nodes +Verifies and consolidates signatures received from validators. #### Parameters -| Name | Type | -| :------ | :------ | -| `sigsAndProofs` | `string`[][] | +| Name | Type | Description | +| :------ | :------ | :------ | +| `sigsAndProofs` | `string`[][] | Arrays of signatures and proofs. | #### Returns `Promise`\<`string`\> -string - the first valid signature +The first valid signature after verification. #### Defined in -[signing/index.ts:266](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L266) +[signing/index.ts:269](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L269) diff --git a/docs/enums/types.Arch.md b/docs/enums/types.Arch.md index 53602be0..21023df5 100644 --- a/docs/enums/types.Arch.md +++ b/docs/enums/types.Arch.md @@ -19,7 +19,7 @@ #### Defined in -[types/index.ts:87](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L87) +[types/index.ts:87](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L87) ___ @@ -29,4 +29,4 @@ ___ #### Defined in -[types/index.ts:85](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L85) +[types/index.ts:85](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L85) diff --git a/docs/interfaces/index.EntropyAccount.md b/docs/interfaces/index.EntropyAccount.md new file mode 100644 index 00000000..6aaa5979 --- /dev/null +++ b/docs/interfaces/index.EntropyAccount.md @@ -0,0 +1,43 @@ +[@entropyxyz/entropy-js](../README.md) / [Exports](../modules.md) / [index](../modules/index.md) / EntropyAccount + +# Interface: EntropyAccount + +[index](../modules/index.md).EntropyAccount + +## Table of contents + +### Properties + +- [programModKey](index.EntropyAccount.md#programmodkey) +- [sigRequestKey](index.EntropyAccount.md#sigrequestkey) +- [verifyingKey](index.EntropyAccount.md#verifyingkey) + +## Properties + +### programModKey + +• `Optional` **programModKey**: `string` \| [`Signer`](types.Signer.md) + +#### Defined in + +[index.ts:13](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L13) + +___ + +### sigRequestKey + +• `Optional` **sigRequestKey**: [`Signer`](types.Signer.md) + +#### Defined in + +[index.ts:12](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L12) + +___ + +### verifyingKey + +• `Optional` **verifyingKey**: `string` + +#### Defined in + +[index.ts:14](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L14) diff --git a/docs/interfaces/index.EntropyOpts.md b/docs/interfaces/index.EntropyOpts.md index 22dead3e..a7bf09c1 100644 --- a/docs/interfaces/index.EntropyOpts.md +++ b/docs/interfaces/index.EntropyOpts.md @@ -8,12 +8,24 @@ ### Properties +- [account](index.EntropyOpts.md#account) - [adapters](index.EntropyOpts.md#adapters) - [endpoint](index.EntropyOpts.md#endpoint) -- [seed](index.EntropyOpts.md#seed) ## Properties +### account + +• `Optional` **account**: [`EntropyAccount`](index.EntropyAccount.md) + +account for wallet initialization. + +#### Defined in + +[index.ts:19](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L19) + +___ + ### adapters • `Optional` **adapters**: `Object` @@ -26,7 +38,7 @@ A collection of signing adapters. #### Defined in -[index.ts:17](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L17) +[index.ts:23](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L23) ___ @@ -38,16 +50,4 @@ local or devnet endpoint for establishing a connection to validators #### Defined in -[index.ts:15](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L15) - -___ - -### seed - -• `Optional` **seed**: `string` - -seed for wallet initialization. - -#### Defined in - -[index.ts:13](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/index.ts#L13) +[index.ts:21](https://github.com/entropyxyz/entropy-js/blob/368842b/src/index.ts#L21) diff --git a/docs/interfaces/registration.RegisteredInfo.md b/docs/interfaces/registration.RegisteredInfo.md new file mode 100644 index 00000000..3c1080e9 --- /dev/null +++ b/docs/interfaces/registration.RegisteredInfo.md @@ -0,0 +1,32 @@ +[@entropyxyz/entropy-js](../README.md) / [Exports](../modules.md) / [registration](../modules/registration.md) / RegisteredInfo + +# Interface: RegisteredInfo + +[registration](../modules/registration.md).RegisteredInfo + +## Table of contents + +### Properties + +- [keyVisibility](registration.RegisteredInfo.md#keyvisibility) +- [verifyingKey](registration.RegisteredInfo.md#verifyingkey) + +## Properties + +### keyVisibility + +• **keyVisibility**: [`KeyVisibilityInfo`](../modules/registration.md#keyvisibilityinfo) + +#### Defined in + +[registration/index.ts:13](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L13) + +___ + +### verifyingKey + +• **verifyingKey**: `string` + +#### Defined in + +[registration/index.ts:14](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L14) diff --git a/docs/interfaces/registration.RegistrationParams.md b/docs/interfaces/registration.RegistrationParams.md index f0e051e5..10984c2e 100644 --- a/docs/interfaces/registration.RegistrationParams.md +++ b/docs/interfaces/registration.RegistrationParams.md @@ -8,47 +8,47 @@ ### Properties -- [address](registration.RegistrationParams.md#address) - [freeTx](registration.RegistrationParams.md#freetx) - [initialProgram](registration.RegistrationParams.md#initialprogram) - [keyVisibility](registration.RegistrationParams.md#keyvisibility) +- [programModAccount](registration.RegistrationParams.md#programmodaccount) ## Properties -### address +### freeTx -• **address**: [`Address`](../modules/types.md#address) +• `Optional` **freeTx**: `boolean` #### Defined in -[registration/index.ts:9](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/registration/index.ts#L9) +[registration/index.ts:6](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L6) ___ -### freeTx +### initialProgram -• `Optional` **freeTx**: `boolean` +• `Optional` **initialProgram**: `string` #### Defined in -[registration/index.ts:6](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/registration/index.ts#L6) +[registration/index.ts:7](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L7) ___ -### initialProgram +### keyVisibility -• `Optional` **initialProgram**: `string` +• `Optional` **keyVisibility**: ``"Public"`` \| ``"Permissioned"`` \| ``"Private"`` #### Defined in -[registration/index.ts:7](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/registration/index.ts#L7) +[registration/index.ts:8](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L8) ___ -### keyVisibility +### programModAccount -• `Optional` **keyVisibility**: ``"Public"`` \| ``"Permissioned"`` \| ``"Private"`` +• **programModAccount**: [`Address`](../modules/types.md#address) #### Defined in -[registration/index.ts:8](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/registration/index.ts#L8) +[registration/index.ts:9](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L9) diff --git a/docs/interfaces/signing.Config.md b/docs/interfaces/signing.Config.md index 90a673f1..f4f09230 100644 --- a/docs/interfaces/signing.Config.md +++ b/docs/interfaces/signing.Config.md @@ -25,7 +25,7 @@ #### Defined in -[signing/index.ts:13](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L13) +[signing/index.ts:13](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L13) ___ @@ -35,7 +35,7 @@ ___ #### Defined in -[signing/index.ts:14](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L14) +[signing/index.ts:14](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L14) ___ @@ -45,7 +45,7 @@ ___ #### Defined in -[signing/index.ts:11](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L11) +[signing/index.ts:11](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L11) ___ @@ -55,4 +55,4 @@ ___ #### Defined in -[signing/index.ts:12](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L12) +[signing/index.ts:12](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L12) diff --git a/docs/interfaces/signing.SigOps.md b/docs/interfaces/signing.SigOps.md index 64e90e57..f144fa4f 100644 --- a/docs/interfaces/signing.SigOps.md +++ b/docs/interfaces/signing.SigOps.md @@ -19,7 +19,7 @@ #### Defined in -[signing/index.ts:27](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L27) +[signing/index.ts:27](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L27) ___ @@ -29,4 +29,4 @@ ___ #### Defined in -[signing/index.ts:28](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L28) +[signing/index.ts:28](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L28) diff --git a/docs/interfaces/signing.SigTxOps.md b/docs/interfaces/signing.SigTxOps.md index 72ac296e..872759a2 100644 --- a/docs/interfaces/signing.SigTxOps.md +++ b/docs/interfaces/signing.SigTxOps.md @@ -19,7 +19,7 @@ #### Defined in -[signing/index.ts:22](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L22) +[signing/index.ts:22](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L22) ___ @@ -29,4 +29,4 @@ ___ #### Defined in -[signing/index.ts:23](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/index.ts#L23) +[signing/index.ts:23](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/index.ts#L23) diff --git a/docs/interfaces/signing_adapters_types.Adapter.md b/docs/interfaces/signing_adapters_types.Adapter.md index 418a216f..d2632915 100644 --- a/docs/interfaces/signing_adapters_types.Adapter.md +++ b/docs/interfaces/signing_adapters_types.Adapter.md @@ -21,7 +21,7 @@ #### Defined in -[signing/adapters/types.ts:5](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/types.ts#L5) +[signing/adapters/types.ts:5](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/types.ts#L5) ___ @@ -45,7 +45,7 @@ ___ #### Defined in -[signing/adapters/types.ts:7](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/types.ts#L7) +[signing/adapters/types.ts:7](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/types.ts#L7) ___ @@ -69,7 +69,7 @@ ___ #### Defined in -[signing/adapters/types.ts:6](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/types.ts#L6) +[signing/adapters/types.ts:6](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/types.ts#L6) ___ @@ -79,4 +79,4 @@ ___ #### Defined in -[signing/adapters/types.ts:4](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/types.ts#L4) +[signing/adapters/types.ts:4](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/types.ts#L4) diff --git a/docs/interfaces/signing_adapters_types.OptAdapter.md b/docs/interfaces/signing_adapters_types.OptAdapter.md index 4439a24b..17cd287f 100644 --- a/docs/interfaces/signing_adapters_types.OptAdapter.md +++ b/docs/interfaces/signing_adapters_types.OptAdapter.md @@ -21,7 +21,7 @@ #### Defined in -[signing/adapters/types.ts:12](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/types.ts#L12) +[signing/adapters/types.ts:12](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/types.ts#L12) ___ @@ -45,7 +45,7 @@ ___ #### Defined in -[signing/adapters/types.ts:14](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/types.ts#L14) +[signing/adapters/types.ts:14](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/types.ts#L14) ___ @@ -69,7 +69,7 @@ ___ #### Defined in -[signing/adapters/types.ts:13](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/types.ts#L13) +[signing/adapters/types.ts:13](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/types.ts#L13) ___ @@ -79,4 +79,4 @@ ___ #### Defined in -[signing/adapters/types.ts:11](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/types.ts#L11) +[signing/adapters/types.ts:11](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/types.ts#L11) diff --git a/docs/interfaces/types.Account.md b/docs/interfaces/types.Account.md index 6384f418..fbdd74ae 100644 --- a/docs/interfaces/types.Account.md +++ b/docs/interfaces/types.Account.md @@ -29,7 +29,7 @@ #### Defined in -[types/index.ts:24](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L24) +[types/index.ts:24](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L24) ___ @@ -39,4 +39,4 @@ ___ #### Defined in -[types/index.ts:28](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L28) +[types/index.ts:28](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L28) diff --git a/docs/interfaces/types.EncMsg.md b/docs/interfaces/types.EncMsg.md index c513c69b..dd1fdb9d 100644 --- a/docs/interfaces/types.EncMsg.md +++ b/docs/interfaces/types.EncMsg.md @@ -20,7 +20,7 @@ #### Defined in -[types/index.ts:97](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L97) +[types/index.ts:97](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L97) ___ @@ -30,7 +30,7 @@ ___ #### Defined in -[types/index.ts:99](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L99) +[types/index.ts:99](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L99) ___ @@ -40,4 +40,4 @@ ___ #### Defined in -[types/index.ts:98](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L98) +[types/index.ts:98](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L98) diff --git a/docs/interfaces/types.EventFilter.md b/docs/interfaces/types.EventFilter.md index f02b8dcc..800c724b 100644 --- a/docs/interfaces/types.EventFilter.md +++ b/docs/interfaces/types.EventFilter.md @@ -19,7 +19,7 @@ #### Defined in -[types/index.ts:80](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L80) +[types/index.ts:80](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L80) ___ @@ -29,4 +29,4 @@ ___ #### Defined in -[types/index.ts:79](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L79) +[types/index.ts:79](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L79) diff --git a/docs/interfaces/types.ITransactionRequest.md b/docs/interfaces/types.ITransactionRequest.md index c049e1c5..84c5ba2f 100644 --- a/docs/interfaces/types.ITransactionRequest.md +++ b/docs/interfaces/types.ITransactionRequest.md @@ -19,7 +19,7 @@ #### Defined in -[types/index.ts:92](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L92) +[types/index.ts:92](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L92) ___ @@ -29,4 +29,4 @@ ___ #### Defined in -[types/index.ts:93](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L93) +[types/index.ts:93](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L93) diff --git a/docs/interfaces/types.KeyPair.md b/docs/interfaces/types.KeyPair.md index bfcfc323..8edefb13 100644 --- a/docs/interfaces/types.KeyPair.md +++ b/docs/interfaces/types.KeyPair.md @@ -19,7 +19,7 @@ #### Defined in -[types/index.ts:11](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L11) +[types/index.ts:11](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L11) ___ @@ -29,4 +29,4 @@ ___ #### Defined in -[types/index.ts:10](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L10) +[types/index.ts:10](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L10) diff --git a/docs/interfaces/types.KeyShare.md b/docs/interfaces/types.KeyShare.md index 92a5e984..a167bfb5 100644 --- a/docs/interfaces/types.KeyShare.md +++ b/docs/interfaces/types.KeyShare.md @@ -24,4 +24,4 @@ #### Defined in -[types/index.ts:24](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L24) +[types/index.ts:24](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L24) diff --git a/docs/interfaces/types.ServerDHInfo.md b/docs/interfaces/types.ServerDHInfo.md index feed31f7..64137592 100644 --- a/docs/interfaces/types.ServerDHInfo.md +++ b/docs/interfaces/types.ServerDHInfo.md @@ -24,4 +24,4 @@ #### Defined in -[types/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L20) +[types/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L20) diff --git a/docs/interfaces/types.ServerInfo.md b/docs/interfaces/types.ServerInfo.md index 210385ad..725f3826 100644 --- a/docs/interfaces/types.ServerInfo.md +++ b/docs/interfaces/types.ServerInfo.md @@ -26,7 +26,7 @@ #### Defined in -[types/index.ts:36](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L36) +[types/index.ts:36](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L36) ___ @@ -36,7 +36,7 @@ ___ #### Defined in -[types/index.ts:35](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L35) +[types/index.ts:35](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L35) ___ @@ -50,4 +50,4 @@ ___ #### Defined in -[types/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L20) +[types/index.ts:20](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L20) diff --git a/docs/interfaces/types.Signer.md b/docs/interfaces/types.Signer.md index 75c0c1f4..f0966304 100644 --- a/docs/interfaces/types.Signer.md +++ b/docs/interfaces/types.Signer.md @@ -19,7 +19,7 @@ #### Defined in -[types/index.ts:16](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L16) +[types/index.ts:16](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L16) ___ @@ -29,4 +29,4 @@ ___ #### Defined in -[types/index.ts:15](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L15) +[types/index.ts:15](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L15) diff --git a/docs/interfaces/types.UserTransactionRequest.md b/docs/interfaces/types.UserTransactionRequest.md index 96f45a69..91997a99 100644 --- a/docs/interfaces/types.UserTransactionRequest.md +++ b/docs/interfaces/types.UserTransactionRequest.md @@ -20,7 +20,7 @@ #### Defined in -[types/index.ts:53](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L53) +[types/index.ts:53](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L53) ___ @@ -30,7 +30,7 @@ ___ #### Defined in -[types/index.ts:55](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L55) +[types/index.ts:55](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L55) ___ @@ -40,4 +40,4 @@ ___ #### Defined in -[types/index.ts:56](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L56) +[types/index.ts:56](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L56) diff --git a/docs/interfaces/types.ValidatorInfo.md b/docs/interfaces/types.ValidatorInfo.md index 1899ea03..395417d6 100644 --- a/docs/interfaces/types.ValidatorInfo.md +++ b/docs/interfaces/types.ValidatorInfo.md @@ -20,7 +20,7 @@ #### Defined in -[types/index.ts:70](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L70) +[types/index.ts:70](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L70) ___ @@ -30,7 +30,7 @@ ___ #### Defined in -[types/index.ts:71](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L71) +[types/index.ts:71](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L71) ___ @@ -40,4 +40,4 @@ ___ #### Defined in -[types/index.ts:69](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L69) +[types/index.ts:69](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L69) diff --git a/docs/interfaces/utils_crypto.CryptoLib.md b/docs/interfaces/utils_crypto.CryptoLib.md index bcffec8d..8fa8c030 100644 --- a/docs/interfaces/utils_crypto.CryptoLib.md +++ b/docs/interfaces/utils_crypto.CryptoLib.md @@ -46,7 +46,7 @@ Uses the provided secret key for decryption. #### Defined in -[utils/crypto.ts:46](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/crypto.ts#L46) +[utils/crypto.ts:46](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/crypto.ts#L46) ___ @@ -75,7 +75,7 @@ Uses the provided secret key for encryption and the server's Diffie-Hellman (DH) #### Defined in -[utils/crypto.ts:37](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/crypto.ts#L37) +[utils/crypto.ts:37](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/crypto.ts#L37) ___ @@ -99,7 +99,7 @@ ___ #### Defined in -[utils/crypto.ts:32](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/crypto.ts#L32) +[utils/crypto.ts:32](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/crypto.ts#L32) ___ @@ -125,7 +125,7 @@ Derives the public key from the provided secret key. #### Defined in -[utils/crypto.ts:50](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/crypto.ts#L50) +[utils/crypto.ts:50](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/crypto.ts#L50) ___ @@ -151,4 +151,4 @@ ___ #### Defined in -[utils/crypto.ts:30](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/crypto.ts#L30) +[utils/crypto.ts:30](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/crypto.ts#L30) diff --git a/docs/modules/index.md b/docs/modules/index.md index 900f9517..1d31d4f7 100644 --- a/docs/modules/index.md +++ b/docs/modules/index.md @@ -10,4 +10,5 @@ ### Interfaces +- [EntropyAccount](../interfaces/index.EntropyAccount.md) - [EntropyOpts](../interfaces/index.EntropyOpts.md) diff --git a/docs/modules/keys.md b/docs/modules/keys.md index 55b74e6b..122c96b6 100644 --- a/docs/modules/keys.md +++ b/docs/modules/keys.md @@ -7,23 +7,78 @@ ### Functions - [getWallet](keys.md#getwallet) +- [isValidPair](keys.md#isvalidpair) +- [mnemonicGenOrDerive](keys.md#mnemonicgenorderive) ## Functions ### getWallet -▸ **getWallet**(`seed`): `Promise`\<[`Signer`](../interfaces/types.Signer.md)\> +▸ **getWallet**(`pair`): `Promise`\<\{ `pair`: `Keypair` ; `wallet`: `KeyringPair` }\> + +Retrieves a wallet from a `Signer` object or a seed string. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `pair` | `string` \| [`Signer`](../interfaces/types.Signer.md) | A `Signer` object or a seed string. | + +#### Returns + +`Promise`\<\{ `pair`: `Keypair` ; `wallet`: `KeyringPair` }\> + +A Promise resolving to an object containing the wallet and its associated `Signer`, or undefined if the input is invalid. + +#### Defined in + +[keys/index.ts:65](https://github.com/entropyxyz/entropy-js/blob/368842b/src/keys/index.ts#L65) + +___ + +### isValidPair + +▸ **isValidPair**(`pair`): `boolean` + +Checks if the provided object is a valid `Signer` pair. #### Parameters -| Name | Type | -| :------ | :------ | -| `seed` | `string` | +| Name | Type | Description | +| :------ | :------ | :------ | +| `pair` | [`Signer`](../interfaces/types.Signer.md) | The `Signer` object to be validated. | + +#### Returns + +`boolean` + +A boolean indicating whether the provided object is a valid `Signer` pair. + +#### Defined in + +[keys/index.ts:22](https://github.com/entropyxyz/entropy-js/blob/368842b/src/keys/index.ts#L22) + +___ + +### mnemonicGenOrDerive + +▸ **mnemonicGenOrDerive**(`mnemonic?`, `derivationPath?`): `Promise`\<[`Signer`](../interfaces/types.Signer.md)\> + +Generates a new mnemonic phrase or derives a wallet from an existing mnemonic and an optional derivation path. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `mnemonic?` | `string` | Optional. The mnemonic phrase to derive the wallet from. If not provided, a new one is generated. | +| `derivationPath?` | `string` | Optional. The derivation path to use with the provided mnemonic. | #### Returns `Promise`\<[`Signer`](../interfaces/types.Signer.md)\> +A Promise resolving to a `Signer` object containing the generated or derived wallet and its associated key pair. + #### Defined in -[keys/index.ts:5](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/keys/index.ts#L5) +[keys/index.ts:75](https://github.com/entropyxyz/entropy-js/blob/368842b/src/keys/index.ts#L75) diff --git a/docs/modules/registration.md b/docs/modules/registration.md index 1b8eaf0d..0c1fbb8e 100644 --- a/docs/modules/registration.md +++ b/docs/modules/registration.md @@ -10,4 +10,19 @@ ### Interfaces +- [RegisteredInfo](../interfaces/registration.RegisteredInfo.md) - [RegistrationParams](../interfaces/registration.RegistrationParams.md) + +### Type Aliases + +- [KeyVisibilityInfo](registration.md#keyvisibilityinfo) + +## Type Aliases + +### KeyVisibilityInfo + +Ƭ **KeyVisibilityInfo**: \{ `public`: ``null`` } \| \{ `permissioned`: ``null`` } \| \{ `private`: ``null`` } + +#### Defined in + +[registration/index.ts:17](https://github.com/entropyxyz/entropy-js/blob/368842b/src/registration/index.ts#L17) diff --git a/docs/modules/signing_adapters_default.md b/docs/modules/signing_adapters_default.md index f2736969..1ff8eaa5 100644 --- a/docs/modules/signing_adapters_default.md +++ b/docs/modules/signing_adapters_default.md @@ -22,4 +22,4 @@ #### Defined in -[signing/adapters/default.ts:3](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/default.ts#L3) +[signing/adapters/default.ts:3](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/default.ts#L3) diff --git a/docs/modules/signing_adapters_eth.md b/docs/modules/signing_adapters_eth.md index f5333c19..79ca6e80 100644 --- a/docs/modules/signing_adapters_eth.md +++ b/docs/modules/signing_adapters_eth.md @@ -13,6 +13,7 @@ - [postSign](signing_adapters_eth.md#postsign) - [preSign](signing_adapters_eth.md#presign) +- [pubToAddress](signing_adapters_eth.md#pubtoaddress) ## Variables @@ -22,7 +23,7 @@ #### Defined in -[signing/adapters/eth.ts:17](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/eth.ts#L17) +[signing/adapters/eth.ts:16](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/eth.ts#L16) ___ @@ -32,7 +33,7 @@ ___ #### Defined in -[signing/adapters/eth.ts:16](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/eth.ts#L16) +[signing/adapters/eth.ts:15](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/eth.ts#L15) ## Functions @@ -52,19 +53,19 @@ ___ #### Defined in -[signing/adapters/eth.ts:11](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/eth.ts#L11) +[signing/adapters/eth.ts:11](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/eth.ts#L11) ___ ### preSign -▸ **preSign**(`tx`): `Promise`\<`string`\> +▸ **preSign**(`txData`): `Promise`\<`string`\> #### Parameters | Name | Type | | :------ | :------ | -| `tx` | `any` | +| `txData` | `any` | #### Returns @@ -72,4 +73,24 @@ ___ #### Defined in -[signing/adapters/eth.ts:4](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/signing/adapters/eth.ts#L4) +[signing/adapters/eth.ts:5](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/eth.ts#L5) + +___ + +### pubToAddress + +▸ **pubToAddress**(`publicKey`): `string` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `publicKey` | `string` | + +#### Returns + +`string` + +#### Defined in + +[signing/adapters/eth.ts:18](https://github.com/entropyxyz/entropy-js/blob/368842b/src/signing/adapters/eth.ts#L18) diff --git a/docs/modules/types.md b/docs/modules/types.md index 3b6765a3..5ed6538c 100644 --- a/docs/modules/types.md +++ b/docs/modules/types.md @@ -39,7 +39,7 @@ #### Defined in -[types/index.ts:74](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L74) +[types/index.ts:74](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L74) ___ @@ -49,7 +49,7 @@ ___ #### Defined in -[types/index.ts:75](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L75) +[types/index.ts:75](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L75) ___ @@ -59,7 +59,7 @@ ___ #### Defined in -[types/index.ts:76](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L76) +[types/index.ts:76](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L76) ___ @@ -69,7 +69,7 @@ ___ #### Defined in -[types/index.ts:6](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L6) +[types/index.ts:6](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L6) ___ @@ -79,7 +79,7 @@ ___ #### Defined in -[types/index.ts:7](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L7) +[types/index.ts:7](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L7) ___ @@ -89,4 +89,4 @@ ___ #### Defined in -[types/index.ts:31](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/types/index.ts#L31) +[types/index.ts:31](https://github.com/entropyxyz/entropy-js/blob/368842b/src/types/index.ts#L31) diff --git a/docs/modules/utils.md b/docs/modules/utils.md index 3319d6ee..28613582 100644 --- a/docs/modules/utils.md +++ b/docs/modules/utils.md @@ -17,6 +17,8 @@ - [hexStringToIntArray](utils.md#hexstringtointarray) - [hexToBase64](utils.md#hextobase64) - [hexToBase64remove](utils.md#hextobase64remove) +- [isHexSee](utils.md#ishexsee) +- [isPublicKey](utils.md#ispublickey) - [isValidSubstrateAddress](utils.md#isvalidsubstrateaddress) - [readKey](utils.md#readkey) - [sendHttpPost](utils.md#sendhttppost) @@ -43,7 +45,7 @@ #### Defined in -[utils/index.ts:137](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L137) +[utils/index.ts:149](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L149) ___ @@ -63,7 +65,7 @@ ___ #### Defined in -[utils/index.ts:133](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L133) +[utils/index.ts:145](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L145) ___ @@ -77,7 +79,7 @@ ___ #### Defined in -[utils/index.ts:34](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L34) +[utils/index.ts:46](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L46) ___ @@ -97,7 +99,7 @@ ___ #### Defined in -[utils/index.ts:143](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L143) +[utils/index.ts:155](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L155) ___ @@ -117,7 +119,7 @@ ___ #### Defined in -[utils/index.ts:165](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L165) +[utils/index.ts:177](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L177) ___ @@ -137,7 +139,7 @@ ___ #### Defined in -[utils/index.ts:160](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L160) +[utils/index.ts:172](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L172) ___ @@ -157,7 +159,47 @@ ___ #### Defined in -[utils/index.ts:151](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L151) +[utils/index.ts:163](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L163) + +___ + +### isHexSee + +▸ **isHexSee**(`str`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `str` | `string` | + +#### Returns + +`boolean` + +#### Defined in + +[utils/index.ts:16](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L16) + +___ + +### isPublicKey + +▸ **isPublicKey**(`str`): `boolean` + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `str` | `string` | + +#### Returns + +`boolean` + +#### Defined in + +[utils/index.ts:10](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L10) ___ @@ -177,7 +219,7 @@ ___ #### Defined in -[utils/index.ts:15](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L15) +[utils/index.ts:27](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L27) ___ @@ -197,28 +239,28 @@ ___ #### Defined in -[utils/index.ts:94](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L94) +[utils/index.ts:106](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L106) ___ ### sendHttpPost -▸ **sendHttpPost**(`url`, `data`): `Promise`\<`string`[] \| `string` \| [`AnyObject`](../interfaces/utils.AnyObject.md)\> +▸ **sendHttpPost**(`url`, `data`): `Promise`\<`any`\> #### Parameters | Name | Type | | :------ | :------ | | `url` | `string` | -| `data` | `string` | +| `data` | `any` | #### Returns -`Promise`\<`string`[] \| `string` \| [`AnyObject`](../interfaces/utils.AnyObject.md)\> +`Promise`\<`any`\> #### Defined in -[utils/index.ts:51](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L51) +[utils/index.ts:63](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L63) ___ @@ -238,7 +280,7 @@ ___ #### Defined in -[utils/index.ts:25](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L25) +[utils/index.ts:37](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L37) ___ @@ -258,7 +300,7 @@ ___ #### Defined in -[utils/index.ts:128](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L128) +[utils/index.ts:140](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L140) ___ @@ -278,7 +320,7 @@ ___ #### Defined in -[utils/index.ts:10](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L10) +[utils/index.ts:22](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L22) ___ @@ -298,4 +340,4 @@ ___ #### Defined in -[utils/index.ts:124](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/index.ts#L124) +[utils/index.ts:136](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/index.ts#L136) diff --git a/docs/modules/utils_crypto.md b/docs/modules/utils_crypto.md index c48d9cf4..c1a4ae3b 100644 --- a/docs/modules/utils_crypto.md +++ b/docs/modules/utils_crypto.md @@ -25,7 +25,7 @@ #### Defined in -[utils/crypto.ts:57](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/crypto.ts#L57) +[utils/crypto.ts:57](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/crypto.ts#L57) ___ @@ -35,7 +35,7 @@ ___ #### Defined in -[utils/crypto.ts:53](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/crypto.ts#L53) +[utils/crypto.ts:53](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/crypto.ts#L53) ## Functions @@ -53,4 +53,4 @@ The imported crypto library. #### Defined in -[utils/crypto.ts:98](https://github.com/entropyxyz/entropy-js/blob/a7aaa0c/src/utils/crypto.ts#L98) +[utils/crypto.ts:98](https://github.com/entropyxyz/entropy-js/blob/368842b/src/utils/crypto.ts#L98) diff --git a/src/index.ts b/src/index.ts index bdfe3fc8..8de42229 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,8 +38,8 @@ export interface EntropyOpts { const signer = await getWallet(charlieStashSeed) const entropyAccount: EntropyAccount = { - sigRequestKey: signer.pair, - programModKey: signer.pair + sigRequestKey: signer, + programModKey: signer } const entropy = new Entropy({ account: entropyAccount}) diff --git a/src/registration/index.ts b/src/registration/index.ts index e3e67e76..531fa634 100644 --- a/src/registration/index.ts +++ b/src/registration/index.ts @@ -9,6 +9,16 @@ export interface RegistrationParams { programModAccount: Address } +export interface RegisteredInfo { + keyVisibility: KeyVisibilityInfo + verifyingKey: string +} + +export type KeyVisibilityInfo = + | { public: null } + | { permissioned: null } + | { private: null } + /** * The `RegistrationManager` class provides functionality for user registration using the Polkadot/Substrate API. * It extends the `ExtrinsicBaseClass` to handle extrinsic submissions and utility methods. @@ -53,7 +63,7 @@ export default class RegistrationManager extends ExtrinsicBaseClass { initialProgram, keyVisibility = 'Permissioned', programModAccount, - }: RegistrationParams): Promise { + }: RegistrationParams): Promise { const programModificationAccount = programModAccount // this is sloppy @@ -65,16 +75,25 @@ export default class RegistrationManager extends ExtrinsicBaseClass { throw new Error('already registered') } - const registered: Promise = new Promise((resolve, reject) => { + const registered: Promise = new Promise((resolve, reject) => { try { const unsubPromise = this.substrate.rpc.chain.subscribeNewHeads( async () => { - const registeredCheck = await this.checkRegistrationStatus( - this.signer.wallet.address ) + const registeredCheck = await this.checkRegistrationStatus(this.signer.wallet.address) if (registeredCheck) { const unsub = await unsubPromise unsub() - resolve(undefined) + const registeredData = await this.substrate.query.relayer.registered(this.signer.wallet.address) + // @ts-ignore: next line + if (!registeredData.isSome) { + throw new Error('Registration information not found') + } + // @ts-ignore: next line + const data = registeredData.unwrap() + resolve({ + keyVisibility: data.keyVisibility.toJSON() as KeyVisibilityInfo, + verifyingKey: data.verifyingKey.toString(), + }) } } ) @@ -105,7 +124,8 @@ export default class RegistrationManager extends ExtrinsicBaseClass { async checkRegistrationStatus (address: Address): Promise { const isRegistered = await this.substrate.query.relayer.registered(address) + console.log("REGISTERED", isRegistered.toJSON()) return !!isRegistered.toJSON() } -} +} \ No newline at end of file diff --git a/src/signing/adapters/types.ts b/src/signing/adapters/types.ts index b9a04d20..7a94cfd4 100644 --- a/src/signing/adapters/types.ts +++ b/src/signing/adapters/types.ts @@ -12,4 +12,4 @@ export interface OptAdapter { arch?: Arch preSign?: (sigReq: TxParams) => Promise postSign?: (sig: Uint8Array) => Promise -} +} \ No newline at end of file diff --git a/src/signing/index.ts b/src/signing/index.ts index 1263f010..d1f0275a 100644 --- a/src/signing/index.ts +++ b/src/signing/index.ts @@ -309,4 +309,4 @@ export default class SignatureRequestManager { return seperatedSigsAndProofs.sigs[first] } -} +} \ No newline at end of file diff --git a/src/utils/crypto.ts b/src/utils/crypto.ts index 15d30674..c1c66a55 100644 --- a/src/utils/crypto.ts +++ b/src/utils/crypto.ts @@ -107,4 +107,4 @@ export async function loadCryptoLib () { isImported = true res.resolve() return cryptoLib -} +} \ No newline at end of file diff --git a/src/utils/index.ts b/src/utils/index.ts index 509bfd8a..ab9a2d55 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -19,7 +19,6 @@ export function isHexSee (str: string): boolean { return hexPattern.test(stripped) } - export function stripHexPrefix (str: string): string { if (str.startsWith('0x')) return str.slice(2) return str @@ -61,7 +60,7 @@ export async function getApi (): Promise { } } -export async function sendHttpPost (url: string, data: string): Promise { +export async function sendHttpPost (url: string, data: any): Promise { const headers = { 'Content-Type': 'application/json', }