@unicitylabs/sphere-sdk 0.14.0-dev.5 → 0.14.0-dev.7

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.
@@ -2631,7 +2631,7 @@ declare class PaymentsModule {
2631
2631
  onPaymentRequest(handler: PaymentRequestHandler): () => void;
2632
2632
  /** Get all payment requests. @see PaymentRequests.getPaymentRequests */
2633
2633
  getPaymentRequests(filter?: {
2634
- status?: PaymentRequestStatus$1;
2634
+ status?: PaymentRequestStatus;
2635
2635
  }): IncomingPaymentRequest[];
2636
2636
  /** Count of incoming payment requests with status `'pending'`. @see PaymentRequests.getPendingPaymentRequestsCount */
2637
2637
  getPendingPaymentRequestsCount(): number;
@@ -2645,7 +2645,7 @@ declare class PaymentsModule {
2645
2645
  payPaymentRequest(requestId: string, memo?: string): Promise<TransferResult>;
2646
2646
  /** Get outgoing payment requests. @see PaymentRequests.getOutgoingPaymentRequests */
2647
2647
  getOutgoingPaymentRequests(filter?: {
2648
- status?: PaymentRequestStatus$1;
2648
+ status?: PaymentRequestStatus;
2649
2649
  }): OutgoingPaymentRequest[];
2650
2650
  /** Subscribe to payment request responses. @see PaymentRequests.onPaymentRequestResponse */
2651
2651
  onPaymentRequestResponse(handler: PaymentRequestResponseHandler): () => void;
@@ -4060,6 +4060,107 @@ interface FailedNoticeInfo {
4060
4060
  readonly error?: string;
4061
4061
  }
4062
4062
 
4063
+ interface SendRequest {
4064
+ recipient: string;
4065
+ amount: string;
4066
+ coinId: string;
4067
+ memo?: string;
4068
+ }
4069
+ interface MintResult {
4070
+ success: boolean;
4071
+ tokenId?: string;
4072
+ error?: string;
4073
+ }
4074
+ interface HistoryEntry {
4075
+ id: string;
4076
+ type: 'SENT' | 'RECEIVED' | 'MINT';
4077
+ coinId: string;
4078
+ amount: string;
4079
+ symbol?: string;
4080
+ timestamp: number;
4081
+ memo?: string;
4082
+ transferId?: string;
4083
+ tokenId?: string;
4084
+ senderPubkey?: string;
4085
+ senderNametag?: string;
4086
+ recipientPubkey?: string;
4087
+ recipientNametag?: string;
4088
+ tokenIds?: {
4089
+ id: string;
4090
+ amount: string;
4091
+ }[];
4092
+ }
4093
+ interface HistoryPage {
4094
+ entries: HistoryEntry[];
4095
+ more: boolean;
4096
+ cursor: string | null;
4097
+ }
4098
+ type PaymentRequestStatus$1 = 'pending' | 'settling' | 'paid' | 'rejected' | 'expired';
4099
+ interface PaymentRequestView {
4100
+ id: string;
4101
+ requestId: string;
4102
+ senderPubkey: string;
4103
+ senderNametag?: string;
4104
+ amount: string;
4105
+ coinId: string;
4106
+ symbol?: string;
4107
+ message?: string;
4108
+ timestamp: number;
4109
+ status: PaymentRequestStatus$1;
4110
+ }
4111
+ interface PaymentsRequestsApi {
4112
+ create(to: string, terms: {
4113
+ coinId: string;
4114
+ amount: string;
4115
+ memo?: string;
4116
+ }): Promise<{
4117
+ success: boolean;
4118
+ requestId?: string;
4119
+ error?: string;
4120
+ }>;
4121
+ list(): PaymentRequestView[];
4122
+ pay(id: string): Promise<TransferResult>;
4123
+ decline(id: string): Promise<void>;
4124
+ dismissProcessed(): void;
4125
+ }
4126
+ /**
4127
+ * A pending-transfers row, derived ON READ from the §6 stores (intent backstop
4128
+ * + delivery journal + shortfalls) — never a cached mirror. kind 'shortfall' =
4129
+ * a completed partial (#690) whose `amount` is the remainder still owed;
4130
+ * legs.certified counts journaled legs (certified, delivery still owed).
4131
+ */
4132
+ interface PendingTransfer {
4133
+ transferId: string;
4134
+ kind: 'open' | 'shortfall';
4135
+ recipient: string;
4136
+ coinId: string;
4137
+ amount: string;
4138
+ legs: {
4139
+ certified: number;
4140
+ total: number;
4141
+ };
4142
+ deliveryPending: boolean;
4143
+ createdAt: number;
4144
+ }
4145
+ interface PaymentsV2 {
4146
+ assets(coinId?: string): Promise<Asset[]>;
4147
+ tokens(filter?: {
4148
+ coinId?: string;
4149
+ }): Token[];
4150
+ history(page?: {
4151
+ before?: string;
4152
+ limit?: number;
4153
+ }): Promise<HistoryPage>;
4154
+ send(req: SendRequest): Promise<TransferResult>;
4155
+ mint(coinId: string, amount: bigint): Promise<MintResult>;
4156
+ receive(): Promise<{
4157
+ transfers: IncomingTransfer[];
4158
+ }>;
4159
+ pendingTransfers(): Promise<PendingTransfer[]>;
4160
+ resumeNow(): Promise<void>;
4161
+ readonly requests: PaymentsRequestsApi;
4162
+ }
4163
+
4063
4164
  /**
4064
4165
  * Group Chat Types (NIP-29)
4065
4166
  * Plain interfaces for SDK consumers — no classes, no UI helpers.
@@ -4473,7 +4574,7 @@ interface IncomingTransfer {
4473
4574
  readonly memo?: string;
4474
4575
  readonly receivedAt: number;
4475
4576
  }
4476
- type PaymentRequestStatus$1 = 'pending' | 'rejected' | 'paid' | 'expired' | 'settling';
4577
+ type PaymentRequestStatus = 'pending' | 'rejected' | 'paid' | 'expired' | 'settling';
4477
4578
  /**
4478
4579
  * Outgoing payment request (requesting payment from someone)
4479
4580
  */
@@ -4514,7 +4615,7 @@ interface IncomingPaymentRequest {
4514
4615
  /** Timestamp */
4515
4616
  readonly timestamp: number;
4516
4617
  /** Current status */
4517
- status: PaymentRequestStatus$1;
4618
+ status: PaymentRequestStatus;
4518
4619
  }
4519
4620
  /**
4520
4621
  * Result of sending a payment request
@@ -4554,7 +4655,7 @@ interface OutgoingPaymentRequest {
4554
4655
  /** Created timestamp */
4555
4656
  readonly createdAt: number;
4556
4657
  /** Current status */
4557
- status: PaymentRequestStatus$1;
4658
+ status: PaymentRequestStatus;
4558
4659
  /** Response data (if received) */
4559
4660
  response?: PaymentRequestResponse;
4560
4661
  }
@@ -4851,7 +4952,7 @@ interface SphereEventMap {
4851
4952
  'communications:ready': {
4852
4953
  conversationCount: number;
4853
4954
  };
4854
- 'history:updated': TransactionHistoryEntry;
4955
+ 'history:updated': TransactionHistoryEntry | HistoryEntry;
4855
4956
  /** Replaces transfer:confirmed / :delivery_pending / :failed on the v2 vertical. */
4856
4957
  'transfer:updated': TransferResult;
4857
4958
  /** Replaces split:checkpoint-stuck / delivery:undeliverable / delivery:deferred (by code). */
@@ -7080,86 +7181,6 @@ interface DerivedAddressInfo {
7080
7181
  */
7081
7182
  declare function discoverAddressesImpl(deriveTransportPubkey: (index: number) => DerivedAddressInfo, batchResolve: (transportPubkeys: string[]) => Promise<PeerInfo[]>, options?: DiscoverAddressesOptions): Promise<DiscoverAddressesResult>;
7082
7183
 
7083
- interface SendRequest {
7084
- recipient: string;
7085
- amount: string;
7086
- coinId: string;
7087
- memo?: string;
7088
- }
7089
- interface MintResult {
7090
- success: boolean;
7091
- tokenId?: string;
7092
- error?: string;
7093
- }
7094
- interface HistoryEntry {
7095
- id: string;
7096
- type: 'SENT' | 'RECEIVED' | 'MINT';
7097
- coinId: string;
7098
- amount: string;
7099
- symbol?: string;
7100
- timestamp: number;
7101
- memo?: string;
7102
- transferId?: string;
7103
- tokenId?: string;
7104
- senderPubkey?: string;
7105
- senderNametag?: string;
7106
- recipientPubkey?: string;
7107
- recipientNametag?: string;
7108
- tokenIds?: {
7109
- id: string;
7110
- amount: string;
7111
- }[];
7112
- }
7113
- interface HistoryPage {
7114
- entries: HistoryEntry[];
7115
- more: boolean;
7116
- cursor: string | null;
7117
- }
7118
- type PaymentRequestStatus = 'pending' | 'settling' | 'paid' | 'rejected' | 'expired';
7119
- interface PaymentRequestView {
7120
- id: string;
7121
- requestId: string;
7122
- senderPubkey: string;
7123
- senderNametag?: string;
7124
- amount: string;
7125
- coinId: string;
7126
- symbol?: string;
7127
- message?: string;
7128
- timestamp: number;
7129
- status: PaymentRequestStatus;
7130
- }
7131
- interface PaymentsRequestsApi {
7132
- create(to: string, terms: {
7133
- coinId: string;
7134
- amount: string;
7135
- memo?: string;
7136
- }): Promise<{
7137
- success: boolean;
7138
- requestId?: string;
7139
- error?: string;
7140
- }>;
7141
- list(): PaymentRequestView[];
7142
- pay(id: string): Promise<TransferResult>;
7143
- decline(id: string): Promise<void>;
7144
- dismissProcessed(): void;
7145
- }
7146
- interface PaymentsV2 {
7147
- assets(coinId?: string): Promise<Asset[]>;
7148
- tokens(filter?: {
7149
- coinId?: string;
7150
- }): Token[];
7151
- history(page?: {
7152
- before?: string;
7153
- limit?: number;
7154
- }): Promise<HistoryPage>;
7155
- send(req: SendRequest): Promise<TransferResult>;
7156
- mint(coinId: string, amount: bigint): Promise<MintResult>;
7157
- receive(): Promise<{
7158
- transfers: IncomingTransfer[];
7159
- }>;
7160
- readonly requests: PaymentsRequestsApi;
7161
- }
7162
-
7163
7184
  /**
7164
7185
  * Text Wallet Backup Serialization Types
7165
7186
  */
@@ -7736,7 +7757,10 @@ declare class Sphere {
7736
7757
  private static resolveSwapConfig;
7737
7758
  /**
7738
7759
  * P9: validate + resolve the paymentsV2 opt-in BEFORE any storage writes —
7739
- * fail-closed at init, never a silently-degraded composition.
7760
+ * fail-closed at init, never a silently-degraded composition. Returns the
7761
+ * resolved composition (null = flag off); #728: resolving here also asserts
7762
+ * the single-network invariant (walletApi.network known + equal to the
7763
+ * Sphere network) before any session/KV/provider exists.
7740
7764
  */
7741
7765
  private static resolvePaymentsV2Flag;
7742
7766
  /**
@@ -2631,7 +2631,7 @@ declare class PaymentsModule {
2631
2631
  onPaymentRequest(handler: PaymentRequestHandler): () => void;
2632
2632
  /** Get all payment requests. @see PaymentRequests.getPaymentRequests */
2633
2633
  getPaymentRequests(filter?: {
2634
- status?: PaymentRequestStatus$1;
2634
+ status?: PaymentRequestStatus;
2635
2635
  }): IncomingPaymentRequest[];
2636
2636
  /** Count of incoming payment requests with status `'pending'`. @see PaymentRequests.getPendingPaymentRequestsCount */
2637
2637
  getPendingPaymentRequestsCount(): number;
@@ -2645,7 +2645,7 @@ declare class PaymentsModule {
2645
2645
  payPaymentRequest(requestId: string, memo?: string): Promise<TransferResult>;
2646
2646
  /** Get outgoing payment requests. @see PaymentRequests.getOutgoingPaymentRequests */
2647
2647
  getOutgoingPaymentRequests(filter?: {
2648
- status?: PaymentRequestStatus$1;
2648
+ status?: PaymentRequestStatus;
2649
2649
  }): OutgoingPaymentRequest[];
2650
2650
  /** Subscribe to payment request responses. @see PaymentRequests.onPaymentRequestResponse */
2651
2651
  onPaymentRequestResponse(handler: PaymentRequestResponseHandler): () => void;
@@ -4060,6 +4060,107 @@ interface FailedNoticeInfo {
4060
4060
  readonly error?: string;
4061
4061
  }
4062
4062
 
4063
+ interface SendRequest {
4064
+ recipient: string;
4065
+ amount: string;
4066
+ coinId: string;
4067
+ memo?: string;
4068
+ }
4069
+ interface MintResult {
4070
+ success: boolean;
4071
+ tokenId?: string;
4072
+ error?: string;
4073
+ }
4074
+ interface HistoryEntry {
4075
+ id: string;
4076
+ type: 'SENT' | 'RECEIVED' | 'MINT';
4077
+ coinId: string;
4078
+ amount: string;
4079
+ symbol?: string;
4080
+ timestamp: number;
4081
+ memo?: string;
4082
+ transferId?: string;
4083
+ tokenId?: string;
4084
+ senderPubkey?: string;
4085
+ senderNametag?: string;
4086
+ recipientPubkey?: string;
4087
+ recipientNametag?: string;
4088
+ tokenIds?: {
4089
+ id: string;
4090
+ amount: string;
4091
+ }[];
4092
+ }
4093
+ interface HistoryPage {
4094
+ entries: HistoryEntry[];
4095
+ more: boolean;
4096
+ cursor: string | null;
4097
+ }
4098
+ type PaymentRequestStatus$1 = 'pending' | 'settling' | 'paid' | 'rejected' | 'expired';
4099
+ interface PaymentRequestView {
4100
+ id: string;
4101
+ requestId: string;
4102
+ senderPubkey: string;
4103
+ senderNametag?: string;
4104
+ amount: string;
4105
+ coinId: string;
4106
+ symbol?: string;
4107
+ message?: string;
4108
+ timestamp: number;
4109
+ status: PaymentRequestStatus$1;
4110
+ }
4111
+ interface PaymentsRequestsApi {
4112
+ create(to: string, terms: {
4113
+ coinId: string;
4114
+ amount: string;
4115
+ memo?: string;
4116
+ }): Promise<{
4117
+ success: boolean;
4118
+ requestId?: string;
4119
+ error?: string;
4120
+ }>;
4121
+ list(): PaymentRequestView[];
4122
+ pay(id: string): Promise<TransferResult>;
4123
+ decline(id: string): Promise<void>;
4124
+ dismissProcessed(): void;
4125
+ }
4126
+ /**
4127
+ * A pending-transfers row, derived ON READ from the §6 stores (intent backstop
4128
+ * + delivery journal + shortfalls) — never a cached mirror. kind 'shortfall' =
4129
+ * a completed partial (#690) whose `amount` is the remainder still owed;
4130
+ * legs.certified counts journaled legs (certified, delivery still owed).
4131
+ */
4132
+ interface PendingTransfer {
4133
+ transferId: string;
4134
+ kind: 'open' | 'shortfall';
4135
+ recipient: string;
4136
+ coinId: string;
4137
+ amount: string;
4138
+ legs: {
4139
+ certified: number;
4140
+ total: number;
4141
+ };
4142
+ deliveryPending: boolean;
4143
+ createdAt: number;
4144
+ }
4145
+ interface PaymentsV2 {
4146
+ assets(coinId?: string): Promise<Asset[]>;
4147
+ tokens(filter?: {
4148
+ coinId?: string;
4149
+ }): Token[];
4150
+ history(page?: {
4151
+ before?: string;
4152
+ limit?: number;
4153
+ }): Promise<HistoryPage>;
4154
+ send(req: SendRequest): Promise<TransferResult>;
4155
+ mint(coinId: string, amount: bigint): Promise<MintResult>;
4156
+ receive(): Promise<{
4157
+ transfers: IncomingTransfer[];
4158
+ }>;
4159
+ pendingTransfers(): Promise<PendingTransfer[]>;
4160
+ resumeNow(): Promise<void>;
4161
+ readonly requests: PaymentsRequestsApi;
4162
+ }
4163
+
4063
4164
  /**
4064
4165
  * Group Chat Types (NIP-29)
4065
4166
  * Plain interfaces for SDK consumers — no classes, no UI helpers.
@@ -4473,7 +4574,7 @@ interface IncomingTransfer {
4473
4574
  readonly memo?: string;
4474
4575
  readonly receivedAt: number;
4475
4576
  }
4476
- type PaymentRequestStatus$1 = 'pending' | 'rejected' | 'paid' | 'expired' | 'settling';
4577
+ type PaymentRequestStatus = 'pending' | 'rejected' | 'paid' | 'expired' | 'settling';
4477
4578
  /**
4478
4579
  * Outgoing payment request (requesting payment from someone)
4479
4580
  */
@@ -4514,7 +4615,7 @@ interface IncomingPaymentRequest {
4514
4615
  /** Timestamp */
4515
4616
  readonly timestamp: number;
4516
4617
  /** Current status */
4517
- status: PaymentRequestStatus$1;
4618
+ status: PaymentRequestStatus;
4518
4619
  }
4519
4620
  /**
4520
4621
  * Result of sending a payment request
@@ -4554,7 +4655,7 @@ interface OutgoingPaymentRequest {
4554
4655
  /** Created timestamp */
4555
4656
  readonly createdAt: number;
4556
4657
  /** Current status */
4557
- status: PaymentRequestStatus$1;
4658
+ status: PaymentRequestStatus;
4558
4659
  /** Response data (if received) */
4559
4660
  response?: PaymentRequestResponse;
4560
4661
  }
@@ -4851,7 +4952,7 @@ interface SphereEventMap {
4851
4952
  'communications:ready': {
4852
4953
  conversationCount: number;
4853
4954
  };
4854
- 'history:updated': TransactionHistoryEntry;
4955
+ 'history:updated': TransactionHistoryEntry | HistoryEntry;
4855
4956
  /** Replaces transfer:confirmed / :delivery_pending / :failed on the v2 vertical. */
4856
4957
  'transfer:updated': TransferResult;
4857
4958
  /** Replaces split:checkpoint-stuck / delivery:undeliverable / delivery:deferred (by code). */
@@ -7080,86 +7181,6 @@ interface DerivedAddressInfo {
7080
7181
  */
7081
7182
  declare function discoverAddressesImpl(deriveTransportPubkey: (index: number) => DerivedAddressInfo, batchResolve: (transportPubkeys: string[]) => Promise<PeerInfo[]>, options?: DiscoverAddressesOptions): Promise<DiscoverAddressesResult>;
7082
7183
 
7083
- interface SendRequest {
7084
- recipient: string;
7085
- amount: string;
7086
- coinId: string;
7087
- memo?: string;
7088
- }
7089
- interface MintResult {
7090
- success: boolean;
7091
- tokenId?: string;
7092
- error?: string;
7093
- }
7094
- interface HistoryEntry {
7095
- id: string;
7096
- type: 'SENT' | 'RECEIVED' | 'MINT';
7097
- coinId: string;
7098
- amount: string;
7099
- symbol?: string;
7100
- timestamp: number;
7101
- memo?: string;
7102
- transferId?: string;
7103
- tokenId?: string;
7104
- senderPubkey?: string;
7105
- senderNametag?: string;
7106
- recipientPubkey?: string;
7107
- recipientNametag?: string;
7108
- tokenIds?: {
7109
- id: string;
7110
- amount: string;
7111
- }[];
7112
- }
7113
- interface HistoryPage {
7114
- entries: HistoryEntry[];
7115
- more: boolean;
7116
- cursor: string | null;
7117
- }
7118
- type PaymentRequestStatus = 'pending' | 'settling' | 'paid' | 'rejected' | 'expired';
7119
- interface PaymentRequestView {
7120
- id: string;
7121
- requestId: string;
7122
- senderPubkey: string;
7123
- senderNametag?: string;
7124
- amount: string;
7125
- coinId: string;
7126
- symbol?: string;
7127
- message?: string;
7128
- timestamp: number;
7129
- status: PaymentRequestStatus;
7130
- }
7131
- interface PaymentsRequestsApi {
7132
- create(to: string, terms: {
7133
- coinId: string;
7134
- amount: string;
7135
- memo?: string;
7136
- }): Promise<{
7137
- success: boolean;
7138
- requestId?: string;
7139
- error?: string;
7140
- }>;
7141
- list(): PaymentRequestView[];
7142
- pay(id: string): Promise<TransferResult>;
7143
- decline(id: string): Promise<void>;
7144
- dismissProcessed(): void;
7145
- }
7146
- interface PaymentsV2 {
7147
- assets(coinId?: string): Promise<Asset[]>;
7148
- tokens(filter?: {
7149
- coinId?: string;
7150
- }): Token[];
7151
- history(page?: {
7152
- before?: string;
7153
- limit?: number;
7154
- }): Promise<HistoryPage>;
7155
- send(req: SendRequest): Promise<TransferResult>;
7156
- mint(coinId: string, amount: bigint): Promise<MintResult>;
7157
- receive(): Promise<{
7158
- transfers: IncomingTransfer[];
7159
- }>;
7160
- readonly requests: PaymentsRequestsApi;
7161
- }
7162
-
7163
7184
  /**
7164
7185
  * Text Wallet Backup Serialization Types
7165
7186
  */
@@ -7736,7 +7757,10 @@ declare class Sphere {
7736
7757
  private static resolveSwapConfig;
7737
7758
  /**
7738
7759
  * P9: validate + resolve the paymentsV2 opt-in BEFORE any storage writes —
7739
- * fail-closed at init, never a silently-degraded composition.
7760
+ * fail-closed at init, never a silently-degraded composition. Returns the
7761
+ * resolved composition (null = flag off); #728: resolving here also asserts
7762
+ * the single-network invariant (walletApi.network known + equal to the
7763
+ * Sphere network) before any session/KV/provider exists.
7740
7764
  */
7741
7765
  private static resolvePaymentsV2Flag;
7742
7766
  /**