@totemsdk/core 1.0.9 → 1.0.11

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 (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -5
  3. package/dist/Streamable.js +54 -31
  4. package/dist/adapters/index.js +18 -8
  5. package/dist/adapters/types.js +19 -8
  6. package/dist/binio.js +5 -1
  7. package/dist/bip39.js +24 -14
  8. package/dist/derive.js +11 -7
  9. package/dist/index.js +130 -22
  10. package/dist/javaStreamables.js +49 -30
  11. package/dist/lease/LeaseMonitor.js +7 -3
  12. package/dist/lease/LeaseStore.js +7 -3
  13. package/dist/lease/WatermarkStore.js +7 -3
  14. package/dist/lease/index.js +13 -4
  15. package/dist/lease-client.js +8 -3
  16. package/dist/minima32.js +22 -13
  17. package/dist/minimaWireSerializer.js +20 -14
  18. package/dist/mmr.js +35 -23
  19. package/dist/mx.js +10 -1
  20. package/dist/params.js +9 -5
  21. package/dist/script.js +12 -7
  22. package/dist/scripts/contract-helpers.js +37 -26
  23. package/dist/scripts/dapp-types.js +11 -6
  24. package/dist/scripts/index.js +38 -4
  25. package/dist/scripts/types.js +26 -12
  26. package/dist/scripts/witness-serializer.js +48 -30
  27. package/dist/transaction.js +55 -46
  28. package/dist/treekey.js +74 -58
  29. package/dist/tx/TransactionLifecycle.js +11 -5
  30. package/dist/tx/TransactionReceiptStore.js +7 -3
  31. package/dist/tx/TransactionService.js +14 -10
  32. package/dist/tx/index.js +11 -3
  33. package/dist/tx/types.js +2 -1
  34. package/dist/util.js +5 -1
  35. package/dist/utils.js +12 -5
  36. package/dist/verify.js +36 -25
  37. package/dist/version.js +5 -2
  38. package/dist/wots.d.ts +2 -2
  39. package/dist/wots.js +94 -64
  40. package/package.json +50 -6
  41. package/src/Streamable.d.ts +0 -268
  42. package/src/Streamable.js +0 -416
  43. package/src/Streamable.ts +0 -567
  44. package/src/__tests__/Streamable.parity.test.ts +0 -422
  45. package/src/__tests__/perAddressDerivation.parity.test.ts +0 -152
  46. package/src/__tests__/roottree-prepare.test.ts +0 -101
  47. package/src/__tests__/wots-parity.test.ts +0 -289
  48. package/src/adapters/index.d.ts +0 -190
  49. package/src/adapters/index.js +0 -117
  50. package/src/adapters/index.ts +0 -301
  51. package/src/adapters/types.ts +0 -235
  52. package/src/addr.oracle.test.ts +0 -25
  53. package/src/address.test.ts +0 -55
  54. package/src/binio.ts +0 -21
  55. package/src/bip39.d.ts +0 -91
  56. package/src/bip39.js +0 -427
  57. package/src/bip39.ts +0 -432
  58. package/src/derive.d.ts +0 -2
  59. package/src/derive.js +0 -13
  60. package/src/derive.ts +0 -11
  61. package/src/index.d.ts +0 -26
  62. package/src/index.js +0 -128
  63. package/src/index.test.ts +0 -5
  64. package/src/index.ts +0 -221
  65. package/src/javaStreamables.d.ts +0 -233
  66. package/src/javaStreamables.js +0 -332
  67. package/src/javaStreamables.ts +0 -403
  68. package/src/lease/LeaseMonitor.d.ts +0 -44
  69. package/src/lease/LeaseMonitor.js +0 -111
  70. package/src/lease/LeaseMonitor.ts +0 -157
  71. package/src/lease/LeaseStore.d.ts +0 -57
  72. package/src/lease/LeaseStore.js +0 -148
  73. package/src/lease/LeaseStore.ts +0 -203
  74. package/src/lease/WatermarkStore.d.ts +0 -61
  75. package/src/lease/WatermarkStore.js +0 -206
  76. package/src/lease/WatermarkStore.ts +0 -270
  77. package/src/lease/index.d.ts +0 -14
  78. package/src/lease/index.js +0 -22
  79. package/src/lease/index.ts +0 -41
  80. package/src/lease-client.d.ts +0 -31
  81. package/src/lease-client.js +0 -44
  82. package/src/lease-client.ts +0 -69
  83. package/src/minima32.d.ts +0 -10
  84. package/src/minima32.js +0 -113
  85. package/src/minima32.test.ts +0 -11
  86. package/src/minima32.ts +0 -127
  87. package/src/minimaWireSerializer.d.ts +0 -189
  88. package/src/minimaWireSerializer.js +0 -311
  89. package/src/minimaWireSerializer.test.ts +0 -466
  90. package/src/minimaWireSerializer.ts +0 -117
  91. package/src/mmr.d.ts +0 -157
  92. package/src/mmr.js +0 -340
  93. package/src/mmr.oracle.test.ts +0 -28
  94. package/src/mmr.ts +0 -429
  95. package/src/mx.test.ts +0 -25
  96. package/src/mx.ts +0 -1
  97. package/src/params.d.ts +0 -29
  98. package/src/params.d.ts.map +0 -1
  99. package/src/params.js +0 -20
  100. package/src/params.js.map +0 -1
  101. package/src/params.ts +0 -44
  102. package/src/script.d.ts +0 -7
  103. package/src/script.js +0 -27
  104. package/src/script.ts +0 -24
  105. package/src/scripts/contract-helpers.ts +0 -609
  106. package/src/scripts/dapp-types.ts +0 -240
  107. package/src/scripts/index.ts +0 -22
  108. package/src/scripts/types.d.ts +0 -81
  109. package/src/scripts/types.js +0 -145
  110. package/src/scripts/types.ts +0 -247
  111. package/src/scripts/witness-serializer.ts +0 -384
  112. package/src/transaction.ts +0 -430
  113. package/src/treekey.d.ts +0 -383
  114. package/src/treekey.js +0 -774
  115. package/src/treekey.parity.test.ts +0 -459
  116. package/src/treekey.ts +0 -975
  117. package/src/tx/TransactionLifecycle.d.ts +0 -55
  118. package/src/tx/TransactionLifecycle.js +0 -188
  119. package/src/tx/TransactionLifecycle.ts +0 -280
  120. package/src/tx/TransactionReceiptStore.d.ts +0 -36
  121. package/src/tx/TransactionReceiptStore.js +0 -89
  122. package/src/tx/TransactionReceiptStore.ts +0 -112
  123. package/src/tx/TransactionService.d.ts +0 -31
  124. package/src/tx/TransactionService.js +0 -140
  125. package/src/tx/TransactionService.ts +0 -252
  126. package/src/tx/index.d.ts +0 -13
  127. package/src/tx/index.js +0 -20
  128. package/src/tx/index.ts +0 -44
  129. package/src/tx/types.d.ts +0 -80
  130. package/src/tx/types.js +0 -6
  131. package/src/tx/types.ts +0 -130
  132. package/src/util.d.ts +0 -1
  133. package/src/util.js +0 -5
  134. package/src/util.ts +0 -1
  135. package/src/utils.d.ts +0 -8
  136. package/src/utils.js +0 -42
  137. package/src/utils.ts +0 -38
  138. package/src/verify.ts +0 -210
  139. package/src/version.ts +0 -13
  140. package/src/wots.d.ts +0 -224
  141. package/src/wots.d.ts.map +0 -1
  142. package/src/wots.js +0 -565
  143. package/src/wots.js.map +0 -1
  144. package/src/wots.ts +0 -651
  145. package/test-vectors.json +0 -45
package/src/bip39.ts DELETED
@@ -1,432 +0,0 @@
1
- /**
2
- * Minima-Compatible BIP39 Seed Phrase Handling
3
- *
4
- * IMPORTANT: This is NOT standard BIP39!
5
- * Minima uses the BIP39 English word list for human-friendly phrases,
6
- * but does NOT use PBKDF2, passphrase salt, or checksum validation.
7
- *
8
- * Seed derivation is simply: SHA3-256(phrase_bytes)
9
- *
10
- * Matches BIP39.java behavior exactly:
11
- * - cleanSeedPhrase(): Normalizes input with prefix matching
12
- * - convertStringToSeed(): Hashes phrase bytes with SHA3-256
13
- */
14
-
15
- import { sha3_256 } from '@noble/hashes/sha3.js';
16
-
17
- /**
18
- * Official BIP39 English word list (2048 words)
19
- * From https://github.com/bitcoin/bips/blob/master/bip-0039/english.txt
20
- */
21
- export const WORD_LIST: readonly string[] = [
22
- "abandon", "ability", "able", "about", "above", "absent", "absorb", "abstract",
23
- "absurd", "abuse", "access", "accident", "account", "accuse", "achieve", "acid",
24
- "acoustic", "acquire", "across", "act", "action", "actor", "actress", "actual",
25
- "adapt", "add", "addict", "address", "adjust", "admit", "adult", "advance",
26
- "advice", "aerobic", "affair", "afford", "afraid", "again", "age", "agent",
27
- "agree", "ahead", "aim", "air", "airport", "aisle", "alarm", "album",
28
- "alcohol", "alert", "alien", "all", "alley", "allow", "almost", "alone",
29
- "alpha", "already", "also", "alter", "always", "amateur", "amazing", "among",
30
- "amount", "amused", "analyst", "anchor", "ancient", "anger", "angle", "angry",
31
- "animal", "ankle", "announce", "annual", "another", "answer", "antenna", "antique",
32
- "anxiety", "any", "apart", "apology", "appear", "apple", "approve", "april",
33
- "arch", "arctic", "area", "arena", "argue", "arm", "armed", "armor",
34
- "army", "around", "arrange", "arrest", "arrive", "arrow", "art", "artefact",
35
- "artist", "artwork", "ask", "aspect", "assault", "asset", "assist", "assume",
36
- "asthma", "athlete", "atom", "attack", "attend", "attitude", "attract", "auction",
37
- "audit", "august", "aunt", "author", "auto", "autumn", "average", "avocado",
38
- "avoid", "awake", "aware", "away", "awesome", "awful", "awkward", "axis",
39
- "baby", "bachelor", "bacon", "badge", "bag", "balance", "balcony", "ball",
40
- "bamboo", "banana", "banner", "bar", "barely", "bargain", "barrel", "base",
41
- "basic", "basket", "battle", "beach", "bean", "beauty", "because", "become",
42
- "beef", "before", "begin", "behave", "behind", "believe", "below", "belt",
43
- "bench", "benefit", "best", "betray", "better", "between", "beyond", "bicycle",
44
- "bid", "bike", "bind", "biology", "bird", "birth", "bitter", "black",
45
- "blade", "blame", "blanket", "blast", "bleak", "bless", "blind", "blood",
46
- "blossom", "blouse", "blue", "blur", "blush", "board", "boat", "body",
47
- "boil", "bomb", "bone", "bonus", "book", "boost", "border", "boring",
48
- "borrow", "boss", "bottom", "bounce", "box", "boy", "bracket", "brain",
49
- "brand", "brass", "brave", "bread", "breeze", "brick", "bridge", "brief",
50
- "bright", "bring", "brisk", "broccoli", "broken", "bronze", "broom", "brother",
51
- "brown", "brush", "bubble", "buddy", "budget", "buffalo", "build", "bulb",
52
- "bulk", "bullet", "bundle", "bunker", "burden", "burger", "burst", "bus",
53
- "business", "busy", "butter", "buyer", "buzz", "cabbage", "cabin", "cable",
54
- "cactus", "cage", "cake", "call", "calm", "camera", "camp", "can",
55
- "canal", "cancel", "candy", "cannon", "canoe", "canvas", "canyon", "capable",
56
- "capital", "captain", "car", "carbon", "card", "cargo", "carpet", "carry",
57
- "cart", "case", "cash", "casino", "castle", "casual", "cat", "catalog",
58
- "catch", "category", "cattle", "caught", "cause", "caution", "cave", "ceiling",
59
- "celery", "cement", "census", "century", "cereal", "certain", "chair", "chalk",
60
- "champion", "change", "chaos", "chapter", "charge", "chase", "chat", "cheap",
61
- "check", "cheese", "chef", "cherry", "chest", "chicken", "chief", "child",
62
- "chimney", "choice", "choose", "chronic", "chuckle", "chunk", "churn", "cigar",
63
- "cinnamon", "circle", "citizen", "city", "civil", "claim", "clap", "clarify",
64
- "claw", "clay", "clean", "clerk", "clever", "click", "client", "cliff",
65
- "climb", "clinic", "clip", "clock", "clog", "close", "cloth", "cloud",
66
- "clown", "club", "clump", "cluster", "clutch", "coach", "coast", "coconut",
67
- "code", "coffee", "coil", "coin", "collect", "color", "column", "combine",
68
- "come", "comfort", "comic", "common", "company", "concert", "conduct", "confirm",
69
- "congress", "connect", "consider", "control", "convince", "cook", "cool", "copper",
70
- "copy", "coral", "core", "corn", "correct", "cost", "cotton", "couch",
71
- "country", "couple", "course", "cousin", "cover", "coyote", "crack", "cradle",
72
- "craft", "cram", "crane", "crash", "crater", "crawl", "crazy", "cream",
73
- "credit", "creek", "crew", "cricket", "crime", "crisp", "critic", "crop",
74
- "cross", "crouch", "crowd", "crucial", "cruel", "cruise", "crumble", "crunch",
75
- "crush", "cry", "crystal", "cube", "culture", "cup", "cupboard", "curious",
76
- "current", "curtain", "curve", "cushion", "custom", "cute", "cycle", "dad",
77
- "damage", "damp", "dance", "danger", "daring", "dash", "daughter", "dawn",
78
- "day", "deal", "debate", "debris", "decade", "december", "decide", "decline",
79
- "decorate", "decrease", "deer", "defense", "define", "defy", "degree", "delay",
80
- "deliver", "demand", "demise", "denial", "dentist", "deny", "depart", "depend",
81
- "deposit", "depth", "deputy", "derive", "describe", "desert", "design", "desk",
82
- "despair", "destroy", "detail", "detect", "develop", "device", "devote", "diagram",
83
- "dial", "diamond", "diary", "dice", "diesel", "diet", "differ", "digital",
84
- "dignity", "dilemma", "dinner", "dinosaur", "direct", "dirt", "disagree", "discover",
85
- "disease", "dish", "dismiss", "disorder", "display", "distance", "divert", "divide",
86
- "divorce", "dizzy", "doctor", "document", "dog", "doll", "dolphin", "domain",
87
- "donate", "donkey", "donor", "door", "dose", "double", "dove", "draft",
88
- "dragon", "drama", "drastic", "draw", "dream", "dress", "drift", "drill",
89
- "drink", "drip", "drive", "drop", "drum", "dry", "duck", "dumb",
90
- "dune", "during", "dust", "dutch", "duty", "dwarf", "dynamic", "eager",
91
- "eagle", "early", "earn", "earth", "easily", "east", "easy", "echo",
92
- "ecology", "economy", "edge", "edit", "educate", "effort", "egg", "eight",
93
- "either", "elbow", "elder", "electric", "elegant", "element", "elephant", "elevator",
94
- "elite", "else", "embark", "embody", "embrace", "emerge", "emotion", "employ",
95
- "empower", "empty", "enable", "enact", "end", "endless", "endorse", "enemy",
96
- "energy", "enforce", "engage", "engine", "enhance", "enjoy", "enlist", "enough",
97
- "enrich", "enroll", "ensure", "enter", "entire", "entry", "envelope", "episode",
98
- "equal", "equip", "era", "erase", "erode", "erosion", "error", "erupt",
99
- "escape", "essay", "essence", "estate", "eternal", "ethics", "evidence", "evil",
100
- "evoke", "evolve", "exact", "example", "excess", "exchange", "excite", "exclude",
101
- "excuse", "execute", "exercise", "exhaust", "exhibit", "exile", "exist", "exit",
102
- "exotic", "expand", "expect", "expire", "explain", "expose", "express", "extend",
103
- "extra", "eye", "eyebrow", "fabric", "face", "faculty", "fade", "faint",
104
- "faith", "fall", "false", "fame", "family", "famous", "fan", "fancy",
105
- "fantasy", "farm", "fashion", "fat", "fatal", "father", "fatigue", "fault",
106
- "favorite", "feature", "february", "federal", "fee", "feed", "feel", "female",
107
- "fence", "festival", "fetch", "fever", "few", "fiber", "fiction", "field",
108
- "figure", "file", "film", "filter", "final", "find", "fine", "finger",
109
- "finish", "fire", "firm", "first", "fiscal", "fish", "fit", "fitness",
110
- "fix", "flag", "flame", "flash", "flat", "flavor", "flee", "flight",
111
- "flip", "float", "flock", "floor", "flower", "fluid", "flush", "fly",
112
- "foam", "focus", "fog", "foil", "fold", "follow", "food", "foot",
113
- "force", "forest", "forget", "fork", "fortune", "forum", "forward", "fossil",
114
- "foster", "found", "fox", "fragile", "frame", "frequent", "fresh", "friend",
115
- "fringe", "frog", "front", "frost", "frown", "frozen", "fruit", "fuel",
116
- "fun", "funny", "furnace", "fury", "future", "gadget", "gain", "galaxy",
117
- "gallery", "game", "gap", "garage", "garbage", "garden", "garlic", "garment",
118
- "gas", "gasp", "gate", "gather", "gauge", "gaze", "general", "genius",
119
- "genre", "gentle", "genuine", "gesture", "ghost", "giant", "gift", "giggle",
120
- "ginger", "giraffe", "girl", "give", "glad", "glance", "glare", "glass",
121
- "glide", "glimpse", "globe", "gloom", "glory", "glove", "glow", "glue",
122
- "goat", "goddess", "gold", "good", "goose", "gorilla", "gospel", "gossip",
123
- "govern", "gown", "grab", "grace", "grain", "grant", "grape", "grass",
124
- "gravity", "great", "green", "grid", "grief", "grit", "grocery", "group",
125
- "grow", "grunt", "guard", "guess", "guide", "guilt", "guitar", "gun",
126
- "gym", "habit", "hair", "half", "hammer", "hamster", "hand", "happy",
127
- "harbor", "hard", "harsh", "harvest", "hat", "have", "hawk", "hazard",
128
- "head", "health", "heart", "heavy", "hedgehog", "height", "hello", "helmet",
129
- "help", "hen", "hero", "hidden", "high", "hill", "hint", "hip",
130
- "hire", "history", "hobby", "hockey", "hold", "hole", "holiday", "hollow",
131
- "home", "honey", "hood", "hope", "horn", "horror", "horse", "hospital",
132
- "host", "hotel", "hour", "hover", "hub", "huge", "human", "humble",
133
- "humor", "hundred", "hungry", "hunt", "hurdle", "hurry", "hurt", "husband",
134
- "hybrid", "ice", "icon", "idea", "identify", "idle", "ignore", "ill",
135
- "illegal", "illness", "image", "imitate", "immense", "immune", "impact", "impose",
136
- "improve", "impulse", "inch", "include", "income", "increase", "index", "indicate",
137
- "indoor", "industry", "infant", "inflict", "inform", "inhale", "inherit", "initial",
138
- "inject", "injury", "inmate", "inner", "innocent", "input", "inquiry", "insane",
139
- "insect", "inside", "inspire", "install", "intact", "interest", "into", "invest",
140
- "invite", "involve", "iron", "island", "isolate", "issue", "item", "ivory",
141
- "jacket", "jaguar", "jar", "jazz", "jealous", "jeans", "jelly", "jewel",
142
- "job", "join", "joke", "journey", "joy", "judge", "juice", "jump",
143
- "jungle", "junior", "junk", "just", "kangaroo", "keen", "keep", "ketchup",
144
- "key", "kick", "kid", "kidney", "kind", "kingdom", "kiss", "kit",
145
- "kitchen", "kite", "kitten", "kiwi", "knee", "knife", "knock", "know",
146
- "lab", "label", "labor", "ladder", "lady", "lake", "lamp", "language",
147
- "laptop", "large", "later", "latin", "laugh", "laundry", "lava", "law",
148
- "lawn", "lawsuit", "layer", "lazy", "leader", "leaf", "learn", "leave",
149
- "lecture", "left", "leg", "legal", "legend", "leisure", "lemon", "lend",
150
- "length", "lens", "leopard", "lesson", "letter", "level", "liar", "liberty",
151
- "library", "license", "life", "lift", "light", "like", "limb", "limit",
152
- "link", "lion", "liquid", "list", "little", "live", "lizard", "load",
153
- "loan", "lobster", "local", "lock", "logic", "lonely", "long", "loop",
154
- "lottery", "loud", "lounge", "love", "loyal", "lucky", "luggage", "lumber",
155
- "lunar", "lunch", "luxury", "lyrics", "machine", "mad", "magic", "magnet",
156
- "maid", "mail", "main", "major", "make", "mammal", "man", "manage",
157
- "mandate", "mango", "mansion", "manual", "maple", "marble", "march", "margin",
158
- "marine", "market", "marriage", "mask", "mass", "master", "match", "material",
159
- "math", "matrix", "matter", "maximum", "maze", "meadow", "mean", "measure",
160
- "meat", "mechanic", "medal", "media", "melody", "melt", "member", "memory",
161
- "mention", "menu", "mercy", "merge", "merit", "merry", "mesh", "message",
162
- "metal", "method", "middle", "midnight", "milk", "million", "mimic", "mind",
163
- "minimum", "minor", "minute", "miracle", "mirror", "misery", "miss", "mistake",
164
- "mix", "mixed", "mixture", "mobile", "model", "modify", "mom", "moment",
165
- "monitor", "monkey", "monster", "month", "moon", "moral", "more", "morning",
166
- "mosquito", "mother", "motion", "motor", "mountain", "mouse", "move", "movie",
167
- "much", "muffin", "mule", "multiply", "muscle", "museum", "mushroom", "music",
168
- "must", "mutual", "myself", "mystery", "myth", "naive", "name", "napkin",
169
- "narrow", "nasty", "nation", "nature", "near", "neck", "need", "negative",
170
- "neglect", "neither", "nephew", "nerve", "nest", "net", "network", "neutral",
171
- "never", "news", "next", "nice", "night", "noble", "noise", "nominee",
172
- "noodle", "normal", "north", "nose", "notable", "note", "nothing", "notice",
173
- "novel", "now", "nuclear", "number", "nurse", "nut", "oak", "obey",
174
- "object", "oblige", "obscure", "observe", "obtain", "obvious", "occur", "ocean",
175
- "october", "odor", "off", "offer", "office", "often", "oil", "okay",
176
- "old", "olive", "olympic", "omit", "once", "one", "onion", "online",
177
- "only", "open", "opera", "opinion", "oppose", "option", "orange", "orbit",
178
- "orchard", "order", "ordinary", "organ", "orient", "original", "orphan", "ostrich",
179
- "other", "outdoor", "outer", "output", "outside", "oval", "oven", "over",
180
- "own", "owner", "oxygen", "oyster", "ozone", "pact", "paddle", "page",
181
- "pair", "palace", "palm", "panda", "panel", "panic", "panther", "paper",
182
- "parade", "parent", "park", "parrot", "party", "pass", "patch", "path",
183
- "patient", "patrol", "pattern", "pause", "pave", "payment", "peace", "peanut",
184
- "pear", "peasant", "pelican", "pen", "penalty", "pencil", "people", "pepper",
185
- "perfect", "permit", "person", "pet", "phone", "photo", "phrase", "physical",
186
- "piano", "picnic", "picture", "piece", "pig", "pigeon", "pill", "pilot",
187
- "pink", "pioneer", "pipe", "pistol", "pitch", "pizza", "place", "planet",
188
- "plastic", "plate", "play", "please", "pledge", "pluck", "plug", "plunge",
189
- "poem", "poet", "point", "polar", "pole", "police", "pond", "pony",
190
- "pool", "popular", "portion", "position", "possible", "post", "potato", "pottery",
191
- "poverty", "powder", "power", "practice", "praise", "predict", "prefer", "prepare",
192
- "present", "pretty", "prevent", "price", "pride", "primary", "print", "priority",
193
- "prison", "private", "prize", "problem", "process", "produce", "profit", "program",
194
- "project", "promote", "proof", "property", "prosper", "protect", "proud", "provide",
195
- "public", "pudding", "pull", "pulp", "pulse", "pumpkin", "punch", "pupil",
196
- "puppy", "purchase", "purity", "purpose", "purse", "push", "put", "puzzle",
197
- "pyramid", "quality", "quantum", "quarter", "question", "quick", "quit", "quiz",
198
- "quote", "rabbit", "raccoon", "race", "rack", "radar", "radio", "rail",
199
- "rain", "raise", "rally", "ramp", "ranch", "random", "range", "rapid",
200
- "rare", "rate", "rather", "raven", "raw", "razor", "ready", "real",
201
- "reason", "rebel", "rebuild", "recall", "receive", "recipe", "record", "recycle",
202
- "reduce", "reflect", "reform", "refuse", "region", "regret", "regular", "reject",
203
- "relax", "release", "relief", "rely", "remain", "remember", "remind", "remove",
204
- "render", "renew", "rent", "reopen", "repair", "repeat", "replace", "report",
205
- "require", "rescue", "resemble", "resist", "resource", "response", "result", "retire",
206
- "retreat", "return", "reunion", "reveal", "review", "reward", "rhythm", "rib",
207
- "ribbon", "rice", "rich", "ride", "ridge", "rifle", "right", "rigid",
208
- "ring", "riot", "ripple", "risk", "ritual", "rival", "river", "road",
209
- "roast", "robot", "robust", "rocket", "romance", "roof", "rookie", "room",
210
- "rose", "rotate", "rough", "round", "route", "royal", "rubber", "rude",
211
- "rug", "rule", "run", "runway", "rural", "sad", "saddle", "sadness",
212
- "safe", "sail", "salad", "salmon", "salon", "salt", "salute", "same",
213
- "sample", "sand", "satisfy", "satoshi", "sauce", "sausage", "save", "say",
214
- "scale", "scan", "scare", "scatter", "scene", "scheme", "school", "science",
215
- "scissors", "scorpion", "scout", "scrap", "screen", "script", "scrub", "sea",
216
- "search", "season", "seat", "second", "secret", "section", "security", "seed",
217
- "seek", "segment", "select", "sell", "seminar", "senior", "sense", "sentence",
218
- "series", "service", "session", "settle", "setup", "seven", "shadow", "shaft",
219
- "shallow", "share", "shed", "shell", "sheriff", "shield", "shift", "shine",
220
- "ship", "shiver", "shock", "shoe", "shoot", "shop", "short", "shoulder",
221
- "shove", "shrimp", "shrug", "shuffle", "shy", "sibling", "sick", "side",
222
- "siege", "sight", "sign", "silent", "silk", "silly", "silver", "similar",
223
- "simple", "since", "sing", "siren", "sister", "situate", "six", "size",
224
- "skate", "sketch", "ski", "skill", "skin", "skirt", "skull", "slab",
225
- "slam", "sleep", "slender", "slice", "slide", "slight", "slim", "slogan",
226
- "slot", "slow", "slush", "small", "smart", "smile", "smoke", "smooth",
227
- "snack", "snake", "snap", "sniff", "snow", "soap", "soccer", "social",
228
- "sock", "soda", "soft", "solar", "soldier", "solid", "solution", "solve",
229
- "someone", "song", "soon", "sorry", "sort", "soul", "sound", "soup",
230
- "source", "south", "space", "spare", "spatial", "spawn", "speak", "special",
231
- "speed", "spell", "spend", "sphere", "spice", "spider", "spike", "spin",
232
- "spirit", "split", "spoil", "sponsor", "spoon", "sport", "spot", "spray",
233
- "spread", "spring", "spy", "square", "squeeze", "squirrel", "stable", "stadium",
234
- "staff", "stage", "stairs", "stamp", "stand", "start", "state", "stay",
235
- "steak", "steel", "stem", "step", "stereo", "stick", "still", "sting",
236
- "stock", "stomach", "stone", "stool", "story", "stove", "strategy", "street",
237
- "strike", "strong", "struggle", "student", "stuff", "stumble", "style", "subject",
238
- "submit", "subway", "success", "such", "sudden", "suffer", "sugar", "suggest",
239
- "suit", "summer", "sun", "sunny", "sunset", "super", "supply", "supreme",
240
- "sure", "surface", "surge", "surprise", "surround", "survey", "suspect", "sustain",
241
- "swallow", "swamp", "swap", "swarm", "swear", "sweet", "swift", "swim",
242
- "swing", "switch", "sword", "symbol", "symptom", "syrup", "system", "table",
243
- "tackle", "tag", "tail", "talent", "talk", "tank", "tape", "target",
244
- "task", "taste", "tattoo", "taxi", "teach", "team", "tell", "ten",
245
- "tenant", "tennis", "tent", "term", "test", "text", "thank", "that",
246
- "theme", "then", "theory", "there", "they", "thing", "this", "thought",
247
- "three", "thrive", "throw", "thumb", "thunder", "ticket", "tide", "tiger",
248
- "tilt", "timber", "time", "tiny", "tip", "tired", "tissue", "title",
249
- "toast", "tobacco", "today", "toddler", "toe", "together", "toilet", "token",
250
- "tomato", "tomorrow", "tone", "tongue", "tonight", "tool", "tooth", "top",
251
- "topic", "topple", "torch", "tornado", "tortoise", "toss", "total", "tourist",
252
- "toward", "tower", "town", "toy", "track", "trade", "traffic", "tragic",
253
- "train", "transfer", "trap", "trash", "travel", "tray", "treat", "tree",
254
- "trend", "trial", "tribe", "trick", "trigger", "trim", "trip", "trophy",
255
- "trouble", "truck", "true", "truly", "trumpet", "trust", "truth", "try",
256
- "tube", "tuition", "tumble", "tuna", "tunnel", "turkey", "turn", "turtle",
257
- "twelve", "twenty", "twice", "twin", "twist", "two", "type", "typical",
258
- "ugly", "umbrella", "unable", "unaware", "uncle", "uncover", "under", "undo",
259
- "unfair", "unfold", "unhappy", "uniform", "unique", "unit", "universe", "unknown",
260
- "unlock", "until", "unusual", "unveil", "update", "upgrade", "uphold", "upon",
261
- "upper", "upset", "urban", "urge", "usage", "use", "used", "useful",
262
- "useless", "usual", "utility", "vacant", "vacuum", "vague", "valid", "valley",
263
- "valve", "van", "vanish", "vapor", "various", "vast", "vault", "vehicle",
264
- "velvet", "vendor", "venture", "venue", "verb", "verify", "version", "very",
265
- "vessel", "veteran", "viable", "vibrant", "vicious", "victory", "video", "view",
266
- "village", "vintage", "violin", "virtual", "virus", "visa", "visit", "visual",
267
- "vital", "vivid", "vocal", "voice", "void", "volcano", "volume", "vote",
268
- "voyage", "wage", "wagon", "wait", "walk", "wall", "walnut", "want",
269
- "warfare", "warm", "warrior", "wash", "wasp", "waste", "water", "wave",
270
- "way", "wealth", "weapon", "wear", "weasel", "weather", "web", "wedding",
271
- "weekend", "weird", "welcome", "west", "wet", "whale", "what", "wheat",
272
- "wheel", "when", "where", "whip", "whisper", "wide", "width", "wife",
273
- "wild", "will", "win", "window", "wine", "wing", "wink", "winner",
274
- "winter", "wire", "wisdom", "wise", "wish", "witness", "wolf", "woman",
275
- "wonder", "wood", "wool", "word", "work", "world", "worry", "worth",
276
- "wrap", "wreck", "wrestle", "wrist", "write", "wrong", "yard", "year",
277
- "yellow", "you", "young", "youth", "zebra", "zero", "zone", "zoo"
278
- ];
279
-
280
- /**
281
- * Clean and normalize a seed phrase matching Minima's BIP39.cleanSeedPhrase() exactly
282
- *
283
- * From BIP39.java:
284
- * - Split by whitespace
285
- * - For each token: lowercase; length >= 3 required
286
- * - If token length < 4: must match full word in wordlist
287
- * - Else: accept FIRST word in wordlist that startsWith(token)
288
- * - Join with single spaces, trim, then convert to UPPERCASE
289
- *
290
- * @param seedPhrase - Raw user input (may be abbreviated, mixed case)
291
- * @returns Canonical uppercase phrase with full words from BIP39 list
292
- * @throws Error if any word cannot be matched
293
- */
294
- export function cleanSeedPhrase(seedPhrase: string): string {
295
- const tokens = seedPhrase.trim().split(/\s+/);
296
- const matchedWords: string[] = [];
297
-
298
- for (const rawToken of tokens) {
299
- const token = rawToken.toLowerCase();
300
-
301
- if (token.length < 3) {
302
- throw new Error(`Word too short: "${rawToken}" (minimum 3 characters)`);
303
- }
304
-
305
- let found = false;
306
-
307
- if (token.length < 4) {
308
- for (const word of WORD_LIST) {
309
- if (token === word) {
310
- matchedWords.push(word);
311
- found = true;
312
- break;
313
- }
314
- }
315
- } else {
316
- for (const word of WORD_LIST) {
317
- if (word.startsWith(token)) {
318
- matchedWords.push(word);
319
- found = true;
320
- break;
321
- }
322
- }
323
- }
324
-
325
- if (!found) {
326
- throw new Error(`Unknown BIP39 word: "${rawToken}"`);
327
- }
328
- }
329
-
330
- return matchedWords.join(' ').trim().toUpperCase();
331
- }
332
-
333
- /**
334
- * Validate that a phrase contains valid BIP39 words
335
- * Does NOT check checksum (Minima doesn't use checksums)
336
- *
337
- * @param phrase - Space-separated words (any case)
338
- * @returns true if all words are valid BIP39 words
339
- */
340
- export function validatePhrase(phrase: string): boolean {
341
- try {
342
- cleanSeedPhrase(phrase);
343
- return true;
344
- } catch {
345
- return false;
346
- }
347
- }
348
-
349
- /**
350
- * Convert a seed phrase to a 32-byte seed matching Minima's BIP39.convertStringToSeed()
351
- *
352
- * IMPORTANT: This is NOT standard BIP39!
353
- * Minima simply hashes the phrase bytes with SHA3-256.
354
- * No PBKDF2, no passphrase salt, no "mnemonic" prefix.
355
- *
356
- * From BIP39.java convertStringToSeed():
357
- * MiniString phrase = new MiniString(zPhrase);
358
- * return new MiniData(Crypto.getInstance().hashData(phrase.getData()));
359
- *
360
- * @param phrase - Canonical phrase (should be cleaned first with cleanSeedPhrase)
361
- * @returns 32-byte SHA3-256 seed
362
- */
363
- export function convertStringToSeed(phrase: string): Uint8Array {
364
- const encoder = new TextEncoder();
365
- const phraseBytes = encoder.encode(phrase);
366
- return sha3_256(phraseBytes);
367
- }
368
-
369
- /**
370
- * Convert word array to seed matching Minima's BIP39.convertWordListToSeed()
371
- *
372
- * From BIP39.java:
373
- * String allwords = convertWordListToString(zWords);
374
- * MiniString ministr = new MiniString(allwords);
375
- * MiniData hash = new MiniData(Crypto.getInstance().hashData(ministr.getData()));
376
- *
377
- * @param words - Array of BIP39 words
378
- * @returns 32-byte SHA3-256 seed
379
- */
380
- export function convertWordListToSeed(words: string[]): Uint8Array {
381
- const phrase = words.join(' ').trim();
382
- return convertStringToSeed(phrase);
383
- }
384
-
385
- /**
386
- * Full pipeline: raw user input → 32-byte seed
387
- *
388
- * 1. cleanSeedPhrase() - normalize with prefix matching, output uppercase
389
- * 2. convertStringToSeed() - SHA3-256 hash of phrase bytes
390
- *
391
- * @param rawPhrase - User's input (may be abbreviated, mixed case)
392
- * @returns 32-byte seed for TreeKey
393
- * @throws Error if phrase contains invalid words
394
- */
395
- export function phraseToSeed(rawPhrase: string): Uint8Array {
396
- const canonical = cleanSeedPhrase(rawPhrase);
397
- return convertStringToSeed(canonical);
398
- }
399
-
400
- /**
401
- * Generate a new random 24-word seed phrase
402
- * Uses crypto.getRandomValues for secure randomness
403
- *
404
- * @returns Array of 24 random BIP39 words (lowercase)
405
- */
406
- export function generateWordList(): string[] {
407
- const words: string[] = [];
408
- const randomValues = new Uint32Array(24);
409
-
410
- if (typeof crypto !== 'undefined' && crypto.getRandomValues) {
411
- crypto.getRandomValues(randomValues);
412
- } else {
413
- for (let i = 0; i < 24; i++) {
414
- randomValues[i] = Math.floor(Math.random() * 0x100000000);
415
- }
416
- }
417
-
418
- for (let i = 0; i < 24; i++) {
419
- const index = randomValues[i] % WORD_LIST.length;
420
- words.push(WORD_LIST[index]);
421
- }
422
-
423
- return words;
424
- }
425
-
426
- /**
427
- * Generate a new random seed phrase as a string
428
- * @returns 24-word phrase in UPPERCASE (canonical form)
429
- */
430
- export function generateSeedPhrase(): string {
431
- return generateWordList().join(' ').toUpperCase();
432
- }
package/src/derive.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export declare function scriptToAddress(script: string): string;
2
- export declare function addressToRoot(mx: string): Uint8Array;
package/src/derive.js DELETED
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scriptToAddress = scriptToAddress;
4
- exports.addressToRoot = addressToRoot;
5
- const mmr_1 = require("./mmr");
6
- const minima32_1 = require("./minima32");
7
- function scriptToAddress(script) {
8
- const root32 = (0, mmr_1.mmrRootFromSingleLeaf)(script); // raw 32 bytes
9
- return (0, minima32_1.encodeMx)(root32); // builds sentinel+len+checksum
10
- }
11
- function addressToRoot(mx) {
12
- return (0, minima32_1.decodeMx)(mx); // returns the same raw 32 bytes, validates checksum/frame
13
- }
package/src/derive.ts DELETED
@@ -1,11 +0,0 @@
1
- import { mmrRootFromSingleLeaf } from "./mmr.js";
2
- import { makeMxAddress, parseMxAddress } from "./minima32.js";
3
-
4
- export function scriptToAddress(script: string): string {
5
- const root32 = mmrRootFromSingleLeaf(script);
6
- return makeMxAddress(root32);
7
- }
8
-
9
- export function addressToRoot(mx: string): Uint8Array {
10
- return parseMxAddress(mx);
11
- }
package/src/index.d.ts DELETED
@@ -1,26 +0,0 @@
1
- /**
2
- * @module @totemsdk/core
3
- * Core cryptographic primitives, adapters, and utilities for Minima blockchain
4
- */
5
- export * from './adapters';
6
- export { LeaseStore, WatermarkStore, LeaseMonitor, prepareLease, finalizeLease, flatIndexFromLanes, type StoredLease, type LeaseStatus, type LeaseStoreConfig, type LeaseWotsIndices, type WatermarkState, type SyncResult, type WatermarkStoreConfig, type LeaseExpiryEvent, type LeaseExpiryCallback, type LeaseMonitorConfig, type PrepareArgs, type PrepareResp, } from './lease';
7
- export { TransactionService, TransactionLifecycle, TransactionLifecycleError, WatermarkExhaustedError, TransactionReceiptStore, type TransactionServiceConfig, type WotsSigningDependencies, type TransactionLifecycleConfig, type WatermarkSyncFunction, type PrepareResult, type TransactionReceiptStoreConfig, type PrepareRequest, type PrepareResponse, type SignRequest, type SignResult, type WitnessBundle, type FinalizeRequest, type FinalizeResponse, type TransactionMetadata, type TransactionReceipt, type TransactionError, } from './tx';
8
- export type { WotsIndices } from './tx';
9
- export * from './utils';
10
- export { F, hex, fromHex, u16be, u32be, assert32, h, prfChainSeed, toWinternitzDigits, baseWWithChecksum, derivePKdigest, wotsKeypairFromSeed, wotsSign, wotsSignLegacy, wotsPkFromSig, wotsVerify, wotsPublicKeyFromSeed, type WotsKeypair, type WotsSignature, } from './wots';
11
- export * from './params';
12
- export { serializeMiniNumber, serializeMiniData, hashAllObjects, deriveChainSeedJava, deriveChildTreeSeedJava, hashObject, serializeMiniNumberZERO, serializeMiniNumberONE, writeHashToStream, javaHashAllObjects, indexToMiniDataBytes, derivePerAddressSeed, createMMREntryNumber, serializeMMREntryNumber, serializeMMRData, serializeMMREntry, type MMREntryNumber as JavaMMREntryNumber, type MMRData as JavaMMRData, type MMREntry as JavaMMREntry, } from './javaStreamables';
13
- export { TreeKey, type KeyGenProgress, type ProgressCallback, TreeKeyNode, verifyTreeSignature, serializeTreeSignature, deserializeTreeSignature, getRootPublicKey, DEFAULT_KEYS_PER_LEVEL, DEFAULT_LEVELS, type SignatureProof, type TreeSignature, createPerAddressTreeKey, createPerAddressTreeKeyAsync, deriveAddressPublicKey, getPerAddressPublicKey, } from './treekey';
14
- export { scriptFromWotsPk, wotsAddressFromKeypair } from './script';
15
- export * from './minima32';
16
- export * from './mmr';
17
- export { scriptToAddress, addressToRoot } from './derive';
18
- export { WORD_LIST, cleanSeedPhrase, validatePhrase, convertStringToSeed, convertWordListToSeed, phraseToSeed, generateWordList, generateSeedPhrase, } from './bip39';
19
- export declare const MINIMA_CONSTANTS: {
20
- readonly WOTS_W: 8;
21
- readonly WOTS_N: 32;
22
- readonly MAX_SIGNATURES: 262144;
23
- readonly SIGNATURE_LEVELS: 3;
24
- readonly ADDRESS_PREFIX: "Mx";
25
- readonly NETWORK_ID: 1;
26
- };