@utexo/rgb-sdk 1.0.5 → 1.0.6
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/cli/README.md +1 -1
- package/cli/run.mjs +19 -2
- package/dist/index.cjs +591 -201
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +33 -31
- package/dist/index.d.ts +33 -31
- package/dist/index.mjs +591 -201
- package/dist/index.mjs.map +1 -1
- package/package.json +22 -6
package/dist/index.d.mts
CHANGED
|
@@ -499,11 +499,11 @@ interface AssetNIA {
|
|
|
499
499
|
*/
|
|
500
500
|
name: string;
|
|
501
501
|
/**
|
|
502
|
-
* @type {string}
|
|
502
|
+
* @type {string | null}
|
|
503
503
|
* @memberof AssetNIA
|
|
504
|
-
* @example asset details
|
|
504
|
+
* @example asset details (API may return null)
|
|
505
505
|
*/
|
|
506
|
-
details?: string;
|
|
506
|
+
details?: string | null;
|
|
507
507
|
/**
|
|
508
508
|
* @type {number}
|
|
509
509
|
* @memberof AssetNIA
|
|
@@ -534,10 +534,11 @@ interface AssetNIA {
|
|
|
534
534
|
*/
|
|
535
535
|
balance: Balance;
|
|
536
536
|
/**
|
|
537
|
-
* @type {Media}
|
|
537
|
+
* @type {Media | null}
|
|
538
538
|
* @memberof AssetNIA
|
|
539
|
+
* @example API may return null
|
|
539
540
|
*/
|
|
540
|
-
media?: Media;
|
|
541
|
+
media?: Media | null;
|
|
541
542
|
}
|
|
542
543
|
interface AssetIfa {
|
|
543
544
|
assetId: string;
|
|
@@ -1068,7 +1069,7 @@ declare class WalletManager implements IWalletManager {
|
|
|
1068
1069
|
private readonly dataDir;
|
|
1069
1070
|
constructor(params: WalletInitParams);
|
|
1070
1071
|
initialize(): Promise<void>;
|
|
1071
|
-
goOnline(
|
|
1072
|
+
goOnline(): Promise<void>;
|
|
1072
1073
|
/**
|
|
1073
1074
|
* Get wallet's extended public keys
|
|
1074
1075
|
*/
|
|
@@ -1183,7 +1184,7 @@ declare class WalletManager implements IWalletManager {
|
|
|
1183
1184
|
* @param mnemonic - Optional mnemonic for signing
|
|
1184
1185
|
*/
|
|
1185
1186
|
send(invoiceTransfer: SendAssetBeginRequestModel, mnemonic?: string): Promise<SendResult>;
|
|
1186
|
-
createUtxos({ upTo, num, size, feeRate }: {
|
|
1187
|
+
createUtxos({ upTo, num, size, feeRate, }: {
|
|
1187
1188
|
upTo?: boolean;
|
|
1188
1189
|
num?: number;
|
|
1189
1190
|
size?: number;
|
|
@@ -1465,13 +1466,13 @@ interface IUTEXOProtocol extends ILightningProtocol, IOnchainProtocol {
|
|
|
1465
1466
|
* Concrete implementations should override these methods.
|
|
1466
1467
|
*/
|
|
1467
1468
|
declare class LightningProtocol implements ILightningProtocol {
|
|
1468
|
-
createLightningInvoice(
|
|
1469
|
-
getLightningReceiveRequest(
|
|
1470
|
-
getLightningSendRequest(
|
|
1471
|
-
getLightningSendFeeEstimate(
|
|
1472
|
-
payLightningInvoiceBegin(
|
|
1473
|
-
payLightningInvoiceEnd(
|
|
1474
|
-
payLightningInvoice(
|
|
1469
|
+
createLightningInvoice(_params: CreateLightningInvoiceRequestModel): Promise<LightningReceiveRequest>;
|
|
1470
|
+
getLightningReceiveRequest(_id: string): Promise<TransferStatus | null>;
|
|
1471
|
+
getLightningSendRequest(_id: string): Promise<TransferStatus | null>;
|
|
1472
|
+
getLightningSendFeeEstimate(_params: GetLightningSendFeeEstimateRequestModel): Promise<number>;
|
|
1473
|
+
payLightningInvoiceBegin(_params: PayLightningInvoiceRequestModel): Promise<string>;
|
|
1474
|
+
payLightningInvoiceEnd(_params: SendAssetEndRequestModel): Promise<LightningSendRequest>;
|
|
1475
|
+
payLightningInvoice(_params: PayLightningInvoiceRequestModel, _mnemonic?: string): Promise<LightningSendRequest>;
|
|
1475
1476
|
listLightningPayments(): Promise<ListLightningPaymentsResponse>;
|
|
1476
1477
|
}
|
|
1477
1478
|
/**
|
|
@@ -1481,12 +1482,12 @@ declare class LightningProtocol implements ILightningProtocol {
|
|
|
1481
1482
|
* Concrete implementations should override these methods.
|
|
1482
1483
|
*/
|
|
1483
1484
|
declare class OnchainProtocol implements IOnchainProtocol {
|
|
1484
|
-
onchainReceive(
|
|
1485
|
-
onchainSendBegin(
|
|
1486
|
-
onchainSendEnd(
|
|
1487
|
-
onchainSend(
|
|
1488
|
-
getOnchainSendStatus(
|
|
1489
|
-
listOnchainTransfers(
|
|
1485
|
+
onchainReceive(_params: OnchainReceiveRequestModel): Promise<OnchainReceiveResponse>;
|
|
1486
|
+
onchainSendBegin(_params: OnchainSendRequestModel): Promise<string>;
|
|
1487
|
+
onchainSendEnd(_params: SendAssetEndRequestModel): Promise<OnchainSendResponse>;
|
|
1488
|
+
onchainSend(_params: OnchainSendRequestModel, _mnemonic?: string): Promise<OnchainSendResponse>;
|
|
1489
|
+
getOnchainSendStatus(_send_id: string): Promise<OnchainSendStatus | null>;
|
|
1490
|
+
listOnchainTransfers(_asset_id?: string): Promise<Transfer[]>;
|
|
1490
1491
|
}
|
|
1491
1492
|
/**
|
|
1492
1493
|
* UTEXO Protocol Base Class
|
|
@@ -1571,14 +1572,15 @@ declare const utexoNetworkMap: UtxoNetworkMap;
|
|
|
1571
1572
|
* @deprecated Use getUtxoNetworkConfig('testnet') or getUtxoNetworkConfig('mainnet') instead
|
|
1572
1573
|
*/
|
|
1573
1574
|
declare const utexoNetworkIdMap: UtxoNetworkIdMap;
|
|
1574
|
-
|
|
1575
|
-
type
|
|
1576
|
-
type UtxoNetworkId = keyof typeof networkConfigs;
|
|
1575
|
+
type NetworkAsset = (typeof utexoNetworkIdMap)[keyof typeof utexoNetworkIdMap]['assets'][number];
|
|
1576
|
+
type UtxoNetworkId = keyof typeof utexoNetworkIdMap;
|
|
1577
1577
|
/**
|
|
1578
1578
|
* Resolves the destination network's asset object from sender network, destination network, and sender asset ID.
|
|
1579
1579
|
* Uses tokenId as the cross-network identifier (same tokenId = same logical asset).
|
|
1580
|
+
*
|
|
1581
|
+
* @param networkIdMap - Optional. When provided (e.g. from wallet's preset), uses this config. Otherwise uses deprecated testnet preset.
|
|
1580
1582
|
*/
|
|
1581
|
-
declare function getDestinationAsset(senderNetwork: UtxoNetworkId, destinationNetwork: UtxoNetworkId, assetIdSender: string | null): NetworkAsset | undefined;
|
|
1583
|
+
declare function getDestinationAsset(senderNetwork: UtxoNetworkId, destinationNetwork: UtxoNetworkId, assetIdSender: string | null, networkIdMap?: UtxoNetworkIdMap): NetworkAsset | undefined;
|
|
1582
1584
|
|
|
1583
1585
|
/**
|
|
1584
1586
|
* UTEXOWallet constructor and runtime options.
|
|
@@ -1653,7 +1655,7 @@ declare class UTEXOWallet extends UTEXOProtocol implements IWalletManager, IUTEX
|
|
|
1653
1655
|
* @throws {WalletError} if wallet is not initialized
|
|
1654
1656
|
*/
|
|
1655
1657
|
private ensureInitialized;
|
|
1656
|
-
goOnline(
|
|
1658
|
+
goOnline(): Promise<void>;
|
|
1657
1659
|
getXpub(): {
|
|
1658
1660
|
xpubVan: string;
|
|
1659
1661
|
xpubCol: string;
|
|
@@ -1730,11 +1732,11 @@ declare class UTEXOWallet extends UTEXOProtocol implements IWalletManager, IUTEX
|
|
|
1730
1732
|
signMessage(message: string): Promise<string>;
|
|
1731
1733
|
verifyMessage(message: string, signature: string, accountXpub?: string): Promise<boolean>;
|
|
1732
1734
|
/**
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1735
|
+
* Validates that the wallet has sufficient spendable balance for the given asset and amount.
|
|
1736
|
+
* @param assetId - Asset ID to check balance for
|
|
1737
|
+
* @param amount - Required amount (in asset units)
|
|
1738
|
+
* @throws {ValidationError} If balance is not found or insufficient
|
|
1739
|
+
*/
|
|
1738
1740
|
validateBalance(assetId: string, amount: number): Promise<void>;
|
|
1739
1741
|
/**
|
|
1740
1742
|
* Extracts invoice data and destination asset from a bridge transfer.
|
|
@@ -1908,7 +1910,7 @@ declare class CryptoError extends SDKError {
|
|
|
1908
1910
|
* Configuration errors (missing or invalid configuration)
|
|
1909
1911
|
*/
|
|
1910
1912
|
declare class ConfigurationError extends SDKError {
|
|
1911
|
-
constructor(message: string,
|
|
1913
|
+
constructor(message: string, _field?: string);
|
|
1912
1914
|
}
|
|
1913
1915
|
/**
|
|
1914
1916
|
* Bad request errors (400) - Invalid request parameters or data
|
package/dist/index.d.ts
CHANGED
|
@@ -499,11 +499,11 @@ interface AssetNIA {
|
|
|
499
499
|
*/
|
|
500
500
|
name: string;
|
|
501
501
|
/**
|
|
502
|
-
* @type {string}
|
|
502
|
+
* @type {string | null}
|
|
503
503
|
* @memberof AssetNIA
|
|
504
|
-
* @example asset details
|
|
504
|
+
* @example asset details (API may return null)
|
|
505
505
|
*/
|
|
506
|
-
details?: string;
|
|
506
|
+
details?: string | null;
|
|
507
507
|
/**
|
|
508
508
|
* @type {number}
|
|
509
509
|
* @memberof AssetNIA
|
|
@@ -534,10 +534,11 @@ interface AssetNIA {
|
|
|
534
534
|
*/
|
|
535
535
|
balance: Balance;
|
|
536
536
|
/**
|
|
537
|
-
* @type {Media}
|
|
537
|
+
* @type {Media | null}
|
|
538
538
|
* @memberof AssetNIA
|
|
539
|
+
* @example API may return null
|
|
539
540
|
*/
|
|
540
|
-
media?: Media;
|
|
541
|
+
media?: Media | null;
|
|
541
542
|
}
|
|
542
543
|
interface AssetIfa {
|
|
543
544
|
assetId: string;
|
|
@@ -1068,7 +1069,7 @@ declare class WalletManager implements IWalletManager {
|
|
|
1068
1069
|
private readonly dataDir;
|
|
1069
1070
|
constructor(params: WalletInitParams);
|
|
1070
1071
|
initialize(): Promise<void>;
|
|
1071
|
-
goOnline(
|
|
1072
|
+
goOnline(): Promise<void>;
|
|
1072
1073
|
/**
|
|
1073
1074
|
* Get wallet's extended public keys
|
|
1074
1075
|
*/
|
|
@@ -1183,7 +1184,7 @@ declare class WalletManager implements IWalletManager {
|
|
|
1183
1184
|
* @param mnemonic - Optional mnemonic for signing
|
|
1184
1185
|
*/
|
|
1185
1186
|
send(invoiceTransfer: SendAssetBeginRequestModel, mnemonic?: string): Promise<SendResult>;
|
|
1186
|
-
createUtxos({ upTo, num, size, feeRate }: {
|
|
1187
|
+
createUtxos({ upTo, num, size, feeRate, }: {
|
|
1187
1188
|
upTo?: boolean;
|
|
1188
1189
|
num?: number;
|
|
1189
1190
|
size?: number;
|
|
@@ -1465,13 +1466,13 @@ interface IUTEXOProtocol extends ILightningProtocol, IOnchainProtocol {
|
|
|
1465
1466
|
* Concrete implementations should override these methods.
|
|
1466
1467
|
*/
|
|
1467
1468
|
declare class LightningProtocol implements ILightningProtocol {
|
|
1468
|
-
createLightningInvoice(
|
|
1469
|
-
getLightningReceiveRequest(
|
|
1470
|
-
getLightningSendRequest(
|
|
1471
|
-
getLightningSendFeeEstimate(
|
|
1472
|
-
payLightningInvoiceBegin(
|
|
1473
|
-
payLightningInvoiceEnd(
|
|
1474
|
-
payLightningInvoice(
|
|
1469
|
+
createLightningInvoice(_params: CreateLightningInvoiceRequestModel): Promise<LightningReceiveRequest>;
|
|
1470
|
+
getLightningReceiveRequest(_id: string): Promise<TransferStatus | null>;
|
|
1471
|
+
getLightningSendRequest(_id: string): Promise<TransferStatus | null>;
|
|
1472
|
+
getLightningSendFeeEstimate(_params: GetLightningSendFeeEstimateRequestModel): Promise<number>;
|
|
1473
|
+
payLightningInvoiceBegin(_params: PayLightningInvoiceRequestModel): Promise<string>;
|
|
1474
|
+
payLightningInvoiceEnd(_params: SendAssetEndRequestModel): Promise<LightningSendRequest>;
|
|
1475
|
+
payLightningInvoice(_params: PayLightningInvoiceRequestModel, _mnemonic?: string): Promise<LightningSendRequest>;
|
|
1475
1476
|
listLightningPayments(): Promise<ListLightningPaymentsResponse>;
|
|
1476
1477
|
}
|
|
1477
1478
|
/**
|
|
@@ -1481,12 +1482,12 @@ declare class LightningProtocol implements ILightningProtocol {
|
|
|
1481
1482
|
* Concrete implementations should override these methods.
|
|
1482
1483
|
*/
|
|
1483
1484
|
declare class OnchainProtocol implements IOnchainProtocol {
|
|
1484
|
-
onchainReceive(
|
|
1485
|
-
onchainSendBegin(
|
|
1486
|
-
onchainSendEnd(
|
|
1487
|
-
onchainSend(
|
|
1488
|
-
getOnchainSendStatus(
|
|
1489
|
-
listOnchainTransfers(
|
|
1485
|
+
onchainReceive(_params: OnchainReceiveRequestModel): Promise<OnchainReceiveResponse>;
|
|
1486
|
+
onchainSendBegin(_params: OnchainSendRequestModel): Promise<string>;
|
|
1487
|
+
onchainSendEnd(_params: SendAssetEndRequestModel): Promise<OnchainSendResponse>;
|
|
1488
|
+
onchainSend(_params: OnchainSendRequestModel, _mnemonic?: string): Promise<OnchainSendResponse>;
|
|
1489
|
+
getOnchainSendStatus(_send_id: string): Promise<OnchainSendStatus | null>;
|
|
1490
|
+
listOnchainTransfers(_asset_id?: string): Promise<Transfer[]>;
|
|
1490
1491
|
}
|
|
1491
1492
|
/**
|
|
1492
1493
|
* UTEXO Protocol Base Class
|
|
@@ -1571,14 +1572,15 @@ declare const utexoNetworkMap: UtxoNetworkMap;
|
|
|
1571
1572
|
* @deprecated Use getUtxoNetworkConfig('testnet') or getUtxoNetworkConfig('mainnet') instead
|
|
1572
1573
|
*/
|
|
1573
1574
|
declare const utexoNetworkIdMap: UtxoNetworkIdMap;
|
|
1574
|
-
|
|
1575
|
-
type
|
|
1576
|
-
type UtxoNetworkId = keyof typeof networkConfigs;
|
|
1575
|
+
type NetworkAsset = (typeof utexoNetworkIdMap)[keyof typeof utexoNetworkIdMap]['assets'][number];
|
|
1576
|
+
type UtxoNetworkId = keyof typeof utexoNetworkIdMap;
|
|
1577
1577
|
/**
|
|
1578
1578
|
* Resolves the destination network's asset object from sender network, destination network, and sender asset ID.
|
|
1579
1579
|
* Uses tokenId as the cross-network identifier (same tokenId = same logical asset).
|
|
1580
|
+
*
|
|
1581
|
+
* @param networkIdMap - Optional. When provided (e.g. from wallet's preset), uses this config. Otherwise uses deprecated testnet preset.
|
|
1580
1582
|
*/
|
|
1581
|
-
declare function getDestinationAsset(senderNetwork: UtxoNetworkId, destinationNetwork: UtxoNetworkId, assetIdSender: string | null): NetworkAsset | undefined;
|
|
1583
|
+
declare function getDestinationAsset(senderNetwork: UtxoNetworkId, destinationNetwork: UtxoNetworkId, assetIdSender: string | null, networkIdMap?: UtxoNetworkIdMap): NetworkAsset | undefined;
|
|
1582
1584
|
|
|
1583
1585
|
/**
|
|
1584
1586
|
* UTEXOWallet constructor and runtime options.
|
|
@@ -1653,7 +1655,7 @@ declare class UTEXOWallet extends UTEXOProtocol implements IWalletManager, IUTEX
|
|
|
1653
1655
|
* @throws {WalletError} if wallet is not initialized
|
|
1654
1656
|
*/
|
|
1655
1657
|
private ensureInitialized;
|
|
1656
|
-
goOnline(
|
|
1658
|
+
goOnline(): Promise<void>;
|
|
1657
1659
|
getXpub(): {
|
|
1658
1660
|
xpubVan: string;
|
|
1659
1661
|
xpubCol: string;
|
|
@@ -1730,11 +1732,11 @@ declare class UTEXOWallet extends UTEXOProtocol implements IWalletManager, IUTEX
|
|
|
1730
1732
|
signMessage(message: string): Promise<string>;
|
|
1731
1733
|
verifyMessage(message: string, signature: string, accountXpub?: string): Promise<boolean>;
|
|
1732
1734
|
/**
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1735
|
+
* Validates that the wallet has sufficient spendable balance for the given asset and amount.
|
|
1736
|
+
* @param assetId - Asset ID to check balance for
|
|
1737
|
+
* @param amount - Required amount (in asset units)
|
|
1738
|
+
* @throws {ValidationError} If balance is not found or insufficient
|
|
1739
|
+
*/
|
|
1738
1740
|
validateBalance(assetId: string, amount: number): Promise<void>;
|
|
1739
1741
|
/**
|
|
1740
1742
|
* Extracts invoice data and destination asset from a bridge transfer.
|
|
@@ -1908,7 +1910,7 @@ declare class CryptoError extends SDKError {
|
|
|
1908
1910
|
* Configuration errors (missing or invalid configuration)
|
|
1909
1911
|
*/
|
|
1910
1912
|
declare class ConfigurationError extends SDKError {
|
|
1911
|
-
constructor(message: string,
|
|
1913
|
+
constructor(message: string, _field?: string);
|
|
1912
1914
|
}
|
|
1913
1915
|
/**
|
|
1914
1916
|
* Bad request errors (400) - Invalid request parameters or data
|