@unicitylabs/sphere-sdk 0.5.1 → 0.5.3

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.
Files changed (43) hide show
  1. package/dist/connect/index.cjs +3 -1
  2. package/dist/connect/index.cjs.map +1 -1
  3. package/dist/connect/index.js +3 -1
  4. package/dist/connect/index.js.map +1 -1
  5. package/dist/core/index.cjs +669 -277
  6. package/dist/core/index.cjs.map +1 -1
  7. package/dist/core/index.d.cts +57 -2
  8. package/dist/core/index.d.ts +57 -2
  9. package/dist/core/index.js +669 -277
  10. package/dist/core/index.js.map +1 -1
  11. package/dist/impl/browser/connect/index.cjs +3 -1
  12. package/dist/impl/browser/connect/index.cjs.map +1 -1
  13. package/dist/impl/browser/connect/index.js +3 -1
  14. package/dist/impl/browser/connect/index.js.map +1 -1
  15. package/dist/impl/browser/index.cjs +11 -3
  16. package/dist/impl/browser/index.cjs.map +1 -1
  17. package/dist/impl/browser/index.js +11 -3
  18. package/dist/impl/browser/index.js.map +1 -1
  19. package/dist/impl/browser/ipfs.cjs +9 -2
  20. package/dist/impl/browser/ipfs.cjs.map +1 -1
  21. package/dist/impl/browser/ipfs.js +9 -2
  22. package/dist/impl/browser/ipfs.js.map +1 -1
  23. package/dist/impl/nodejs/connect/index.cjs +3 -1
  24. package/dist/impl/nodejs/connect/index.cjs.map +1 -1
  25. package/dist/impl/nodejs/connect/index.js +3 -1
  26. package/dist/impl/nodejs/connect/index.js.map +1 -1
  27. package/dist/impl/nodejs/index.cjs +11 -3
  28. package/dist/impl/nodejs/index.cjs.map +1 -1
  29. package/dist/impl/nodejs/index.d.cts +7 -0
  30. package/dist/impl/nodejs/index.d.ts +7 -0
  31. package/dist/impl/nodejs/index.js +11 -3
  32. package/dist/impl/nodejs/index.js.map +1 -1
  33. package/dist/index.cjs +671 -277
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +128 -3
  36. package/dist/index.d.ts +128 -3
  37. package/dist/index.js +670 -277
  38. package/dist/index.js.map +1 -1
  39. package/dist/l1/index.cjs +3 -1
  40. package/dist/l1/index.cjs.map +1 -1
  41. package/dist/l1/index.js +3 -1
  42. package/dist/l1/index.js.map +1 -1
  43. package/package.json +1 -1
@@ -1065,6 +1065,12 @@ interface HistoryRecord {
1065
1065
  recipientNametag?: string;
1066
1066
  /** Optional memo/message attached to the transfer */
1067
1067
  memo?: string;
1068
+ /** All token IDs in a combined transfer (V6 bundle breakdown) */
1069
+ tokenIds?: Array<{
1070
+ id: string;
1071
+ amount: string;
1072
+ source: 'split' | 'direct';
1073
+ }>;
1068
1074
  }
1069
1075
  /**
1070
1076
  * Storage result types
@@ -1156,6 +1162,7 @@ interface TxfStorageDataBase {
1156
1162
  _outbox?: TxfOutboxEntry[];
1157
1163
  _sent?: TxfSentEntry[];
1158
1164
  _invalid?: TxfInvalidEntry[];
1165
+ _history?: HistoryRecord[];
1159
1166
  [key: `_${string}`]: unknown;
1160
1167
  }
1161
1168
  interface TxfMeta {
@@ -1065,6 +1065,12 @@ interface HistoryRecord {
1065
1065
  recipientNametag?: string;
1066
1066
  /** Optional memo/message attached to the transfer */
1067
1067
  memo?: string;
