@talismn/on-chain-id 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/declarations/src/index.d.ts +12 -33
- package/dist/declarations/src/util/addressesToNames.d.ts +14 -0
- package/dist/declarations/src/util/aznsRouter.d.ts +10 -0
- package/dist/declarations/src/util/isPotentialAzns.d.ts +2 -0
- package/dist/declarations/src/util/isPotentialEns.d.ts +2 -0
- package/dist/declarations/src/util/namesToAddresses.d.ts +10 -0
- package/dist/declarations/src/util/types.d.ts +31 -0
- package/dist/talismn-on-chain-id.cjs.dev.js +1541 -146
- package/dist/talismn-on-chain-id.cjs.prod.js +1541 -146
- package/dist/talismn-on-chain-id.esm.js +1537 -141
- package/package.json +23 -17
- package/CHANGELOG.md +0 -26
- package/dist/declarations/src/helpers.d.ts +0 -1
package/README.md
CHANGED
@@ -5,7 +5,6 @@
|
|
5
5
|
[](https://github.com/TalismanSociety/talisman/blob/dev/LICENSE)
|
6
6
|
[](https://www.npmjs.com/package/@talismn/on-chain-id)
|
7
7
|
[](https://www.npmjs.com/package/@talismn/on-chain-id)
|
8
|
-
[](https://discord.gg/talisman)
|
9
8
|
|
10
9
|
**@talismn/on-chain-id** is used to query on-chain identifiers for account addresses in Ethereum and Polkadot.
|
11
10
|
|
@@ -1,35 +1,14 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
export * from "./
|
4
|
-
export
|
1
|
+
import { OptionalConfig } from "./util/types";
|
2
|
+
export type { Config as OnChainIdConfig, NsLookupType, OnChainIds, ResolvedNames, } from "./util/types";
|
3
|
+
export * from "./util/isPotentialAzns";
|
4
|
+
export * from "./util/isPotentialEns";
|
5
5
|
export declare class OnChainId {
|
6
|
-
private
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
resolveNames(names: string[]): Promise<Map<string, string | null>>;
|
15
|
-
/**
|
16
|
-
* Looks up the on-chain identifiers for some addresses.
|
17
|
-
*
|
18
|
-
* Prefers ENS, then falls back to Polkadot identities.
|
19
|
-
*
|
20
|
-
* Requires a TypeRegistry which has been instantiated on the Polkadot relay chain.
|
21
|
-
* Talisman Wallet developers can build one by using `/apps/extension/src/core/util/getTypeRegistry.ts`.
|
22
|
-
*/
|
23
|
-
lookupAddresses(addresses: string[]): Promise<OnChainIds>;
|
24
|
-
/**
|
25
|
-
* Looks up the on-chain Polkadot identities for some addresses.
|
26
|
-
*
|
27
|
-
* Requires a TypeRegistry which has been instantiated on the Polkadot relay chain.
|
28
|
-
* Talisman Wallet developers can build one by using `/apps/extension/src/core/util/getTypeRegistry.ts`.
|
29
|
-
*/
|
30
|
-
lookupPolkadotAddresses(addresses: string[]): Promise<OnChainIds>;
|
31
|
-
/**
|
32
|
-
* Looks up the on-chain ENS domains for some addresses.
|
33
|
-
*/
|
34
|
-
lookupEnsAddresses(addresses: string[]): Promise<OnChainIds>;
|
6
|
+
#private;
|
7
|
+
constructor(config: OptionalConfig);
|
8
|
+
resolveNames: (names: string[]) => Promise<import("./util/types").ResolvedNames>;
|
9
|
+
resolveEnsNames: (names: string[]) => Promise<import("./util/types").ResolvedNames>;
|
10
|
+
resolveAznsNames: (names: string[]) => Promise<import("./util/types").ResolvedNames>;
|
11
|
+
lookupAddresses: (addresses: string[]) => Promise<import("./util/types").OnChainIds>;
|
12
|
+
lookupAznsAddresses: (addresses: string[]) => Promise<import("./util/types").OnChainIds>;
|
13
|
+
lookupEnsAddresses: (addresses: string[]) => Promise<import("./util/types").OnChainIds>;
|
35
14
|
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Config, OnChainIds } from "./types";
|
2
|
+
/**
|
3
|
+
* Looks up the on-chain identifiers for some addresses.
|
4
|
+
* Supports ENS and AZNS.
|
5
|
+
*/
|
6
|
+
export declare const lookupAddresses: (config: Config, addresses: string[]) => Promise<OnChainIds>;
|
7
|
+
/**
|
8
|
+
* Looks up the on-chain AZNS domains for some addresses.
|
9
|
+
*/
|
10
|
+
export declare const lookupAznsAddresses: (config: Config, addresses: string[]) => Promise<OnChainIds>;
|
11
|
+
/**
|
12
|
+
* Looks up the on-chain ENS domains for some addresses.
|
13
|
+
*/
|
14
|
+
export declare const lookupEnsAddresses: (config: Config, addresses: string[]) => Promise<OnChainIds>;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ProviderInterface } from "@polkadot/rpc-provider/types";
|
2
|
+
import { TypeRegistry } from "@polkadot/types";
|
3
|
+
type ProviderOptions = {
|
4
|
+
chainId: string;
|
5
|
+
provider: ProviderInterface;
|
6
|
+
registry: TypeRegistry;
|
7
|
+
};
|
8
|
+
export declare const resolveDomainToAddress: (domain: string, { provider, registry, chainId }: ProviderOptions) => Promise<string>;
|
9
|
+
export declare const resolveAddressToDomain: (address: string, { provider, registry, chainId }: ProviderOptions) => Promise<string>;
|
10
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { Config, ResolvedNames } from "./types";
|
2
|
+
export declare const resolveNames: (config: Config, names: string[]) => Promise<ResolvedNames>;
|
3
|
+
/**
|
4
|
+
* Looks up the addresses for some azns (azero.id) domains.
|
5
|
+
*/
|
6
|
+
export declare const resolveAznsNames: (config: Config, names: string[]) => Promise<ResolvedNames>;
|
7
|
+
/**
|
8
|
+
* Looks up the addresses for some ens (ens.domains) domains.
|
9
|
+
*/
|
10
|
+
export declare const resolveEnsNames: (config: Config, names: string[]) => Promise<ResolvedNames>;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { SupportedChainId } from "@azns/resolver-core";
|
2
|
+
import { TypeRegistry } from "@polkadot/types";
|
3
|
+
import { ChainConnectors } from "@talismn/balances";
|
4
|
+
/** A map of addresses to their on-chain ids. */
|
5
|
+
export type OnChainIds = Map<string, string | null>;
|
6
|
+
/** A map of lookup names to their resolved addresses. */
|
7
|
+
export type ResolvedNames = Map<string, [string, NsLookupType] | null>;
|
8
|
+
/** These are the supported name lookup types. */
|
9
|
+
export type NsLookupType = "ens" | "azns";
|
10
|
+
/**
|
11
|
+
* Used as the first parameter to all `namesToAddresses`/`addressesToNames` functions.
|
12
|
+
*/
|
13
|
+
export type Config = {
|
14
|
+
registryAlephZero: TypeRegistry;
|
15
|
+
chainConnectors: ChainConnectors;
|
16
|
+
/** Used for azns lookups */
|
17
|
+
chainIdAlephZero: string;
|
18
|
+
/** Used for azns lookups */
|
19
|
+
aznsSupportedChainIdAlephZero: `${SupportedChainId}`;
|
20
|
+
/** Used for ens lookups */
|
21
|
+
networkIdEthereum: string;
|
22
|
+
};
|
23
|
+
export type OptionalConfigParams = "chainIdAlephZero" | "aznsSupportedChainIdAlephZero" | "networkIdEthereum";
|
24
|
+
export type OptionalConfig = Omit<Config, OptionalConfigParams> & Partial<Pick<Config, OptionalConfigParams>>;
|
25
|
+
/**
|
26
|
+
* Removes the first argument from a tuple type.
|
27
|
+
*
|
28
|
+
* type AllParams = ["one", "two", "three"]
|
29
|
+
* type DropFirstParams = DropFirst<AllParams> // evaluates to ["two", "three"]
|
30
|
+
*/
|
31
|
+
export type DropFirst<T extends unknown[]> = T extends [unknown, ...infer U] ? U : never;
|