@stacknet/keyutils 0.1.16 → 0.1.20
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/dist/components/index.cjs +2 -2
- package/dist/components/index.d.cts +8 -2
- package/dist/components/index.d.ts +8 -2
- package/dist/components/index.js +2 -2
- package/dist/hooks/index.cjs +1 -1
- package/dist/hooks/index.d.cts +10 -2
- package/dist/hooks/index.d.ts +10 -2
- package/dist/hooks/index.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/types/index.d.cts +11 -2
- package/dist/types/index.d.ts +11 -2
- package/dist/utils/index.cjs +1 -1
- package/dist/utils/index.d.cts +4 -1
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -65,6 +65,12 @@ interface ListingResult {
|
|
|
65
65
|
currency: string;
|
|
66
66
|
status: string;
|
|
67
67
|
}
|
|
68
|
+
interface DirectTransferResult {
|
|
69
|
+
keyId: string;
|
|
70
|
+
fromUserId: string;
|
|
71
|
+
toUserId: string;
|
|
72
|
+
transferredAt: number;
|
|
73
|
+
}
|
|
68
74
|
type Platform = 'ios' | 'android' | 'windows' | 'mac' | 'linux';
|
|
69
75
|
interface PlatformDownload {
|
|
70
76
|
platform: Platform;
|
|
@@ -72,13 +78,15 @@ interface PlatformDownload {
|
|
|
72
78
|
url: string;
|
|
73
79
|
compatible: boolean;
|
|
74
80
|
}
|
|
75
|
-
type KeyWidgetTab = 'buy' | 'use' | 'sell';
|
|
81
|
+
type KeyWidgetTab = 'buy' | 'use' | 'sell' | 'transfer';
|
|
76
82
|
interface KeyUtilsConfig {
|
|
77
83
|
apiBaseUrl: string;
|
|
78
84
|
stackId?: string;
|
|
79
85
|
stackName?: string;
|
|
80
86
|
paymentMethods?: PaymentMethod[];
|
|
81
87
|
merchantWallet?: string;
|
|
88
|
+
protocolTreasuryWallet?: string;
|
|
89
|
+
protocolFeeBps?: number;
|
|
82
90
|
stripePublicKey?: string;
|
|
83
91
|
theme?: 'light' | 'dark' | 'system';
|
|
84
92
|
maxQuantity?: number;
|
|
@@ -94,6 +102,7 @@ interface KeyUtilsCallbacks {
|
|
|
94
102
|
onPaymentStart?: (method: PaymentMethod) => void;
|
|
95
103
|
onPaymentComplete?: (method: PaymentMethod, transactionId: string) => void;
|
|
96
104
|
onListingCreated?: (listing: ListingResult) => void;
|
|
105
|
+
onTransferComplete?: (result: DirectTransferResult) => void;
|
|
97
106
|
}
|
|
98
107
|
|
|
99
|
-
export type { KeyListing, KeyUtilsCallbacks, KeyUtilsConfig, KeyWidgetTab, LedgerEntry, ListingResult, MintResult, NodeKeyInfo, PaymentMethod, Platform, PlatformDownload, PricingInfo };
|
|
108
|
+
export type { DirectTransferResult, KeyListing, KeyUtilsCallbacks, KeyUtilsConfig, KeyWidgetTab, LedgerEntry, ListingResult, MintResult, NodeKeyInfo, PaymentMethod, Platform, PlatformDownload, PricingInfo };
|
package/dist/utils/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function
|
|
1
|
+
'use strict';var clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function n(){if(typeof document>"u")return {};let r=document.cookie.match(/(?:^|;\s*)__csrf=([^;]*)/);return r?{"x-csrf-token":r[1]}:{}}function c(...r){return tailwindMerge.twMerge(clsx.clsx(r))}function a(r){return r==null?"0":r>=1e9?`${(r/1e9).toFixed(1)}B`:r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:r.toLocaleString()}function l(r,e){return e<=0?0:Math.min(100,Math.round(r/e*100))}function d(r){return r>=70?"bg-green-500":r>=30?"bg-yellow-500":"bg-red-500"}function m(r){let e=typeof r=="string"&&/^\d+$/.test(r)?Number(r):r,t=new Date(e);return isNaN(t.getTime())?String(r):t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function p(){if(typeof navigator>"u")return "mac";let r=navigator.userAgent.toLowerCase();return /iphone|ipad|ipod/.test(r)?"ios":/android/.test(r)?"android":/win/.test(r)?"windows":/linux/.test(r)?"linux":"mac"}exports.calculateBalancePercentage=l;exports.cn=c;exports.csrfHeaders=n;exports.detectPlatform=p;exports.formatDate=m;exports.formatTokens=a;exports.getBalanceColor=d;
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import { Platform } from '../types/index.cjs';
|
|
3
3
|
|
|
4
|
+
/** Read __csrf cookie and return as x-csrf-token header for mutations */
|
|
5
|
+
declare function csrfHeaders(): Record<string, string>;
|
|
6
|
+
|
|
4
7
|
declare function cn(...inputs: ClassValue[]): string;
|
|
5
8
|
declare function formatTokens(amount: number | undefined | null): string;
|
|
6
9
|
declare function calculateBalancePercentage(current: number, max: number): number;
|
|
@@ -8,4 +11,4 @@ declare function getBalanceColor(percentage: number): string;
|
|
|
8
11
|
declare function formatDate(dateString: string | number): string;
|
|
9
12
|
declare function detectPlatform(): Platform;
|
|
10
13
|
|
|
11
|
-
export { calculateBalancePercentage, cn, detectPlatform, formatDate, formatTokens, getBalanceColor };
|
|
14
|
+
export { calculateBalancePercentage, cn, csrfHeaders, detectPlatform, formatDate, formatTokens, getBalanceColor };
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ClassValue } from 'clsx';
|
|
2
2
|
import { Platform } from '../types/index.js';
|
|
3
3
|
|
|
4
|
+
/** Read __csrf cookie and return as x-csrf-token header for mutations */
|
|
5
|
+
declare function csrfHeaders(): Record<string, string>;
|
|
6
|
+
|
|
4
7
|
declare function cn(...inputs: ClassValue[]): string;
|
|
5
8
|
declare function formatTokens(amount: number | undefined | null): string;
|
|
6
9
|
declare function calculateBalancePercentage(current: number, max: number): number;
|
|
@@ -8,4 +11,4 @@ declare function getBalanceColor(percentage: number): string;
|
|
|
8
11
|
declare function formatDate(dateString: string | number): string;
|
|
9
12
|
declare function detectPlatform(): Platform;
|
|
10
13
|
|
|
11
|
-
export { calculateBalancePercentage, cn, detectPlatform, formatDate, formatTokens, getBalanceColor };
|
|
14
|
+
export { calculateBalancePercentage, cn, csrfHeaders, detectPlatform, formatDate, formatTokens, getBalanceColor };
|
package/dist/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function
|
|
1
|
+
import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function n(){if(typeof document>"u")return {};let r=document.cookie.match(/(?:^|;\s*)__csrf=([^;]*)/);return r?{"x-csrf-token":r[1]}:{}}function c(...r){return twMerge(clsx(r))}function a(r){return r==null?"0":r>=1e9?`${(r/1e9).toFixed(1)}B`:r>=1e6?`${(r/1e6).toFixed(1)}M`:r>=1e3?`${(r/1e3).toFixed(1)}K`:r.toLocaleString()}function l(r,e){return e<=0?0:Math.min(100,Math.round(r/e*100))}function d(r){return r>=70?"bg-green-500":r>=30?"bg-yellow-500":"bg-red-500"}function m(r){let e=typeof r=="string"&&/^\d+$/.test(r)?Number(r):r,t=new Date(e);return isNaN(t.getTime())?String(r):t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function p(){if(typeof navigator>"u")return "mac";let r=navigator.userAgent.toLowerCase();return /iphone|ipad|ipod/.test(r)?"ios":/android/.test(r)?"android":/win/.test(r)?"windows":/linux/.test(r)?"linux":"mac"}export{l as calculateBalancePercentage,c as cn,n as csrfHeaders,p as detectPlatform,m as formatDate,a as formatTokens,d as getBalanceColor};
|