@ultraos/wallet-sdk 0.0.13 → 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.
@@ -0,0 +1,74 @@
1
+ # Ultra Wallet SDK
2
+
3
+ Ultra Wallet SDK provides an easy-to-use client for interacting with the Ultra blockchain wallet, either through the
4
+ browser extension or via a web fallback.
5
+
6
+ ## ✨ Features
7
+
8
+ - Automatically detects and uses the Ultra Wallet Extension if available.
9
+ - Falls back to a Web Wallet if the extension is not installed.
10
+ - Connect, sign messages, sign transactions, and initiate purchases with a simple API.
11
+ - Environment support: `mainnet`, `testnet`, or custom wallet URLs.
12
+
13
+ ## 📦 Installation
14
+
15
+ ```bash
16
+ npm install @ultraos/wallet-sdk
17
+ ```
18
+
19
+ or
20
+
21
+ ```bash
22
+ yarn add @ultraos/wallet-sdk
23
+ ```
24
+
25
+ ## 🚀 Usage
26
+
27
+ ```ts
28
+ import { UltraWalletSDK } from '@ultraos/wallet-sdk';
29
+
30
+ // Basic initialization (auto-detect extension or fallback to mainnet Web Wallet)
31
+ const ultra = new UltraWalletSDK();
32
+
33
+ // Optionally initialize with environment configuration
34
+ const ultraTestnet = new UltraWalletSDK({ environment: 'testnet' });
35
+
36
+ // Connect
37
+ await ultra.connect();
38
+
39
+ // Sign a message
40
+ const signature = await ultra.signMessage('message: Hello, Ultra!');
41
+
42
+ // Sign a transaction
43
+ await ultra.signTransaction({
44
+ contract: 'eosio.token',
45
+ action: 'transfer',
46
+ data: { from: 'user', to: 'receiver', quantity: '1.00000000 UOS', memo: '' },
47
+ authorizations: ['user@active'],
48
+ });
49
+ ```
50
+
51
+ ## ⚙️ Configuration
52
+
53
+ You can pass options during initialization:
54
+
55
+ ```ts
56
+ new UltraWalletSDK({
57
+ environment: 'testnet', // or 'mainnet', or provide custom URL
58
+ });
59
+ ```
60
+
61
+ ## 📚 API
62
+
63
+ ### Methods
64
+
65
+ - `connect(): Promise<ConnectResult>`
66
+ - `disconnect(): Promise<void>`
67
+ - `signMessage(message: string): Promise<string>`
68
+ - `signTransaction(transaction: BlockchainTransaction | BlockchainTransaction[]): Promise<SignTransactionResult>`
69
+ - `getChainId(): Promise<string>`
70
+ - `purchaseItem(itemType: PurchaseItemType, itemId: string): Promise<PurchaseItemResult>`
71
+
72
+ ---
73
+
74
+ Tests are run with [Jest](https://jestjs.io).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultraos/wallet-sdk",
3
- "version": "0.0.13",
3
+ "version": "0.1.0",
4
4
  "homepage": "https://developers.ultra.io",
5
5
  "dependencies": {
6
6
  "json-rpc-2.0": "^1.7.0",
@@ -10,5 +10,11 @@ export interface ConnectParams {
10
10
  * Optional referral code to associate with the connection request.
11
11
  */
12
12
  referralCode?: string;
13
+ /**
14
+ * A unique string used for identifying or authenticating a specific request or transaction.
15
+ * Typically utilized for security mechanisms, such as preventing replay attacks or ensuring the uniqueness of transactions.
16
+ * The nonce must be prefixed with 'message:', '0x' or 'UOSx'
17
+ */
18
+ nonce?: string;
13
19
  }
14
20
  //# sourceMappingURL=connect-params.interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connect-params.interface.d.ts","sourceRoot":"","sources":["../../../../../../libs/wallet-sdk/src/lib/interfaces/connect-params.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
1
+ {"version":3,"file":"connect-params.interface.d.ts","sourceRoot":"","sources":["../../../../../../libs/wallet-sdk/src/lib/interfaces/connect-params.interface.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"connect-params.interface.js","sourceRoot":"","sources":["../../../../../../libs/wallet-sdk/src/lib/interfaces/connect-params.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Optional parameters for establishing a connection with the Ultra Wallet.\n */\nexport interface ConnectParams {\n /**\n * If true, do not prompt the user for permissions; share account info only if Dapp is already trusted.\n */\n onlyIfTrusted?: boolean;\n /**\n * Optional referral code to associate with the connection request.\n */\n referralCode?: string;\n}\n"]}
1
+ {"version":3,"file":"connect-params.interface.js","sourceRoot":"","sources":["../../../../../../libs/wallet-sdk/src/lib/interfaces/connect-params.interface.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Optional parameters for establishing a connection with the Ultra Wallet.\n */\nexport interface ConnectParams {\n /**\n * If true, do not prompt the user for permissions; share account info only if Dapp is already trusted.\n */\n onlyIfTrusted?: boolean;\n /**\n * Optional referral code to associate with the connection request.\n */\n referralCode?: string;\n\n /**\n * A unique string used for identifying or authenticating a specific request or transaction.\n * Typically utilized for security mechanisms, such as preventing replay attacks or ensuring the uniqueness of transactions.\n * The nonce must be prefixed with 'message:', '0x' or 'UOSx'\n */\n nonce?: string;\n}\n"]}