@gvnrdao/sdk-browser 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +1536 -0
- package/dist/browser.js.map +7 -0
- package/dist/tsc/browser-init.d.ts +0 -0
- package/dist/tsc/browser.d.ts +12 -0
- package/dist/tsc/cli.d.ts +2 -0
- package/dist/tsc/constants/chunks/accounts-set.d.ts +5 -0
- package/dist/tsc/constants/index.d.ts +1 -0
- package/dist/tsc/gvnr/index.d.ts +5 -0
- package/dist/tsc/gvnr/modules/chain-wallets/index.d.ts +6 -0
- package/dist/tsc/gvnr/modules/gvnr-wallets/classes/cosmos-gvnr-wallet.class.d.ts +10 -0
- package/dist/tsc/gvnr/modules/gvnr-wallets/classes/ethereum-gvnr-wallet.class.d.ts +10 -0
- package/dist/tsc/gvnr/modules/gvnr-wallets/classes/gvnr-wallet.class.d.ts +15 -0
- package/dist/tsc/gvnr/modules/gvnr-wallets/index.d.ts +1 -0
- package/dist/tsc/gvnr/modules/gvnr-wallets/modules/gvnr-wallets.d.ts +18 -0
- package/dist/tsc/gvnr/modules/lit/index.d.ts +7 -0
- package/dist/tsc/gvnr/modules/lit-auth/constants/chunks/supported-gvnr-lit-authentication-method-names.d.ts +1 -0
- package/dist/tsc/gvnr/modules/lit-auth/constants/chunks/supported-gvnr-lit-authentication-methods.d.ts +2 -0
- package/dist/tsc/gvnr/modules/lit-auth/constants/index.d.ts +2 -0
- package/dist/tsc/gvnr/modules/lit-auth/index.d.ts +3 -0
- package/dist/tsc/gvnr/modules/lit-auth/interfaces/chunks/gvnr-lit-authentication-method.i.d.ts +14 -0
- package/dist/tsc/gvnr/modules/lit-auth/interfaces/index.d.ts +1 -0
- package/dist/tsc/gvnr/modules/lit-auth/modules/lit-auth.d.ts +18 -0
- package/dist/tsc/gvnr/modules/lit-pkp/index.d.ts +8 -0
- package/dist/tsc/gvnr/modules/pricing/index.d.ts +0 -0
- package/dist/tsc/gvnr/modules/transactions/index.d.ts +1 -0
- package/dist/tsc/gvnr/modules/transactions/modules/data.d.ts +4 -0
- package/dist/tsc/gvnr-browser/index.d.ts +2 -0
- package/dist/tsc/gvnr-browser/modules/eth-signer.d.ts +19 -0
- package/dist/tsc/gvnr-browser/modules/lit-browser-client.d.ts +2 -0
- package/dist/tsc/gvnr-node/index.d.ts +1 -0
- package/dist/tsc/gvnr-node/modules/lit-node-client.d.ts +2 -0
- package/dist/tsc/index.d.ts +3 -0
- package/dist/tsc/interfaces/chunks/gvnr-wallet.i.d.ts +17 -0
- package/dist/tsc/interfaces/chunks/lit-agnostic-client.i.d.ts +5 -0
- package/dist/tsc/interfaces/chunks/wallets-set.i.d.ts +6 -0
- package/dist/tsc/interfaces/index.d.ts +3 -0
- package/dist/tsc/node.d.ts +7 -0
- package/dist/tsc/tools/chunks/env.tools.d.ts +7 -0
- package/dist/tsc/tools/chunks/util.tools.d.ts +6 -0
- package/dist/tsc/tools/index.d.ts +2 -0
- package/package.json +37 -0
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is the entrypoint of browser builds.
|
|
3
|
+
* The code executes when loaded in a browser.
|
|
4
|
+
*/
|
|
5
|
+
import "./browser-init.js";
|
|
6
|
+
import * as gvnr from ".";
|
|
7
|
+
declare global {
|
|
8
|
+
interface Window {
|
|
9
|
+
gvnr: typeof gvnr;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export * from ".";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./chunks/accounts-set";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IContractWallet } from "@gvnrdao/contracts";
|
|
2
|
+
import { ContractTransactionResponse } from "ethers";
|
|
3
|
+
export declare const ChainWallets: {
|
|
4
|
+
getWallets: (onwerAddress: string) => Promise<IContractWallet[]>;
|
|
5
|
+
addWallet: (wallet: IContractWallet) => Promise<ContractTransactionResponse>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ISupportedChain } from "@gvnrdao/contracts";
|
|
2
|
+
import { PKPCosmosWallet } from "@lit-protocol/pkp-cosmos";
|
|
3
|
+
import { IGvnrWalletRecipe } from "../../../../interfaces";
|
|
4
|
+
import { GvnrWallet } from "./gvnr-wallet.class";
|
|
5
|
+
export declare class CosmosGvnrWallet extends GvnrWallet {
|
|
6
|
+
chain: ISupportedChain;
|
|
7
|
+
pkpWallet: PKPCosmosWallet;
|
|
8
|
+
constructor(recipe: IGvnrWalletRecipe);
|
|
9
|
+
getBalance(): Promise<bigint>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ISupportedChain } from "@gvnrdao/contracts";
|
|
2
|
+
import { PKPEthersWallet } from "@lit-protocol/pkp-ethers";
|
|
3
|
+
import { IGvnrWalletRecipe } from "../../../../interfaces";
|
|
4
|
+
import { GvnrWallet } from "./gvnr-wallet.class";
|
|
5
|
+
export declare class EthereumGvnrWallet extends GvnrWallet {
|
|
6
|
+
chain: ISupportedChain;
|
|
7
|
+
pkpWallet: PKPEthersWallet;
|
|
8
|
+
constructor(recipe: IGvnrWalletRecipe);
|
|
9
|
+
getBalance(): Promise<bigint>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IGvnrWalletRecipe, IGvnrWallet } from "../../../../interfaces";
|
|
2
|
+
import { ISupportedChain } from "@gvnrdao/contracts";
|
|
3
|
+
import { PKPClient } from "@lit-protocol/pkp-client";
|
|
4
|
+
import { PKPWallet } from "@lit-protocol/types";
|
|
5
|
+
export declare abstract class GvnrWallet implements IGvnrWallet {
|
|
6
|
+
ownerEthPublicKey: string;
|
|
7
|
+
pkpPublicKey: string;
|
|
8
|
+
pkpClient: PKPClient;
|
|
9
|
+
_chainPublicKey: string | undefined;
|
|
10
|
+
abstract chain: ISupportedChain;
|
|
11
|
+
abstract pkpWallet: PKPWallet;
|
|
12
|
+
constructor(recipe: IGvnrWalletRecipe);
|
|
13
|
+
getChainPublicKey(): Promise<string>;
|
|
14
|
+
abstract getBalance(): Promise<bigint>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./modules/gvnr-wallets";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PKPClient } from "@lit-protocol/pkp-client";
|
|
2
|
+
import { IWalletsSet, IGvnrWalletSetRecipe } from "../../../../interfaces";
|
|
3
|
+
import { ethers } from "ethers";
|
|
4
|
+
import { AuthMethod } from "@lit-protocol/types";
|
|
5
|
+
export declare const getPkpWalletsSet: (recipeSet: IGvnrWalletSetRecipe) => Promise<IWalletsSet>;
|
|
6
|
+
interface IGvnrWalletSetRequest {
|
|
7
|
+
signer: ethers.Signer;
|
|
8
|
+
pkpAuth: AuthMethod;
|
|
9
|
+
}
|
|
10
|
+
export declare const getWalletsSet: (request: IGvnrWalletSetRequest) => Promise<IWalletsSet>;
|
|
11
|
+
export declare const GvnrWallets: {
|
|
12
|
+
buildPkpClient: (signer: ethers.Signer, pkpPubKey: string) => Promise<PKPClient>;
|
|
13
|
+
buildAndSetPkpClient: (signer: ethers.Signer, pkpPubKey: string) => Promise<void>;
|
|
14
|
+
setPkpClient: (pkpClient: PKPClient) => void;
|
|
15
|
+
getWalletsSet: (request: IGvnrWalletSetRequest) => Promise<IWalletsSet>;
|
|
16
|
+
getPkpWalletsSet: (recipeSet: IGvnrWalletSetRecipe) => Promise<IWalletsSet>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ILitAgnosticClient } from "../../../interfaces";
|
|
2
|
+
export declare const Lit: {
|
|
3
|
+
setAgnosticClient: (client: ILitAgnosticClient) => void;
|
|
4
|
+
getLitAgnosticClient: () => Promise<ILitAgnosticClient>;
|
|
5
|
+
getLitClientBrowserNodeKind: () => Promise<"browser" | "node">;
|
|
6
|
+
getLitClient: () => Promise<unknown>;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SUPPORTED_GVNR_LIT_AUTHENTICATION_METHOD_NAMES: readonly ["EthWallet"];
|
package/dist/tsc/gvnr/modules/lit-auth/interfaces/chunks/gvnr-lit-authentication-method.i.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
import { AuthMethodType } from "@lit-protocol/constants";
|
|
3
|
+
import { SUPPORTED_GVNR_LIT_AUTHENTICATION_METHOD_NAMES } from "../../constants/chunks/supported-gvnr-lit-authentication-method-names.js";
|
|
4
|
+
export type IGvnrLitAuthenticationMethodName = (typeof SUPPORTED_GVNR_LIT_AUTHENTICATION_METHOD_NAMES)[number];
|
|
5
|
+
export interface IGvnrLitAuthenticationMethod {
|
|
6
|
+
name: IGvnrLitAuthenticationMethodName;
|
|
7
|
+
litAuthMethodType: AuthMethodType;
|
|
8
|
+
}
|
|
9
|
+
export interface IEthWalletAuthenticationMethod extends IGvnrLitAuthenticationMethod {
|
|
10
|
+
name: "EthWallet";
|
|
11
|
+
litAuthMethodType: AuthMethodType.EthWallet;
|
|
12
|
+
signer?: ethers.Signer;
|
|
13
|
+
}
|
|
14
|
+
export type ISupportedGvnrLitAuthenticationMethod = IEthWalletAuthenticationMethod;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./chunks/gvnr-lit-authentication-method.i";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseProvider, LitAuthClient } from "@lit-protocol/lit-auth-client";
|
|
2
|
+
import { AuthMethod, AuthenticationProps } from "@lit-protocol/types";
|
|
3
|
+
import { ISupportedGvnrLitAuthenticationMethod } from "..";
|
|
4
|
+
import { ethers } from "ethers";
|
|
5
|
+
/**
|
|
6
|
+
* Get auth method object by signing a message with an Ethereum wallet
|
|
7
|
+
*/
|
|
8
|
+
export declare function authenticateWithEthWallet<T extends ethers.Signer>(signer: T): Promise<AuthMethod>;
|
|
9
|
+
export declare const LitAuth: {
|
|
10
|
+
setLitAuthClient: (litAuthClient: LitAuthClient) => void;
|
|
11
|
+
getLitAuthClient: () => Promise<LitAuthClient>;
|
|
12
|
+
listSupportedAuthenticationMethods: () => ISupportedGvnrLitAuthenticationMethod[];
|
|
13
|
+
authenticate: (authDetails: {
|
|
14
|
+
authenticationMethod: ISupportedGvnrLitAuthenticationMethod;
|
|
15
|
+
}) => Promise<AuthMethod>;
|
|
16
|
+
getLitAuthProviderByAuthMethod: (authMethod: AuthMethod) => Promise<BaseProvider>;
|
|
17
|
+
getAuthContext: (signerWallet: ethers.Signer, pkpPublicKey: string) => Promise<AuthenticationProps>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AuthMethod, IRelayPKP } from "@lit-protocol/types";
|
|
2
|
+
export declare const listPKPs: (authMethod: AuthMethod) => Promise<IRelayPKP[]>;
|
|
3
|
+
export declare const newPKPWallet: (authMethod: AuthMethod) => Promise<IRelayPKP>;
|
|
4
|
+
export declare const LitPkp: {
|
|
5
|
+
listPKPs: (authMethod: AuthMethod) => Promise<IRelayPKP[]>;
|
|
6
|
+
newPKPWallet: (authMethod: AuthMethod) => Promise<IRelayPKP>;
|
|
7
|
+
getFirstOrNewPKP: (authMethod: AuthMethod) => Promise<IRelayPKP>;
|
|
8
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./modules/data";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { JsonRpcSigner } from "ethers";
|
|
2
|
+
interface Ethereum {
|
|
3
|
+
isMetaMask?: boolean;
|
|
4
|
+
request: (request: {
|
|
5
|
+
method: string;
|
|
6
|
+
params?: Array<any>;
|
|
7
|
+
}) => Promise<any>;
|
|
8
|
+
on?: (event: string, listener: (...args: any[]) => void) => void;
|
|
9
|
+
removeListener?: (event: string, listener: (...args: any[]) => void) => void;
|
|
10
|
+
}
|
|
11
|
+
declare global {
|
|
12
|
+
interface Window {
|
|
13
|
+
ethereum: Ethereum;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export declare const EthSigner: {
|
|
17
|
+
getEthSigner: () => Promise<JsonRpcSigner>;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./modules/lit-node-client";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ISupportedChain } from "@gvnrdao/contracts";
|
|
2
|
+
import { PKPClient } from "@lit-protocol/pkp-client";
|
|
3
|
+
export interface IGvnrWallet {
|
|
4
|
+
chain: ISupportedChain;
|
|
5
|
+
ownerEthPublicKey: string;
|
|
6
|
+
pkpPublicKey: string;
|
|
7
|
+
pkpClient: PKPClient;
|
|
8
|
+
getChainPublicKey: () => Promise<string>;
|
|
9
|
+
}
|
|
10
|
+
export interface IGvnrWalletSetRecipe {
|
|
11
|
+
ownerEthPublicKey: string;
|
|
12
|
+
pkpPublicKey: string;
|
|
13
|
+
pkpClient?: PKPClient;
|
|
14
|
+
}
|
|
15
|
+
export interface IGvnrWalletRecipe extends IGvnrWalletSetRecipe {
|
|
16
|
+
pkpClient: PKPClient;
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { EthereumGvnrWallet } from "../../gvnr/modules/gvnr-wallets/classes/ethereum-gvnr-wallet.class";
|
|
2
|
+
import { CosmosGvnrWallet } from "../../gvnr/modules/gvnr-wallets/classes/cosmos-gvnr-wallet.class";
|
|
3
|
+
export interface IWalletsSet {
|
|
4
|
+
ethereum: EthereumGvnrWallet;
|
|
5
|
+
cosmos: CosmosGvnrWallet;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type IFunction = () => boolean | void | null | undefined;
|
|
2
|
+
export declare const assert: (condition: boolean | IFunction, message: string) => void;
|
|
3
|
+
export declare const isNullOrUndefined: (value: unknown) => value is null | undefined;
|
|
4
|
+
export declare const highlightLog: (num: number) => void;
|
|
5
|
+
export declare const rest: (ms: number) => Promise<unknown>;
|
|
6
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gvnrdao/sdk-browser",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "GVNR SDK",
|
|
5
|
+
"author": "ssribeiro",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"license": "BSL-1.0",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"GVNR",
|
|
10
|
+
"blockchain",
|
|
11
|
+
"control",
|
|
12
|
+
"LIT",
|
|
13
|
+
"SDK"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": "= 20.16.0",
|
|
17
|
+
"npm": "= 10.8.1"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git://github.com/gvnrdao/sdk.git"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/browser.js",
|
|
24
|
+
"browser": "./dist/browser.js",
|
|
25
|
+
"types": "./dist/tsc/browser.d.ts",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@gvnrdao/contracts": "~0.1.1",
|
|
28
|
+
"@lit-protocol/auth-helpers": "^6.4.0",
|
|
29
|
+
"@lit-protocol/lit-auth-client": "~6.4.0",
|
|
30
|
+
"@lit-protocol/lit-node-client": "~6.4.0",
|
|
31
|
+
"@lit-protocol/pkp-client": "~6.4.0",
|
|
32
|
+
"@lit-protocol/types": "~6.4.0",
|
|
33
|
+
"@uniswap/sdk-core": "^5.3.1",
|
|
34
|
+
"ethers": "6.13.2",
|
|
35
|
+
"siwe": "~2.3.2"
|
|
36
|
+
}
|
|
37
|
+
}
|