@tuwaio/quasar-sdk 0.2.1 → 0.4.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/README.md +2 -2
- package/dist/cli.cjs +5 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -25,8 +25,8 @@ pnpm add @tuwaio/quasar-sdk @tuwaio/pulsar-core
|
|
|
25
25
|
|
|
26
26
|
| Import path | Provides | Peer dependencies |
|
|
27
27
|
| -------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
28
|
-
| `@tuwaio/quasar-sdk` | `Quasar`, `PulsarModule`, `QuasarSDKError`, the endpoint constants and types | `@tuwaio/pulsar-core` (>=0.
|
|
29
|
-
| `@tuwaio/quasar-sdk/react` | `preFlightTxCheck` | Also `@tuwaio/siwx-react` (>=0.
|
|
28
|
+
| `@tuwaio/quasar-sdk` | `Quasar`, `PulsarModule`, `QuasarSDKError`, the endpoint constants and types | `@tuwaio/pulsar-core` (>=0.9), for the transaction types |
|
|
29
|
+
| `@tuwaio/quasar-sdk/react` | `preFlightTxCheck` | Also `@tuwaio/siwx-react` (>=0.5, optional for the root) |
|
|
30
30
|
|
|
31
31
|
The root entry point imports neither React nor SIWX packages, so it runs in Node.js, Next.js Server Actions and route handlers, and Edge runtimes. Its HTTP client, `ofetch`, is a dependency.
|
|
32
32
|
|
package/dist/cli.cjs
CHANGED
|
@@ -48,7 +48,7 @@ var path = __toESM(require("path"), 1);
|
|
|
48
48
|
// package.json
|
|
49
49
|
var package_default = {
|
|
50
50
|
name: "@tuwaio/quasar-sdk",
|
|
51
|
-
version: "0.
|
|
51
|
+
version: "0.4.0",
|
|
52
52
|
private: false,
|
|
53
53
|
author: "Oleksandr Tkach",
|
|
54
54
|
license: "Apache-2.0",
|
|
@@ -122,8 +122,8 @@ var package_default = {
|
|
|
122
122
|
ofetch: "^1.5.1"
|
|
123
123
|
},
|
|
124
124
|
peerDependencies: {
|
|
125
|
-
"@tuwaio/pulsar-core": ">=0.
|
|
126
|
-
"@tuwaio/siwx-react": ">=0.
|
|
125
|
+
"@tuwaio/pulsar-core": ">=0.9",
|
|
126
|
+
"@tuwaio/siwx-react": ">=0.5"
|
|
127
127
|
},
|
|
128
128
|
peerDependenciesMeta: {
|
|
129
129
|
"@tuwaio/siwx-react": {
|
|
@@ -131,10 +131,10 @@ var package_default = {
|
|
|
131
131
|
}
|
|
132
132
|
},
|
|
133
133
|
devDependencies: {
|
|
134
|
-
"@tuwaio/pulsar-core": "^0.
|
|
134
|
+
"@tuwaio/pulsar-core": "^0.9.1",
|
|
135
135
|
tsup: "^8.5.1",
|
|
136
136
|
typescript: "6.0.3",
|
|
137
|
-
"@tuwaio/siwx-react": "^0.
|
|
137
|
+
"@tuwaio/siwx-react": "^0.6.0"
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var chunkNJH5FYLU_cjs=require('./chunk-NJH5FYLU.cjs'),ofetch=require('ofetch'),pulsarCore=require('@tuwaio/pulsar-core');var a=class extends Error{status;originalError;constructor(r,e,t){super(r),this.name="QuasarSDKError",this.status=e,this.originalError=t;}},o=class{secretKey;internalSecret;baseUrl;timeout;constructor(r){if(!r.secretKey)throw new Error("[Quasar SDK] Missing API Key. Provide the secretKey of your Quasar app (sk_live_ or sk_test_).");this.secretKey=r.secretKey,this.internalSecret=r.internalSecret,this.baseUrl=r.baseUrl||chunkNJH5FYLU_cjs.a,this.timeout=r.timeout||1e4;}async request(r,e={}){try{return await ofetch.ofetch(r,{baseURL:this.baseUrl,timeout:this.timeout,...e,headers:{"Content-Type":"application/json","x-tuwa-secret-key":this.secretKey,...this.internalSecret?{"x-internal-secret":this.internalSecret}:{},...e.headers}})}catch(t){throw this.buildError(t)}}buildError(r){let e=r,t=e.statusCode??e.response?.status,p=(e.data??e.response?._data)?.error??e.message??"Unknown Error";return (t===401||t===403)&&console.error("\u{1F6A8} [Quasar SDK] Auth Error. Check your Secret Key and scopes."),new a(`[Quasar SDK] Request Failed (${t}): ${p}`,t,e)}};var s=class{constructor(r){this.client=r;}async syncCreate(r,e){return this.client.request(chunkNJH5FYLU_cjs.b,{method:"POST",body:{...r,appName:e}})}async getHistory(r={}){return this.client.request(chunkNJH5FYLU_cjs.c,{method:"GET",query:{page:r.page??1,limit:r.limit??10,chainId:r.chainId,status:r.status,txKey:r.txKey,appName:r.appName,walletAddress:r.walletAddress}})}};var n=class{client;pulsar;constructor(r){this.client=new o(r),this.pulsar=new s(this.client);}};Object.defineProperty(exports,"BASE_API_URL",{enumerable:true,get:function(){return chunkNJH5FYLU_cjs.a}});Object.defineProperty(exports,"PULSAR_HISTORY_ENDPOINT",{enumerable:true,get:function(){return chunkNJH5FYLU_cjs.c}});Object.defineProperty(exports,"PULSAR_SYNC_ENDPOINT",{enumerable:true,get:function(){return chunkNJH5FYLU_cjs.b}});Object.defineProperty(exports,"TransactionStatus",{enumerable:true,get:function(){return pulsarCore.TransactionStatus}});Object.defineProperty(exports,"TransactionTracker",{enumerable:true,get:function(){return pulsarCore.TransactionTracker}});exports.PulsarModule=s;exports.Quasar=n;exports.QuasarSDKError=a;
|
|
1
|
+
'use strict';var chunkNJH5FYLU_cjs=require('./chunk-NJH5FYLU.cjs'),ofetch=require('ofetch'),pulsarCore=require('@tuwaio/pulsar-core');var a=class extends Error{status;originalError;constructor(r,e,t){super(r),this.name="QuasarSDKError",this.status=e,this.originalError=t;}},o=class{secretKey;internalSecret;baseUrl;timeout;constructor(r){if(!r.secretKey)throw new Error("[Quasar SDK] Missing API Key. Provide the secretKey of your Quasar app (sk_live_ or sk_test_).");this.secretKey=r.secretKey,this.internalSecret=r.internalSecret,this.baseUrl=r.baseUrl||chunkNJH5FYLU_cjs.a,this.timeout=r.timeout||1e4;}async request(r,e={}){try{return await ofetch.ofetch(r,{baseURL:this.baseUrl,timeout:this.timeout,...e,headers:{"Content-Type":"application/json","x-tuwa-secret-key":this.secretKey,...this.internalSecret?{"x-internal-secret":this.internalSecret}:{},...e.headers}})}catch(t){throw this.buildError(t)}}buildError(r){let e=r,t=e.statusCode??e.response?.status,p=(e.data??e.response?._data)?.error??e.message??"Unknown Error";return (t===401||t===403)&&console.error("\u{1F6A8} [Quasar SDK] Auth Error. Check your Secret Key and scopes."),new a(`[Quasar SDK] Request Failed (${t}): ${p}`,t,e)}};var s=class{constructor(r){this.client=r;}client;async syncCreate(r,e){return this.client.request(chunkNJH5FYLU_cjs.b,{method:"POST",body:{...r,appName:e}})}async getHistory(r={}){return this.client.request(chunkNJH5FYLU_cjs.c,{method:"GET",query:{page:r.page??1,limit:r.limit??10,chainId:r.chainId,status:r.status,txKey:r.txKey,appName:r.appName,walletAddress:r.walletAddress}})}};var n=class{client;pulsar;constructor(r){this.client=new o(r),this.pulsar=new s(this.client);}};Object.defineProperty(exports,"BASE_API_URL",{enumerable:true,get:function(){return chunkNJH5FYLU_cjs.a}});Object.defineProperty(exports,"PULSAR_HISTORY_ENDPOINT",{enumerable:true,get:function(){return chunkNJH5FYLU_cjs.c}});Object.defineProperty(exports,"PULSAR_SYNC_ENDPOINT",{enumerable:true,get:function(){return chunkNJH5FYLU_cjs.b}});Object.defineProperty(exports,"TransactionStatus",{enumerable:true,get:function(){return pulsarCore.TransactionStatus}});Object.defineProperty(exports,"TransactionTracker",{enumerable:true,get:function(){return pulsarCore.TransactionTracker}});exports.PulsarModule=s;exports.Quasar=n;exports.QuasarSDKError=a;
|
package/dist/index.d.cts
CHANGED
|
@@ -43,7 +43,12 @@ interface HistoryQuery {
|
|
|
43
43
|
page?: number;
|
|
44
44
|
/** Number of transactions per page. Defaults to `10`. */
|
|
45
45
|
limit?: number;
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Chain of the transactions: an EVM chain ID (`1`), or a Solana chain ID — the CAIP-2 chain ID with the genesis hash
|
|
48
|
+
* that Pulsar 0.9 saves (`'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'`, `SOLANA_CHAIN_IDS.mainnet` of
|
|
49
|
+
* `@tuwaio/orbit-core`) or `'solana:mainnet'`. The API matches a Solana cluster under both forms, so transactions
|
|
50
|
+
* synced by older Pulsar versions are found too.
|
|
51
|
+
*/
|
|
47
52
|
chainId?: string | number;
|
|
48
53
|
/** Final status of the transactions (`'Success'`, `'Failed'` or `'Replaced'`, see `TransactionStatus`). */
|
|
49
54
|
status?: string;
|
|
@@ -51,7 +56,7 @@ interface HistoryQuery {
|
|
|
51
56
|
txKey?: string;
|
|
52
57
|
/** Application name that was passed to {@link PulsarModule.syncCreate}. */
|
|
53
58
|
appName?: string;
|
|
54
|
-
/** Address of the wallet that sent the transactions. */
|
|
59
|
+
/** Address of the wallet that sent the transactions. EVM addresses match in any letter case, Solana addresses exactly. */
|
|
55
60
|
walletAddress?: string;
|
|
56
61
|
}
|
|
57
62
|
/**
|
|
@@ -203,8 +208,9 @@ declare class PulsarModule {
|
|
|
203
208
|
/**
|
|
204
209
|
* Reads the transactions of your app, newest first (`GET /v1/engine/pulsar/history`).
|
|
205
210
|
*
|
|
206
|
-
* @param query - Filters and pagination. `walletAddress`
|
|
207
|
-
*
|
|
211
|
+
* @param query - Filters and pagination. `walletAddress` matches EVM addresses in any letter case and Solana
|
|
212
|
+
* addresses exactly; a Solana `chainId` matches its cluster under both chain ID forms. The API returns at most 100
|
|
213
|
+
* transactions per page.
|
|
208
214
|
* @returns One page of transactions.
|
|
209
215
|
* @throws {QuasarSDKError} On an invalid key (401, 403), a timeout or a network error.
|
|
210
216
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,12 @@ interface HistoryQuery {
|
|
|
43
43
|
page?: number;
|
|
44
44
|
/** Number of transactions per page. Defaults to `10`. */
|
|
45
45
|
limit?: number;
|
|
46
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Chain of the transactions: an EVM chain ID (`1`), or a Solana chain ID — the CAIP-2 chain ID with the genesis hash
|
|
48
|
+
* that Pulsar 0.9 saves (`'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'`, `SOLANA_CHAIN_IDS.mainnet` of
|
|
49
|
+
* `@tuwaio/orbit-core`) or `'solana:mainnet'`. The API matches a Solana cluster under both forms, so transactions
|
|
50
|
+
* synced by older Pulsar versions are found too.
|
|
51
|
+
*/
|
|
47
52
|
chainId?: string | number;
|
|
48
53
|
/** Final status of the transactions (`'Success'`, `'Failed'` or `'Replaced'`, see `TransactionStatus`). */
|
|
49
54
|
status?: string;
|
|
@@ -51,7 +56,7 @@ interface HistoryQuery {
|
|
|
51
56
|
txKey?: string;
|
|
52
57
|
/** Application name that was passed to {@link PulsarModule.syncCreate}. */
|
|
53
58
|
appName?: string;
|
|
54
|
-
/** Address of the wallet that sent the transactions. */
|
|
59
|
+
/** Address of the wallet that sent the transactions. EVM addresses match in any letter case, Solana addresses exactly. */
|
|
55
60
|
walletAddress?: string;
|
|
56
61
|
}
|
|
57
62
|
/**
|
|
@@ -203,8 +208,9 @@ declare class PulsarModule {
|
|
|
203
208
|
/**
|
|
204
209
|
* Reads the transactions of your app, newest first (`GET /v1/engine/pulsar/history`).
|
|
205
210
|
*
|
|
206
|
-
* @param query - Filters and pagination. `walletAddress`
|
|
207
|
-
*
|
|
211
|
+
* @param query - Filters and pagination. `walletAddress` matches EVM addresses in any letter case and Solana
|
|
212
|
+
* addresses exactly; a Solana `chainId` matches its cluster under both chain ID forms. The API returns at most 100
|
|
213
|
+
* transactions per page.
|
|
208
214
|
* @returns One page of transactions.
|
|
209
215
|
* @throws {QuasarSDKError} On an invalid key (401, 403), a timeout or a network error.
|
|
210
216
|
*
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,c,a as a$1}from'./chunk-YPUBFZPR.js';export{a as BASE_API_URL,c as PULSAR_HISTORY_ENDPOINT,b as PULSAR_SYNC_ENDPOINT}from'./chunk-YPUBFZPR.js';import {ofetch}from'ofetch';export{TransactionStatus,TransactionTracker}from'@tuwaio/pulsar-core';var a=class extends Error{status;originalError;constructor(r,e,t){super(r),this.name="QuasarSDKError",this.status=e,this.originalError=t;}},o=class{secretKey;internalSecret;baseUrl;timeout;constructor(r){if(!r.secretKey)throw new Error("[Quasar SDK] Missing API Key. Provide the secretKey of your Quasar app (sk_live_ or sk_test_).");this.secretKey=r.secretKey,this.internalSecret=r.internalSecret,this.baseUrl=r.baseUrl||a$1,this.timeout=r.timeout||1e4;}async request(r,e={}){try{return await ofetch(r,{baseURL:this.baseUrl,timeout:this.timeout,...e,headers:{"Content-Type":"application/json","x-tuwa-secret-key":this.secretKey,...this.internalSecret?{"x-internal-secret":this.internalSecret}:{},...e.headers}})}catch(t){throw this.buildError(t)}}buildError(r){let e=r,t=e.statusCode??e.response?.status,p=(e.data??e.response?._data)?.error??e.message??"Unknown Error";return (t===401||t===403)&&console.error("\u{1F6A8} [Quasar SDK] Auth Error. Check your Secret Key and scopes."),new a(`[Quasar SDK] Request Failed (${t}): ${p}`,t,e)}};var s=class{constructor(r){this.client=r;}async syncCreate(r,e){return this.client.request(b,{method:"POST",body:{...r,appName:e}})}async getHistory(r={}){return this.client.request(c,{method:"GET",query:{page:r.page??1,limit:r.limit??10,chainId:r.chainId,status:r.status,txKey:r.txKey,appName:r.appName,walletAddress:r.walletAddress}})}};var n=class{client;pulsar;constructor(r){this.client=new o(r),this.pulsar=new s(this.client);}};export{s as PulsarModule,n as Quasar,a as QuasarSDKError};
|
|
1
|
+
import {b,c,a as a$1}from'./chunk-YPUBFZPR.js';export{a as BASE_API_URL,c as PULSAR_HISTORY_ENDPOINT,b as PULSAR_SYNC_ENDPOINT}from'./chunk-YPUBFZPR.js';import {ofetch}from'ofetch';export{TransactionStatus,TransactionTracker}from'@tuwaio/pulsar-core';var a=class extends Error{status;originalError;constructor(r,e,t){super(r),this.name="QuasarSDKError",this.status=e,this.originalError=t;}},o=class{secretKey;internalSecret;baseUrl;timeout;constructor(r){if(!r.secretKey)throw new Error("[Quasar SDK] Missing API Key. Provide the secretKey of your Quasar app (sk_live_ or sk_test_).");this.secretKey=r.secretKey,this.internalSecret=r.internalSecret,this.baseUrl=r.baseUrl||a$1,this.timeout=r.timeout||1e4;}async request(r,e={}){try{return await ofetch(r,{baseURL:this.baseUrl,timeout:this.timeout,...e,headers:{"Content-Type":"application/json","x-tuwa-secret-key":this.secretKey,...this.internalSecret?{"x-internal-secret":this.internalSecret}:{},...e.headers}})}catch(t){throw this.buildError(t)}}buildError(r){let e=r,t=e.statusCode??e.response?.status,p=(e.data??e.response?._data)?.error??e.message??"Unknown Error";return (t===401||t===403)&&console.error("\u{1F6A8} [Quasar SDK] Auth Error. Check your Secret Key and scopes."),new a(`[Quasar SDK] Request Failed (${t}): ${p}`,t,e)}};var s=class{constructor(r){this.client=r;}client;async syncCreate(r,e){return this.client.request(b,{method:"POST",body:{...r,appName:e}})}async getHistory(r={}){return this.client.request(c,{method:"GET",query:{page:r.page??1,limit:r.limit??10,chainId:r.chainId,status:r.status,txKey:r.txKey,appName:r.appName,walletAddress:r.walletAddress}})}};var n=class{client;pulsar;constructor(r){this.client=new o(r),this.pulsar=new s(this.client);}};export{s as PulsarModule,n as Quasar,a as QuasarSDKError};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/quasar-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"ofetch": "^1.5.1"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@tuwaio/pulsar-core": ">=0.
|
|
73
|
-
"@tuwaio/siwx-react": ">=0.
|
|
72
|
+
"@tuwaio/pulsar-core": ">=0.9",
|
|
73
|
+
"@tuwaio/siwx-react": ">=0.5"
|
|
74
74
|
},
|
|
75
75
|
"peerDependenciesMeta": {
|
|
76
76
|
"@tuwaio/siwx-react": {
|
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
|
-
"@tuwaio/pulsar-core": "^0.
|
|
81
|
+
"@tuwaio/pulsar-core": "^0.9.1",
|
|
82
82
|
"tsup": "^8.5.1",
|
|
83
83
|
"typescript": "6.0.3",
|
|
84
|
-
"@tuwaio/siwx-react": "^0.
|
|
84
|
+
"@tuwaio/siwx-react": "^0.6.0"
|
|
85
85
|
},
|
|
86
86
|
"scripts": {
|
|
87
87
|
"start": "tsup src/index.ts --watch",
|