kit-squared 1.0.0 → 1.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.
@@ -25,9 +25,6 @@ export const onConnect = function (callback, fireImmediatelyIfAlreadyConnected =
25
25
  }
26
26
  return onConnectEvent(callback);
27
27
  };
28
- // export const onDisconnect = function(callback: Callback){
29
- // if(disconnected)
30
- // }
31
28
  async function _checkSchedule(loopback = false) {
32
29
  if (checkingQueue && !loopback)
33
30
  return;
@@ -6,7 +6,7 @@ export declare function isNumberType(type: string): boolean;
6
6
  export declare const typeEncoder: {
7
7
  [key: string]: any;
8
8
  };
9
- export declare function address(str: string): any;
9
+ export declare function encodeAddress(str: string): any;
10
10
  export declare function camelToSnake(name: string): string;
11
11
  export declare function snakeToCamel(name: string): string;
12
12
  export declare function pascalToCamel(name: string): string;
@@ -19,23 +19,6 @@ export function isNumberType(type) {
19
19
  return types.includes(type) || isIntegerType(type);
20
20
  }
21
21
  // Encoders
22
- // export const typeEncoder = (()=>{
23
- // //TODO: types probably not complete
24
- //
25
- // // const types = ["isize","usize"];
26
- // const types = ["Address"];
27
- // for(let i = 0; i < 8; i++){
28
- // const s = 8 * (2 ** i);
29
- // types.push("U"+s);
30
- // types.push("I"+s);
31
- // }
32
- // const e = {};
33
- // for(let T of types){
34
- // const t = pascalToCamel(T);
35
- // e[t] = kit[`get${T}Encoder`]();
36
- // }
37
- // return e;
38
- // })();
39
22
  export const typeEncoder = (() => {
40
23
  const types = ["Address", "F32", "F64"];
41
24
  for (let i = 0; i < 5; i++) {
@@ -43,7 +26,6 @@ export const typeEncoder = (() => {
43
26
  types.push("U" + s);
44
27
  types.push("I" + s);
45
28
  }
46
- // log(types);
47
29
  const e = {};
48
30
  for (let T of types) {
49
31
  const t = pascalToCamel(T);
@@ -53,7 +35,7 @@ export const typeEncoder = (() => {
53
35
  }
54
36
  return e;
55
37
  })();
56
- export function address(str) {
38
+ export function encodeAddress(str) {
57
39
  return typeEncoder.address.encode(str);
58
40
  }
59
41
  export function camelToSnake(name) {
@@ -110,9 +92,6 @@ export function EventSingle() {
110
92
  return onEvent;
111
93
  }
112
94
  export function Event() {
113
- // returns onEvent function,
114
- // this function returns another func which you use to unsubscribe from event
115
- // onEvent.triggger(..args) triggers the event
116
95
  let cid = 0;
117
96
  let callbacks = {};
118
97
  function onEvent(callback) {
@@ -162,7 +141,6 @@ export async function getPDA(seeds, programId) {
162
141
  throw new Error("Not a valid number type: " + t);
163
142
  }
164
143
  seeds_parsed.push(typeEncoder[t].encode(value));
165
- // if(!isIntegerType)
166
144
  }
167
145
  else {
168
146
  throw new Error("Unable to interpret seed: " + seed);
@@ -177,7 +155,6 @@ export async function getPDA(seeds, programId) {
177
155
  }
178
156
  export function lamportsToSol(lamports) {
179
157
  function _trimTail(str) {
180
- let clean = "";
181
158
  let i = str.indexOf(".");
182
159
  if (i === -1) {
183
160
  return str;
@@ -73,8 +73,6 @@ let walletWatchInterval = setInterval(async () => {
73
73
  else {
74
74
  // disconnect then reconnect
75
75
  console.error("This would be a disconnect then reconnect..");
76
- // log("Apparent address:",apparentAddress);
77
- // log("selected address:", selectedWalletAddress)
78
76
  const selectedWalletName = outputWallets[selectedWalletIndex].name;
79
77
  await disconnectWallet();
80
78
  await selectWallet(selectedWalletName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kit-squared",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Solana Kit functionality with SvelteKit",
5
5
  "license": "ISC",
6
6
  "author": "AnAllergyToAnalogy",