@kheopskit/core 0.0.1-alpha.1 → 0.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @kheopskit/core
2
2
 
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`e1cebed`](https://github.com/kheopskit/kheopskit/commit/e1cebed92d303f041070e0ae146ee34d9eb717bd) Thanks [@0xKheops](https://github.com/0xKheops)! - refactor property names
8
+
9
+ - [`e1cebed`](https://github.com/kheopskit/kheopskit/commit/e1cebed92d303f041070e0ae146ee34d9eb717bd) Thanks [@0xKheops](https://github.com/0xKheops)! - initial alpha release
10
+
3
11
  ## 0.0.1-alpha.1
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,38 +1,57 @@
1
1
  import { Observable } from 'rxjs';
2
- import { EIP1193Provider } from 'viem';
2
+ import { AppKit } from '@reown/appkit/core';
3
+ import { AppKitNetwork } from '@reown/appkit/networks';
4
+ import { Metadata } from '@walletconnect/universal-provider';
3
5
  import { InjectedExtension, InjectedPolkadotAccount } from 'polkadot-api/pjs-signer';
4
-
5
- type WalletId = string;
6
+ import { EIP1193Provider, WalletClient, CustomTransport, Account } from 'viem';
6
7
 
7
8
  type WalletAccountId = string;
8
9
 
9
- type KheopskitStoreData = {
10
- autoReconnect?: WalletId[];
11
- };
10
+ type WalletId = string;
11
+
12
12
  type KheopskitConfig = {
13
- autoReconnect?: boolean;
13
+ autoReconnect: boolean;
14
14
  platforms: WalletPlatform[];
15
+ walletConnect?: {
16
+ projectId: string;
17
+ metadata: Metadata;
18
+ /** Defaults to wss://relay.walletconnect.com */
19
+ relayUrl?: string;
20
+ /**
21
+ * list of CAIP-13 ids of polkadot-sdk chains
22
+ * see https://docs.reown.com/advanced/multichain/polkadot/dapp-integration-guide#walletconnect-code%2Fcomponent-setup
23
+ */
24
+ networks: [AppKitNetwork, ...AppKitNetwork[]];
25
+ };
26
+ debug: boolean;
15
27
  };
16
- type PolkadotDisabledInjectedWallet = {
28
+ type PolkadotInjectedWallet = {
17
29
  id: WalletId;
18
30
  platform: "polkadot";
31
+ type: "injected";
19
32
  extensionId: string;
33
+ extension: InjectedExtension | undefined;
20
34
  name: string;
21
- isConnected: false;
35
+ icon: string;
36
+ isConnected: boolean;
22
37
  connect: () => Promise<void>;
38
+ disconnect: () => void;
23
39
  };
24
- type PolkadotEnabledInjectedWallet = {
40
+ type PolkadotAppKitWallet = {
25
41
  id: WalletId;
26
42
  platform: "polkadot";
27
- extensionId: string;
28
- extension: InjectedExtension;
43
+ type: "appKit";
44
+ appKit: AppKit;
29
45
  name: string;
30
- isConnected: true;
46
+ icon: string;
47
+ isConnected: boolean;
48
+ connect: () => Promise<void>;
31
49
  disconnect: () => void;
32
50
  };
33
- type PolkadotWallet = PolkadotDisabledInjectedWallet | PolkadotEnabledInjectedWallet;
34
- type EthereumWallet = {
51
+ type PolkadotWallet = PolkadotInjectedWallet | PolkadotAppKitWallet;
52
+ type EthereumInjectedWallet = {
35
53
  platform: "ethereum";
54
+ type: "injected";
36
55
  id: WalletId;
37
56
  providerId: string;
38
57
  provider: EIP1193Provider;
@@ -42,6 +61,18 @@ type EthereumWallet = {
42
61
  connect: () => Promise<void>;
43
62
  disconnect: () => void;
44
63
  };
64
+ type EthereumAppKitWallet = {
65
+ platform: "ethereum";
66
+ type: "appKit";
67
+ id: WalletId;
68
+ appKit: AppKit;
69
+ name: string;
70
+ icon: string;
71
+ isConnected: boolean;
72
+ connect: () => Promise<void>;
73
+ disconnect: () => void;
74
+ };
75
+ type EthereumWallet = EthereumInjectedWallet | EthereumAppKitWallet;
45
76
  type Wallet = PolkadotWallet | EthereumWallet;
46
77
  type WalletPlatform = Wallet["platform"];
47
78
  type PolkadotAccount = InjectedPolkadotAccount & {
@@ -53,7 +84,7 @@ type PolkadotAccount = InjectedPolkadotAccount & {
53
84
  type EthereumAccount = {
54
85
  id: WalletAccountId;
55
86
  platform: "ethereum";
56
- provider: EIP1193Provider;
87
+ client: WalletClient<CustomTransport, undefined, Account, undefined>;
57
88
  address: `0x${string}`;
58
89
  walletName: string;
59
90
  walletId: string;
@@ -61,9 +92,13 @@ type EthereumAccount = {
61
92
  };
62
93
  type WalletAccount = PolkadotAccount | EthereumAccount;
63
94
 
64
- declare const getKheopskit$: (config: KheopskitConfig) => Observable<{
95
+ type KheopskitState = {
65
96
  wallets: Wallet[];
66
97
  accounts: WalletAccount[];
67
- }>;
98
+ config: KheopskitConfig;
99
+ };
100
+ declare const getKheopskit$: (config?: Partial<KheopskitConfig>) => Observable<KheopskitState>;
101
+
102
+ declare const resolveConfig: (config: Partial<KheopskitConfig> | undefined) => KheopskitConfig;
68
103
 
69
- export { type EthereumAccount, type EthereumWallet, type KheopskitConfig, type KheopskitStoreData, type PolkadotAccount, type PolkadotDisabledInjectedWallet, type PolkadotEnabledInjectedWallet, type PolkadotWallet, type Wallet, type WalletAccount, type WalletPlatform, getKheopskit$ };
104
+ export { type EthereumAccount, type EthereumAppKitWallet, type EthereumInjectedWallet, type EthereumWallet, type KheopskitConfig, type KheopskitState, type PolkadotAccount, type PolkadotAppKitWallet, type PolkadotInjectedWallet, type PolkadotWallet, type Wallet, type WalletAccount, type WalletPlatform, getKheopskit$, resolveConfig };
package/dist/index.d.ts CHANGED
@@ -1,38 +1,57 @@
1
1
  import { Observable } from 'rxjs';
2
- import { EIP1193Provider } from 'viem';
2
+ import { AppKit } from '@reown/appkit/core';
3
+ import { AppKitNetwork } from '@reown/appkit/networks';
4
+ import { Metadata } from '@walletconnect/universal-provider';
3
5
  import { InjectedExtension, InjectedPolkadotAccount } from 'polkadot-api/pjs-signer';
4
-
5
- type WalletId = string;
6
+ import { EIP1193Provider, WalletClient, CustomTransport, Account } from 'viem';
6
7
 
7
8
  type WalletAccountId = string;
8
9
 
9
- type KheopskitStoreData = {
10
- autoReconnect?: WalletId[];
11
- };
10
+ type WalletId = string;
11
+
12
12
  type KheopskitConfig = {
13
- autoReconnect?: boolean;
13
+ autoReconnect: boolean;
14
14
  platforms: WalletPlatform[];
15
+ walletConnect?: {
16
+ projectId: string;
17
+ metadata: Metadata;
18
+ /** Defaults to wss://relay.walletconnect.com */
19
+ relayUrl?: string;
20
+ /**
21
+ * list of CAIP-13 ids of polkadot-sdk chains
22
+ * see https://docs.reown.com/advanced/multichain/polkadot/dapp-integration-guide#walletconnect-code%2Fcomponent-setup
23
+ */
24
+ networks: [AppKitNetwork, ...AppKitNetwork[]];
25
+ };
26
+ debug: boolean;
15
27
  };
16
- type PolkadotDisabledInjectedWallet = {
28
+ type PolkadotInjectedWallet = {
17
29
  id: WalletId;
18
30
  platform: "polkadot";
31
+ type: "injected";
19
32
  extensionId: string;
33
+ extension: InjectedExtension | undefined;
20
34
  name: string;
21
- isConnected: false;
35
+ icon: string;
36
+ isConnected: boolean;
22
37
  connect: () => Promise<void>;
38
+ disconnect: () => void;
23
39
  };
24
- type PolkadotEnabledInjectedWallet = {
40
+ type PolkadotAppKitWallet = {
25
41
  id: WalletId;
26
42
  platform: "polkadot";
27
- extensionId: string;
28
- extension: InjectedExtension;
43
+ type: "appKit";
44
+ appKit: AppKit;
29
45
  name: string;
30
- isConnected: true;
46
+ icon: string;
47
+ isConnected: boolean;
48
+ connect: () => Promise<void>;
31
49
  disconnect: () => void;
32
50
  };
33
- type PolkadotWallet = PolkadotDisabledInjectedWallet | PolkadotEnabledInjectedWallet;
34
- type EthereumWallet = {
51
+ type PolkadotWallet = PolkadotInjectedWallet | PolkadotAppKitWallet;
52
+ type EthereumInjectedWallet = {
35
53
  platform: "ethereum";
54
+ type: "injected";
36
55
  id: WalletId;
37
56
  providerId: string;
38
57
  provider: EIP1193Provider;
@@ -42,6 +61,18 @@ type EthereumWallet = {
42
61
  connect: () => Promise<void>;
43
62
  disconnect: () => void;
44
63
  };
64
+ type EthereumAppKitWallet = {
65
+ platform: "ethereum";
66
+ type: "appKit";
67
+ id: WalletId;
68
+ appKit: AppKit;
69
+ name: string;
70
+ icon: string;
71
+ isConnected: boolean;
72
+ connect: () => Promise<void>;
73
+ disconnect: () => void;
74
+ };
75
+ type EthereumWallet = EthereumInjectedWallet | EthereumAppKitWallet;
45
76
  type Wallet = PolkadotWallet | EthereumWallet;
46
77
  type WalletPlatform = Wallet["platform"];
47
78
  type PolkadotAccount = InjectedPolkadotAccount & {
@@ -53,7 +84,7 @@ type PolkadotAccount = InjectedPolkadotAccount & {
53
84
  type EthereumAccount = {
54
85
  id: WalletAccountId;
55
86
  platform: "ethereum";
56
- provider: EIP1193Provider;
87
+ client: WalletClient<CustomTransport, undefined, Account, undefined>;
57
88
  address: `0x${string}`;
58
89
  walletName: string;
59
90
  walletId: string;
@@ -61,9 +92,13 @@ type EthereumAccount = {
61
92
  };
62
93
  type WalletAccount = PolkadotAccount | EthereumAccount;
63
94
 
64
- declare const getKheopskit$: (config: KheopskitConfig) => Observable<{
95
+ type KheopskitState = {
65
96
  wallets: Wallet[];
66
97
  accounts: WalletAccount[];
67
- }>;
98
+ config: KheopskitConfig;
99
+ };
100
+ declare const getKheopskit$: (config?: Partial<KheopskitConfig>) => Observable<KheopskitState>;
101
+
102
+ declare const resolveConfig: (config: Partial<KheopskitConfig> | undefined) => KheopskitConfig;
68
103
 
69
- export { type EthereumAccount, type EthereumWallet, type KheopskitConfig, type KheopskitStoreData, type PolkadotAccount, type PolkadotDisabledInjectedWallet, type PolkadotEnabledInjectedWallet, type PolkadotWallet, type Wallet, type WalletAccount, type WalletPlatform, getKheopskit$ };
104
+ export { type EthereumAccount, type EthereumAppKitWallet, type EthereumInjectedWallet, type EthereumWallet, type KheopskitConfig, type KheopskitState, type PolkadotAccount, type PolkadotAppKitWallet, type PolkadotInjectedWallet, type PolkadotWallet, type Wallet, type WalletAccount, type WalletPlatform, getKheopskit$, resolveConfig };