kit-squared 0.1.1 → 0.1.3

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 CHANGED
@@ -4,8 +4,6 @@
4
4
 
5
5
  Kit² provides wallet connection, transaction functionality (including helpers) and features such as account management as well as program helpers (interfaces) for Anchor programs. It uses `@wallet-standard` for dealing with wallets.
6
6
 
7
- This library is in development, in a pre-release state. If you stumble across it and find any issues, please let me know via [GitHub](https://github.com/anallergyToAnalogy/kit-squared).
8
-
9
7
  [Skip to Contents](#contents)
10
8
 
11
9
  [Skip to Example Project](https://github.com/AnAllergyToAnalogy/kit-squared/tree/main/example)
@@ -1,4 +1,3 @@
1
- let log = console.log;
2
1
  import { writable, derived } from "svelte/store";
3
2
  import { Event } from "./utils.js";
4
3
  import { getNetworkType } from "./connection.js";
@@ -74,21 +73,12 @@ function uiWalletAccountsAreSame(a, b) {
74
73
  return underlyingWalletA === underlyingWalletB;
75
74
  }
76
75
  async function connectWallet(uiWallet) {
77
- // log("===---===---===")
78
- // log("connect ui wallet", uiWallet);
79
76
  _setWalletState(CONNECTING);
80
- // Get some sorta thing
81
77
  const wallet = getWalletForHandle_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(uiWallet);
82
- // log(2)
83
- // log(wallet);
84
78
  // Accounts that are available?
85
79
  const existingAccounts = [...uiWallet.accounts];
86
- // log(3)
87
- // log(existingAccounts);
88
80
  // Do some stuff to get the ability to connect
89
81
  const connectFeature = getWalletFeature(uiWallet, StandardConnect);
90
- // log(4)
91
- // log(connectFeature)
92
82
  // Wallet accounts for all the wallets in this connected one maybe
93
83
  const accountsPromise = connectFeature
94
84
  .connect()
@@ -97,51 +87,29 @@ async function connectWallet(uiWallet) {
97
87
  // return accounts;
98
88
  return accounts.map(getOrCreateUiWalletAccountForStandardWalletAccount_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.bind(null, wallet));
99
89
  });
100
- // log(5)
101
- // log(accountsPromise);
102
- // I don't know whhy this is called nextAccounts. Some other layer of wallet type.
103
90
  const nextAccounts = await accountsPromise;
104
- // console.log("next accounts", nextAccounts);
105
- // log(6)
106
- // log(nextAccounts)
107
91
  // Just set connectedWallet
108
92
  connectedWallet = uiWallet;
109
93
  hasConnectedWallet.set(true);
110
- //TODO: not sure what this is doing
111
94
  // Try to choose the first never-before-seen account. Gonna assume this is the right move for now
112
95
  for (const nextAccount of nextAccounts) {
113
96
  if (!existingAccounts.some((existingAccount) => uiWalletAccountsAreSame(nextAccount, existingAccount))) {
114
- // onAccountSelect(nextAccount);
115
- // console.error("Found not seen account, set as connectedWalletAccount");
116
97
  connectedWalletAccount = nextAccount;
117
98
  hasConnectedWalletAccount.set(true);
118
99
  _setWalletState(CONNECTED);
119
- // localStorage.setItem(
120
- // STORAGE_KEY,
121
- // `${wallet.name}:${connectedWalletAccount.address}`,
122
- // );
123
- // console.log("compare accounts", connectedWalletAccount);
124
100
  return;
125
101
  }
126
102
  }
127
103
  if (nextAccounts.length > 0) {
128
- // onAccountSelect(nextAccounts[0]);
129
- // console.error("Fallback to just using the first one available")
130
104
  connectedWalletAccount = nextAccounts[0];
131
105
  hasConnectedWalletAccount.set(true);
132
106
  _setWalletState(CONNECTED);
133
- // localStorage.setItem(
134
- // STORAGE_KEY,
135
- // `${wallet.name}:${connectedWalletAccount.address}`,
136
- // );
137
- // console.log("default accounts", connectedWalletAccount);
138
107
  return;
139
108
  }
140
109
  console.error("No available wallets found for unspecified reason");
141
110
  _setWalletState(INITIAL);
142
111
  }
143
112
  export async function disconnectWallet() {
144
- log("disconnect wallet..");
145
113
  clearStoredWalletSelection();
146
114
  clearSelectedVars();
147
115
  if (!connectedWallet) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kit-squared",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Solana Kit functionality with SvelteKit",
5
5
  "license": "ISC",
6
6
  "author": "AnAllergyToAnalogy",