@hazbase/simplicity 0.4.0 → 0.4.1

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 CHANGED
@@ -152,6 +152,18 @@ Main entrypoints:
152
152
  Representative example:
153
153
  - [show-receivable-business-flow.ts](./examples/show-receivable-business-flow.ts)
154
154
 
155
+ ### RWA DvP and Liquid x402
156
+
157
+ Use `sdk.rwaDvp` when a purchase flow needs a Liquid PSET payment request,
158
+ delivery/refund claim descriptors, and an evidence bundle that ties the Liquid
159
+ payment and delivery to an external lock or allocation record.
160
+
161
+ For standard Liquid assets, `payment.asset` can be `"lbtc"` or `"usdt"`. If a
162
+ testnet issuer or deployment uses a different USDt asset id, set
163
+ `payment.asset: "usdt"` and pass the explicit `payment.assetId`; the generated
164
+ payment requirements will preserve that asset id instead of replacing it with
165
+ the SDK's default registry id.
166
+
155
167
  ## CLI and Confidence Commands
156
168
 
157
169
  ### Validation Surface
@@ -77,6 +77,7 @@ function buildPaymentRequirements(_sdk, input) {
77
77
  amountAtomic: input.purchase.payment.amountAtomic,
78
78
  network: input.purchase.network,
79
79
  asset: input.purchase.payment.asset,
80
+ assetId: input.purchase.payment.assetId,
80
81
  description: input.description ?? "Hazbase RWA Liquid delivery-versus-payment",
81
82
  mimeType: input.mimeType ?? "application/json",
82
83
  maxTimeoutSeconds: input.maxTimeoutSeconds,
@@ -20,6 +20,7 @@ export interface LiquidX402RequirementsInput {
20
20
  amountAtomic: string | number | bigint;
21
21
  network?: LiquidX402Network;
22
22
  asset?: LiquidX402AssetKey | string;
23
+ assetId?: string;
23
24
  description?: string;
24
25
  mimeType?: string;
25
26
  maxTimeoutSeconds?: number;
@@ -77,6 +77,7 @@ function resolveLiquidX402Asset(asset, network = exports.LIQUID_X402_DEFAULT_NET
77
77
  function buildLiquidX402Requirements(input) {
78
78
  const network = normalizeNetwork(input.network ?? exports.LIQUID_X402_DEFAULT_NETWORK);
79
79
  const asset = resolveLiquidX402Asset(input.asset ?? "usdt", network);
80
+ const assetId = resolveLiquidX402AssetId(input.assetId, asset);
80
81
  const amountAtomic = normalizeAmountAtomic(input.amountAtomic);
81
82
  const expiresAt = normalizeExpiresAt(input.expiresAt, input.maxTimeoutSeconds);
82
83
  const description = String(input.description ?? "").trim() || "Unlock resource";
@@ -100,11 +101,11 @@ function buildLiquidX402Requirements(input) {
100
101
  mimeType,
101
102
  payTo,
102
103
  maxTimeoutSeconds,
103
- asset: asset.assetId,
104
+ asset: assetId,
104
105
  extra: {
105
106
  paymentRequestId,
106
107
  asset: asset.key,
107
- assetId: asset.assetId,
108
+ assetId,
108
109
  decimals: asset.decimals,
109
110
  expiresAt,
110
111
  feeAsset: "lbtc",
@@ -585,6 +586,12 @@ function isLiquidAssetAlias(input) {
585
586
  value === "usdt-liquid" ||
586
587
  value === "tether";
587
588
  }
589
+ function resolveLiquidX402AssetId(input, asset) {
590
+ const value = String(input ?? "").trim();
591
+ if (!value)
592
+ return asset.assetId;
593
+ return isLiquidAssetAlias(value) ? asset.assetId : value;
594
+ }
588
595
  function normalizeAmountAtomic(input) {
589
596
  const raw = typeof input === "bigint" ? input.toString() : String(input ?? "").trim();
590
597
  if (!/^\d+$/u.test(raw))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hazbase/simplicity",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "An SDK for Simplicity on Liquid",
5
5
  "author": "IndieSquare Inc <info@hazbase.com>",
6
6
  "keywords": [