kit-squared 0.0.3 → 0.0.5
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 +3 -3
- package/dist/index.d.ts +0 -1
- package/dist/index.js +9 -1
- package/dist/library/connectSchedule.d.ts +3 -6
- package/dist/library/connectSchedule.js +15 -4
- package/dist/library/wallet.js +1 -2
- package/package.json +1 -6
package/README.md
CHANGED
|
@@ -172,19 +172,19 @@ Kit² uses BigInts for dealing with integers, and will be accepted for all integ
|
|
|
172
172
|
|
|
173
173
|
However, since PDAs pack data in a very specific way when deriving the address, when adding integers as seeds for PDAs, use the following format:
|
|
174
174
|
```typescript
|
|
175
|
-
[value,
|
|
175
|
+
[value, integer_type]
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
so a `u16` with the value of `1234` would be passed as
|
|
179
179
|
```typescript
|
|
180
|
-
[1234n,
|
|
180
|
+
[1234n,"u16"]
|
|
181
181
|
```
|
|
182
182
|
|
|
183
183
|
_example_
|
|
184
184
|
```typescript
|
|
185
185
|
// Your PDA seeds are "user" and then the index of the user as a u32,
|
|
186
186
|
// and you want to get user 67
|
|
187
|
-
const address = await myProgram.pda(["user",[67n,
|
|
187
|
+
const address = await myProgram.pda(["user",[67n, "u32"]]);
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
Full details available in the [PDA section of the docs](https://github.com/AnAllergyToAnalogy/kit-squared/blob/main/docs/PDAs.md).
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,3 @@ export { transacting, TRANSACTION_STATE, transactionState, onTransaction, clearA
|
|
|
6
6
|
export * from "./library/utils.js";
|
|
7
7
|
export { walletState, walletInitial, walletConnecting, walletConnected, walletError, signer, myKey, me, myKeyString, isMe, getStoredWalletSelection, disconnectWallet, unmountWallet } from "./library/wallet.js";
|
|
8
8
|
export { availableWallets, selection, selectWallet, getWalletInfo, unmountTeardown, recheckWallets, } from "./library/walletSelection.js";
|
|
9
|
-
export { requestAndConnectWallet, visible, showPrompt, hidePrompt, } from "./components/walletSelectionComponent.js";
|
package/dist/index.js
CHANGED
|
@@ -12,4 +12,12 @@ export { transacting, TRANSACTION_STATE, transactionState, onTransaction, clearA
|
|
|
12
12
|
export * from "./library/utils.js";
|
|
13
13
|
export { walletState, walletInitial, walletConnecting, walletConnected, walletError, signer, myKey, me, myKeyString, isMe, getStoredWalletSelection, disconnectWallet, unmountWallet } from "./library/wallet.js";
|
|
14
14
|
export { availableWallets, selection, selectWallet, getWalletInfo, unmountTeardown, recheckWallets, } from "./library/walletSelection.js";
|
|
15
|
-
|
|
15
|
+
// Todo: Example Component
|
|
16
|
+
// export {
|
|
17
|
+
// requestAndConnectWallet,
|
|
18
|
+
// visible,
|
|
19
|
+
// showPrompt,
|
|
20
|
+
// hidePrompt,
|
|
21
|
+
// } from "./components/walletSelectionComponent.js";
|
|
22
|
+
//@ts-ignore
|
|
23
|
+
// export * as WalletSelection from "./WalletSelection.svelte";
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
+
import { type Callback } from "./utils.js";
|
|
1
2
|
export declare const connectIsScheduled: import("svelte/store").Writable<boolean>;
|
|
2
3
|
export declare const disconnectIsScheduled: import("svelte/store").Writable<boolean>;
|
|
3
4
|
type Action = "connect" | "disconnect";
|
|
4
5
|
export declare function scheduleConnect(action: Action): void;
|
|
5
|
-
export declare const onConnect: {
|
|
6
|
-
(callback: import("./utils.js").Callback): () => void;
|
|
7
|
-
trigger: (...args: any[]) => Promise<void>;
|
|
8
|
-
killAll: () => void;
|
|
9
|
-
};
|
|
10
6
|
export declare const onDisconnect: {
|
|
11
|
-
(callback:
|
|
7
|
+
(callback: Callback): () => void;
|
|
12
8
|
trigger: (...args: any[]) => Promise<void>;
|
|
13
9
|
killAll: () => void;
|
|
14
10
|
};
|
|
11
|
+
export declare const onConnect: (callback: Callback, fireImmediatelyIfAlreadyConnected?: boolean) => () => void;
|
|
15
12
|
export declare function startConnectSchedule(): void;
|
|
16
13
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { writable } from "svelte/store";
|
|
2
|
-
import { onWalletConnect, onWalletDisconnect } from "./wallet.js";
|
|
1
|
+
import { get, writable } from "svelte/store";
|
|
2
|
+
import { onWalletConnect, onWalletDisconnect, walletConnected } from "./wallet.js";
|
|
3
3
|
import { Event } from "./utils.js";
|
|
4
4
|
export const connectIsScheduled = writable(false);
|
|
5
5
|
export const disconnectIsScheduled = writable(false);
|
|
@@ -15,8 +15,19 @@ export function scheduleConnect(action) {
|
|
|
15
15
|
}
|
|
16
16
|
_checkSchedule();
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
const onConnectEvent = Event();
|
|
19
19
|
export const onDisconnect = Event();
|
|
20
|
+
//Special case where onConnects fire when they are registeredd if its already connected
|
|
21
|
+
export const onConnect = function (callback, fireImmediatelyIfAlreadyConnected = true) {
|
|
22
|
+
// if(connected){
|
|
23
|
+
if (get(walletConnected) && fireImmediatelyIfAlreadyConnected) {
|
|
24
|
+
callback();
|
|
25
|
+
}
|
|
26
|
+
return onConnectEvent(callback);
|
|
27
|
+
};
|
|
28
|
+
// export const onDisconnect = function(callback: Callback){
|
|
29
|
+
// if(disconnected)
|
|
30
|
+
// }
|
|
20
31
|
async function _checkSchedule(loopback = false) {
|
|
21
32
|
if (checkingQueue && !loopback)
|
|
22
33
|
return;
|
|
@@ -26,7 +37,7 @@ async function _checkSchedule(loopback = false) {
|
|
|
26
37
|
connectIsScheduled.set(connectQueue.includes("connect"));
|
|
27
38
|
disconnectIsScheduled.set(connectQueue.includes("disconnect"));
|
|
28
39
|
if (next === "connect") {
|
|
29
|
-
await
|
|
40
|
+
await onConnectEvent.trigger();
|
|
30
41
|
}
|
|
31
42
|
else if (next === "disconnect") {
|
|
32
43
|
await onDisconnect.trigger();
|
package/dist/library/wallet.js
CHANGED
|
@@ -160,7 +160,6 @@ export async function disconnectWallet() {
|
|
|
160
160
|
myKey = null;
|
|
161
161
|
me.set(null);
|
|
162
162
|
_setWalletState(INITIAL);
|
|
163
|
-
log("disconnected. triggering onWalletDisconnect");
|
|
164
163
|
onWalletDisconnect.trigger();
|
|
165
164
|
}
|
|
166
165
|
function _buildTransactionSendingSigner(_networkType) {
|
|
@@ -207,7 +206,7 @@ export function initialiseWallet() {
|
|
|
207
206
|
onSelectWallet(async () => {
|
|
208
207
|
if (!_selection || !_selection.wallet)
|
|
209
208
|
throw new Error("Wallet selection is null");
|
|
210
|
-
// They just specified which wallet they are gonna use it didn't connect. Connect is done else where
|
|
209
|
+
// They just specified which wallet they are gonna use, it didn't connect. Connect is done else where
|
|
211
210
|
// Connect wallet
|
|
212
211
|
await connectWallet(_selection.wallet.uiWallet);
|
|
213
212
|
signer = _buildTransactionSendingSigner(networkType);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kit-squared",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Solana Kit functionality with SvelteKit",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "AnAllergyToAnalogy",
|
|
@@ -30,12 +30,7 @@
|
|
|
30
30
|
".": {
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
32
32
|
"svelte": "./dist/index.js"
|
|
33
|
-
},
|
|
34
|
-
"./WalletSelection.svelte": {
|
|
35
|
-
"types": "./dist/WalletSelection.svelte.d.ts",
|
|
36
|
-
"svelte": "./dist/WalletSelection.svelte"
|
|
37
33
|
}
|
|
38
|
-
|
|
39
34
|
},
|
|
40
35
|
"peerDependencies": {
|
|
41
36
|
"svelte": "^5.0.0"
|