kit-squared 0.1.3 → 0.2.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.
@@ -1,7 +1,8 @@
1
1
  import { type Address } from "@solana/kit";
2
2
  export declare const ZERO_ADDRESS = "11111111111111111111111111111111";
3
3
  export declare function integerTypeToSize(type: string): string;
4
- export declare function isIntergerType(type: string): boolean;
4
+ export declare function isIntegerType(type: string): boolean;
5
+ export declare function isNumberType(type: string): boolean;
5
6
  export declare const typeEncoder: {
6
7
  [key: string]: any;
7
8
  };
@@ -5,7 +5,7 @@ export const ZERO_ADDRESS = "11111111111111111111111111111111";
5
5
  export function integerTypeToSize(type) {
6
6
  return type.substring(1);
7
7
  }
8
- export function isIntergerType(type) {
8
+ export function isIntegerType(type) {
9
9
  const types = ["isize", "usize"];
10
10
  for (let i = 0; i < 8; i++) {
11
11
  const s = 8 * (2 ** i);
@@ -14,6 +14,10 @@ export function isIntergerType(type) {
14
14
  }
15
15
  return types.includes(type);
16
16
  }
17
+ export function isNumberType(type) {
18
+ const types = ["f32", "f64"];
19
+ return types.includes(type) || isIntegerType(type);
20
+ }
17
21
  // Encoders
18
22
  // export const typeEncoder = (()=>{
19
23
  // //TODO: types probably not complete
@@ -33,7 +37,7 @@ export function isIntergerType(type) {
33
37
  // return e;
34
38
  // })();
35
39
  export const typeEncoder = (() => {
36
- const types = ["Address"];
40
+ const types = ["Address", "f32", "f64"];
37
41
  for (let i = 0; i < 5; i++) {
38
42
  const s = 8 * (2 ** i);
39
43
  types.push("U" + s);
@@ -154,8 +158,8 @@ export async function getPDA(seeds, programId) {
154
158
  }
155
159
  const value = seed[0];
156
160
  const t = seed[1];
157
- if (!isIntergerType(t)) {
158
- throw new Error("Not an integer type: " + t);
161
+ if (!isNumberType(t)) {
162
+ throw new Error("Not a valid number type: " + t);
159
163
  }
160
164
  seeds_parsed.push(typeEncoder[t].encode(value));
161
165
  // if(!isIntegerType)
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "kit-squared",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "description": "Solana Kit functionality with SvelteKit",
5
5
  "license": "ISC",
6
- "author": "AnAllergyToAnalogy",
6
+ "author": "AnAllergyToAnalogy",
7
7
  "scripts": {
8
8
  "dev": "vite dev",
9
9
  "build": "vite build && npm run prepack",
@@ -62,7 +62,6 @@
62
62
  "@wallet-standard/base": "^1.1.0",
63
63
  "@wallet-standard/features": "^1.1.0",
64
64
  "@wallet-standard/ui": "^1.0.1",
65
- "@wallet-standard/ui-registry": "^1.0.1",
66
- "buffer": "^6.0.3"
65
+ "@wallet-standard/ui-registry": "^1.0.1"
67
66
  }
68
67
  }