@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.
@@ -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 };
@@ -1 +1 @@
1
- 'use strict';var clsx=require('clsx'),tailwindMerge=require('tailwind-merge');function f(...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 s(r,e){return e<=0?0:Math.min(100,Math.round(r/e*100))}function l(r){return r>=70?"bg-green-500":r>=30?"bg-yellow-500":"bg-red-500"}function c(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 m(){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=s;exports.cn=f;exports.detectPlatform=m;exports.formatDate=c;exports.formatTokens=a;exports.getBalanceColor=l;
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;
@@ -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 };
@@ -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 };
@@ -1 +1 @@
1
- import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function f(...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 s(r,e){return e<=0?0:Math.min(100,Math.round(r/e*100))}function l(r){return r>=70?"bg-green-500":r>=30?"bg-yellow-500":"bg-red-500"}function c(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 m(){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{s as calculateBalancePercentage,f as cn,m as detectPlatform,c as formatDate,a as formatTokens,l as getBalanceColor};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stacknet/keyutils",
3
- "version": "0.1.16",
3
+ "version": "0.1.20",
4
4
  "description": "Reusable components for buying and managing StackNet node keys",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",