1068
+ /** All token IDs in a combined transfer (V6 bundle breakdown) */
1069
+ tokenIds?: Array<{
1070
+ id: string;
1071
+ amount: string;
1072
+ source: 'split' | 'direct';
1073
+ }>;
1068
1074
  }
1069
1075
  /**
1070
1076
  * Storage result types
@@ -1156,6 +1162,7 @@ interface TxfStorageDataBase {
1156
1162
  _outbox?: TxfOutboxEntry[];
1157
1163
  _sent?: TxfSentEntry[];
1158
1164
  _invalid?: TxfInvalidEntry[];
1165
+ _history?: HistoryRecord[];
1159
1166
  [key: `_${string}`]: unknown;
1160
1167
  }
1161
1168
  interface TxfMeta {
@@ -61,7 +61,9 @@ var STORAGE_KEYS_ADDRESS = {
61
61
  /** Group chat: processed event IDs for deduplication */
62
62
  GROUP_CHAT_PROCESSED_EVENTS: "group_chat_processed_events",
63
63
  /** Processed V5 split group IDs for Nostr re-delivery dedup */
64
- PROCESSED_SPLIT_GROUP_IDS: "processed_split_group_ids"
64
+ PROCESSED_SPLIT_GROUP_IDS: "processed_split_group_ids",
65
+ /** Processed V6 combined transfer IDs for Nostr re-delivery dedup */
66
+ PROCESSED_COMBINED_TRANSFER_IDS: "processed_combined_transfer_ids"
65
67
  };
66
68
  var STORAGE_KEYS = {
67
69
  ...STORAGE_KEYS_GLOBAL,
@@ -1562,12 +1564,13 @@ var NostrTransportProvider = class {
1562
1564
  async sendTokenTransfer(recipientPubkey, payload) {
1563
1565
  this.ensureReady();
1564
1566
  const content = "token_transfer:" + JSON.stringify(payload);
1567
+ const uniqueD = `token-transfer-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
1565
1568
  const event = await this.createEncryptedEvent(
1566
1569
  EVENT_KINDS.TOKEN_TRANSFER,
1567
1570
  content,
1568
1571
  [
1569
1572
  ["p", recipientPubkey],
1570
- ["d", "token-transfer"],
1573
+ ["d", uniqueD],
1571
1574
  ["type", "token_transfer"]
1572
1575
  ]
1573
1576
  );
@@ -3980,6 +3983,9 @@ function mergeTxfData(local, remote) {
3980
3983
  const localNametags = local._nametags ?? [];
3981
3984
  const remoteNametags = remote._nametags ?? [];
3982
3985
  const mergedNametags = mergeNametagsByName(localNametags, remoteNametags);
3986
+ const localHistory = local._history ?? [];
3987
+ const remoteHistory = remote._history ?? [];
3988
+ const mergedHistory = mergeArrayById(localHistory, remoteHistory, "dedupKey");
3983
3989
  const merged = {
3984
3990
  _meta: mergedMeta,
3985
3991
  _tombstones: mergedTombstones.length > 0 ? mergedTombstones : void 0,
@@ -3987,6 +3993,7 @@ function mergeTxfData(local, remote) {
3987
3993
  _outbox: mergedOutbox.length > 0 ? mergedOutbox : void 0,
3988
3994
  _sent: mergedSent.length > 0 ? mergedSent : void 0,
3989
3995
  _invalid: mergedInvalid.length > 0 ? mergedInvalid : void 0,
3996
+ _history: mergedHistory.length > 0 ? mergedHistory : void 0,
3990
3997
  ...mergedTokens
3991
3998
  };
3992
3999
  return { merged, added, removed, conflicts };
@@ -4013,7 +4020,8 @@ function getTokenKeys(data) {
4013
4020
  "_nametags",
4014
4021
  "_mintOutbox",
4015
4022
  "_invalidatedNametags",
4016
- "_integrity"
4023
+ "_integrity",
4024
+ "_history"
4017
4025
  ]);
4018
4026
  const keys = /* @__PURE__ */ new Set();
4019
4027
  for (const key of Object.keys(data)) {