@learncard/core 1.4.0 → 2.0.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/core.cjs.development.js +15671 -2013
- package/dist/core.cjs.development.js.map +3 -3
- package/dist/core.cjs.production.min.js +163 -161
- package/dist/core.cjs.production.min.js.map +3 -3
- package/dist/core.d.ts +31 -19
- package/dist/core.esm.js +15672 -2014
- package/dist/core.esm.js.map +3 -3
- package/package.json +3 -1
package/dist/core.d.ts
CHANGED
@@ -4614,6 +4614,16 @@ export declare type DidKeyPluginMethods<DidMethod extends string> = {
|
|
4614
4614
|
};
|
4615
4615
|
getKey: () => string;
|
4616
4616
|
};
|
4617
|
+
export declare type EthereumPluginMethods = {
|
4618
|
+
checkMyEth: () => Promise<string>;
|
4619
|
+
checkMyDai: () => Promise<string>;
|
4620
|
+
checkMyUsdc: () => Promise<string>;
|
4621
|
+
};
|
4622
|
+
export declare type EthereumConfig = {
|
4623
|
+
address: string;
|
4624
|
+
infuraProjectId?: string;
|
4625
|
+
network?: providers.Networkish;
|
4626
|
+
};
|
4617
4627
|
export declare type IDXPluginMethods = {
|
4618
4628
|
getCredentialsListFromIndex: (alias?: string) => Promise<CredentialsList>;
|
4619
4629
|
publishContentToCeramic: (cred: any) => Promise<string>;
|
@@ -4653,31 +4663,20 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
4653
4663
|
export declare type Plugin<Name extends string, PublicMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4654
4664
|
name?: Name;
|
4655
4665
|
pluginMethods: {
|
4656
|
-
[Key in keyof PublicMethods]: <T extends
|
4666
|
+
[Key in keyof PublicMethods]: <T extends Wallet<any, PublicMethods>>(wallet: T, ...args: Parameters<PublicMethods[Key]>) => ReturnType<PublicMethods[Key]>;
|
4657
4667
|
};
|
4658
4668
|
};
|
4659
4669
|
export declare type PublicFieldsObj<PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = {
|
4660
4670
|
pluginMethods: PluginMethods;
|
4661
4671
|
};
|
4662
|
-
declare
|
4663
|
-
Locked = "LOCKED",
|
4664
|
-
Unlocked = "UNLOCKED"
|
4665
|
-
}
|
4666
|
-
export declare type BaseWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
|
4672
|
+
export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = PublicFieldsObj<PluginMethods> & {
|
4667
4673
|
contents: any[];
|
4668
4674
|
plugins: Plugin<PluginNames, Record<string, (...args: any[]) => any>>[];
|
4675
|
+
add: (content: any) => Promise<Wallet<PluginNames, PluginMethods>>;
|
4676
|
+
remove: (contentId: string) => Promise<Wallet<PluginNames, PluginMethods>>;
|
4677
|
+
addPlugin: <Name extends string, Methods extends Record<string, (...args: any[]) => any> = Record<never, never>>(plugin: Plugin<Name, Methods>) => Promise<Wallet<"" extends PluginNames ? Name : PluginNames | Name, Record<never, never> extends PluginMethods ? Methods : PluginMethods & Methods>>;
|
4669
4678
|
};
|
4670
|
-
export declare type
|
4671
|
-
status: WalletStatus.Locked;
|
4672
|
-
};
|
4673
|
-
export declare type UnlockedWallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = BaseWallet<PluginNames, PluginMethods> & {
|
4674
|
-
status: WalletStatus.Unlocked;
|
4675
|
-
add: (content: any) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
|
4676
|
-
remove: (contentId: string) => Promise<UnlockedWallet<PluginNames, PluginMethods>>;
|
4677
|
-
addPlugin: <Name extends string, Methods extends Record<string, (...args: any[]) => any> = Record<never, never>>(plugin: Plugin<Name, Methods>) => Promise<UnlockedWallet<"" extends PluginNames ? Name : PluginNames | Name, Record<never, never> extends PluginMethods ? Methods : PluginMethods & Methods>>;
|
4678
|
-
};
|
4679
|
-
export declare type Wallet<PluginNames extends string = "", PluginMethods extends Record<string, (...args: any[]) => any> = Record<never, never>> = LockedWallet<PluginNames, PluginMethods> | UnlockedWallet<PluginNames, PluginMethods>;
|
4680
|
-
export declare type LearnCardRawWallet = UnlockedWallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods>;
|
4679
|
+
export declare type LearnCardRawWallet = Wallet<"DIDKit" | "DID Key" | "VC" | "IDX" | "Expiration" | "Ethereum", DidKeyPluginMethods<DidMethod> & VCPluginMethods & IDXPluginMethods & EthereumPluginMethods>;
|
4681
4680
|
export declare type LearnCardWallet = {
|
4682
4681
|
/** Raw IoE wallet instance. You shouldn't need to drop down to this level! */
|
4683
4682
|
_wallet: LearnCardRawWallet;
|
@@ -4740,6 +4739,18 @@ export declare type LearnCardWallet = {
|
|
4740
4739
|
* You can use this to test out implementations that use this library!
|
4741
4740
|
*/
|
4742
4741
|
getTestVc: (subject?: string) => UnsignedVC;
|
4742
|
+
/**
|
4743
|
+
* Returns your ETH balance
|
4744
|
+
*/
|
4745
|
+
checkMyEth: () => Promise<string>;
|
4746
|
+
/**
|
4747
|
+
* Returns your DAI balance
|
4748
|
+
*/
|
4749
|
+
checkMyDai: () => Promise<string>;
|
4750
|
+
/**
|
4751
|
+
* Returns your USDC balance
|
4752
|
+
*/
|
4753
|
+
checkMyUsdc: () => Promise<string>;
|
4743
4754
|
};
|
4744
4755
|
export declare type CeramicIDXArgs = {
|
4745
4756
|
modelData: ModelAliases;
|
@@ -4751,10 +4762,11 @@ export declare type LearnCardConfig = {
|
|
4751
4762
|
ceramicIdx: CeramicIDXArgs;
|
4752
4763
|
didkit: InitInput | Promise<InitInput>;
|
4753
4764
|
defaultContents: any[];
|
4765
|
+
ethereumConfig: EthereumConfig;
|
4754
4766
|
};
|
4755
4767
|
/** Generates a LearnCard Wallet from a 64 character seed string */
|
4756
|
-
export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
|
4768
|
+
export declare const walletFromKey: (key: string, { ceramicIdx, didkit, defaultContents, ethereumConfig, }?: Partial<LearnCardConfig>) => Promise<LearnCardWallet>;
|
4757
4769
|
export { walletFromKey } from "@wallet/init";
|
4758
|
-
export { Wallet,
|
4770
|
+
export { Wallet, Plugin } from "types/wallet";
|
4759
4771
|
|
4760
4772
|
export {};
|