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