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