@bubolabs/wallet-wasm 0.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.
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@bubolabs/wallet-wasm",
3
+ "version": "0.1.0",
4
+ "description": "Browser WASM SDK for bubo wallet offline chain adapters",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "types": "index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./index.d.ts",
11
+ "default": "./index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "README.md",
16
+ "index.js",
17
+ "index.d.ts",
18
+ "pkg",
19
+ "pkg-cardano"
20
+ ],
21
+ "scripts": {
22
+ "build": "node ./scripts/build.mjs",
23
+ "build:dev": "node ./scripts/build.mjs --dev",
24
+ "dev:smoke": "vite --host 127.0.0.1 --port 4175",
25
+ "pack:dryrun": "npm pack --dry-run",
26
+ "smoke:browser": "node ./scripts/browser-smoke.mjs"
27
+ },
28
+ "license": "MIT OR Apache-2.0",
29
+ "devDependencies": {
30
+ "@playwright/test": "^1.60.0",
31
+ "vite": "^6.4.3",
32
+ "vite-plugin-wasm": "^3.5.0"
33
+ }
34
+ }
@@ -0,0 +1,192 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * A hash; the 32-byte output of a hashing algorithm.
6
+ *
7
+ * This struct is used most often in `solana-sdk` and related crates to contain
8
+ * a [SHA-256] hash, but may instead contain a [blake3] hash.
9
+ *
10
+ * [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
11
+ * [blake3]: https://github.com/BLAKE3-team/BLAKE3
12
+ */
13
+ export class Hash {
14
+ free(): void;
15
+ [Symbol.dispose](): void;
16
+ /**
17
+ * Create a new Hash object
18
+ *
19
+ * * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
20
+ */
21
+ constructor(value: any);
22
+ /**
23
+ * Checks if two `Hash`s are equal
24
+ */
25
+ equals(other: Hash): boolean;
26
+ /**
27
+ * Return the `Uint8Array` representation of the hash
28
+ */
29
+ toBytes(): Uint8Array;
30
+ /**
31
+ * Return the base58 string representation of the hash
32
+ */
33
+ toString(): string;
34
+ }
35
+
36
+ /**
37
+ * wasm-bindgen version of the Instruction struct.
38
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
39
+ * is fixed. This must not diverge from the regular non-wasm Instruction struct.
40
+ */
41
+ export class Instruction {
42
+ private constructor();
43
+ free(): void;
44
+ [Symbol.dispose](): void;
45
+ }
46
+
47
+ export class Instructions {
48
+ free(): void;
49
+ [Symbol.dispose](): void;
50
+ constructor();
51
+ push(instruction: Instruction): void;
52
+ }
53
+
54
+ /**
55
+ * A vanilla Ed25519 key pair
56
+ */
57
+ export class Keypair {
58
+ free(): void;
59
+ [Symbol.dispose](): void;
60
+ /**
61
+ * Create a new `Keypair `
62
+ */
63
+ constructor();
64
+ /**
65
+ * Recover a `Keypair` from a `Uint8Array`
66
+ */
67
+ static fromBytes(bytes: Uint8Array): Keypair;
68
+ /**
69
+ * Return the `Pubkey` for this `Keypair`
70
+ */
71
+ pubkey(): Pubkey;
72
+ /**
73
+ * Convert a `Keypair` to a `Uint8Array`
74
+ */
75
+ toBytes(): Uint8Array;
76
+ }
77
+
78
+ /**
79
+ * wasm-bindgen version of the Message struct.
80
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
81
+ * is fixed. This must not diverge from the regular non-wasm Message struct.
82
+ */
83
+ export class Message {
84
+ private constructor();
85
+ free(): void;
86
+ [Symbol.dispose](): void;
87
+ /**
88
+ * The id of a recent ledger entry.
89
+ */
90
+ recent_blockhash: Hash;
91
+ }
92
+
93
+ /**
94
+ * The address of a [Solana account][acc].
95
+ *
96
+ * Some account addresses are [ed25519] public keys, with corresponding secret
97
+ * keys that are managed off-chain. Often, though, account addresses do not
98
+ * have corresponding secret keys — as with [_program derived
99
+ * addresses_][pdas] — or the secret key is not relevant to the operation
100
+ * of a program, and may have even been disposed of. As running Solana programs
101
+ * can not safely create or manage secret keys, the full [`Keypair`] is not
102
+ * defined in `solana-program` but in `solana-sdk`.
103
+ *
104
+ * [acc]: https://solana.com/docs/core/accounts
105
+ * [ed25519]: https://ed25519.cr.yp.to/
106
+ * [pdas]: https://solana.com/docs/core/cpi#program-derived-addresses
107
+ * [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
108
+ */
109
+ export class Pubkey {
110
+ free(): void;
111
+ [Symbol.dispose](): void;
112
+ /**
113
+ * Create a new Pubkey object
114
+ *
115
+ * * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
116
+ */
117
+ constructor(value: any);
118
+ /**
119
+ * Checks if two `Pubkey`s are equal
120
+ */
121
+ equals(other: Pubkey): boolean;
122
+ /**
123
+ * Return the `Uint8Array` representation of the public key
124
+ */
125
+ toBytes(): Uint8Array;
126
+ /**
127
+ * Return the base58 string representation of the public key
128
+ */
129
+ toString(): string;
130
+ }
131
+
132
+ /**
133
+ * wasm-bindgen version of the Transaction struct.
134
+ * This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
135
+ * is fixed. This must not diverge from the regular non-wasm Transaction struct.
136
+ */
137
+ export class Transaction {
138
+ free(): void;
139
+ [Symbol.dispose](): void;
140
+ /**
141
+ * Create a new `Transaction`
142
+ */
143
+ constructor(instructions: Instructions, payer?: Pubkey | null);
144
+ static fromBytes(bytes: Uint8Array): Transaction;
145
+ isSigned(): boolean;
146
+ /**
147
+ * Return a message containing all data that should be signed.
148
+ */
149
+ message(): Message;
150
+ /**
151
+ * Return the serialized message data to sign.
152
+ */
153
+ messageData(): Uint8Array;
154
+ partialSign(keypair: Keypair, recent_blockhash: Hash): void;
155
+ toBytes(): Uint8Array;
156
+ /**
157
+ * Verify the transaction
158
+ */
159
+ verify(): void;
160
+ }
161
+
162
+ export function buildAndSign(request_json: string): Uint8Array;
163
+
164
+ export function buildAndSignFromPrivateKey(request_json: string): Uint8Array;
165
+
166
+ export function deriveAddress(request_json: string): string;
167
+
168
+ export function deriveAddressFromPrivateKey(request_json: string): string;
169
+
170
+ export function deriveWallet(request_json: string): string;
171
+
172
+ export function deriveWalletFromPrivateKey(request_json: string): string;
173
+
174
+ export function init(): void;
175
+
176
+ export function invokeChainExtension(chain_id: string, method: string, payload_json: string): string;
177
+
178
+ export function listChainExtensions(): string;
179
+
180
+ export function listSupportedChains(): string;
181
+
182
+ export function signBytes(request_json: string): Uint8Array;
183
+
184
+ export function signBytesFromPrivateKey(request_json: string): Uint8Array;
185
+
186
+ export function signMessage(request_json: string): Uint8Array;
187
+
188
+ export function signMessageFromPrivateKey(request_json: string): Uint8Array;
189
+
190
+ export function signTypedData(request_json: string): Uint8Array;
191
+
192
+ export function signTypedDataFromPrivateKey(request_json: string): Uint8Array;
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./bubo_wallet_wasm.d.ts" */
2
+
3
+ import * as wasm from "./bubo_wallet_wasm_bg.wasm";
4
+ import { __wbg_set_wasm } from "./bubo_wallet_wasm_bg.js";
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ Hash, Instruction, Instructions, Keypair, Message, Pubkey, SystemInstruction, Transaction, buildAndSign, buildAndSignFromPrivateKey, deriveAddress, deriveAddressFromPrivateKey, deriveWallet, deriveWalletFromPrivateKey, init, invokeChainExtension, listChainExtensions, listSupportedChains, signBytes, signBytesFromPrivateKey, signMessage, signMessageFromPrivateKey, signTypedData, signTypedDataFromPrivateKey
9
+ } from "./bubo_wallet_wasm_bg.js";