@ninsei-labs/sdk 0.56.1 → 0.58.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/LICENSE-POLICY.md +9 -2
  3. package/README.md +78 -28
  4. package/THIRD_PARTY_NOTICES.md +176 -2
  5. package/assets/vendors/MANIFEST.json +1 -13
  6. package/assets/vendors/sdk/sdk-browser.js +5 -4
  7. package/engine/atomic/dleq2.js +116 -15
  8. package/engine/atomic/order.js +21 -3
  9. package/engine/core/config.js +20 -46
  10. package/engine/core/deployments.generated.js +103 -0
  11. package/engine/core/rfqSource.js +6 -133
  12. package/engine/core/swap.js +8 -8
  13. package/engine/evm/asyncRoute.js +1 -1
  14. package/engine/evm/claimGas.js +2 -1
  15. package/engine/evm/escrow.js +13 -8
  16. package/engine/evm/factory.js +11 -6
  17. package/engine/evm/funding.js +8 -3
  18. package/engine/evm/index.js +5 -6
  19. package/engine/evm/session.js +48 -279
  20. package/engine/monero/address.js +15 -33
  21. package/engine/monero/keys.js +124 -0
  22. package/engine/monero/mnemonic.js +104 -0
  23. package/engine/monero/scan.js +121 -28
  24. package/engine/monero/wallet.js +31 -68
  25. package/engine/monero/wordlist.en.js +210 -0
  26. package/engine/recovery/restore.js +9 -9
  27. package/engine/sdk/bridge.js +9 -187
  28. package/engine/ui/walletModal.js +7 -27
  29. package/index.d.ts +234 -262
  30. package/package.json +7 -6
  31. package/src/actions.mjs +8 -5
  32. package/src/codes.mjs +17 -0
  33. package/src/config.mjs +17 -54
  34. package/src/engine.mjs +9 -6
  35. package/src/feeEstimate.mjs +11 -4
  36. package/src/http.mjs +4 -1
  37. package/src/index.mjs +24 -45
  38. package/src/legs/kyber.mjs +23 -0
  39. package/src/lock.mjs +1 -0
  40. package/src/order.mjs +110 -22
  41. package/src/primitives.mjs +4 -5
  42. package/src/probes.mjs +9 -3
  43. package/src/public/networks.d.ts +45 -0
  44. package/src/public/networks.mjs +10 -1
  45. package/src/public/recovery.d.ts +17 -1
  46. package/src/public/recovery.mjs +1 -0
  47. package/src/public/xmr.mjs +1 -1
  48. package/src/quotePolicy.mjs +25 -0
  49. package/src/quotes.mjs +109 -765
  50. package/src/readyWindow.mjs +76 -0
  51. package/src/recovery-key.mjs +71 -16
  52. package/src/recovery.mjs +11 -28
  53. package/src/relayClaim.mjs +132 -0
  54. package/src/relayFeatures.mjs +25 -13
  55. package/src/relayFirmClient.mjs +36 -7
  56. package/src/relayQuote.mjs +92 -11
  57. package/src/relayView.mjs +3 -3
  58. package/src/swap-flow.mjs +146 -60
  59. package/src/swaps.mjs +521 -357
  60. package/src/sweep-action.mjs +73 -0
  61. package/src/sweep-restore.mjs +8 -4
  62. package/src/sweep.mjs +12 -2
  63. package/src/version.mjs +1 -1
  64. package/src/xmr-arrival.mjs +328 -29
  65. package/src/xmrAmountPolicy.mjs +35 -0
  66. package/assets/vendors/atomic/atomic-browser.js +0 -24
  67. package/assets/vendors/monero/monero-js-browser.js +0 -58
  68. package/assets/vendors/monero-js/LICENSE +0 -9
  69. package/assets/vendors/walletconnect/wc-browser.js +0 -6202
  70. package/engine/atomic/order-client.js +0 -56
  71. package/engine/atomic/order-worker.js +0 -156
  72. package/engine/evm/asyncExec.js +0 -577
  73. package/engine/evm/asyncLegs.js +0 -308
@@ -0,0 +1,210 @@
1
+ // THE MONERO ENGLISH WORDLIST.
2
+ //
3
+ // Copied from the Monero mnemonic specification (1626 words). The list is data, not code: no dependency is
4
+ // involved in loading it.
5
+ export const WORDLIST = [
6
+ "abbey", "abducts", "ability", "ablaze", "abnormal", "abort", "abrasive", "absorb",
7
+ "abyss", "academy", "aces", "aching", "acidic", "acoustic", "acquire", "across",
8
+ "actress", "acumen", "adapt", "addicted", "adept", "adhesive", "adjust", "adopt",
9
+ "adrenalin", "adult", "adventure", "aerial", "afar", "affair", "afield", "afloat",
10
+ "afoot", "afraid", "after", "against", "agenda", "aggravate", "agile", "aglow",
11
+ "agnostic", "agony", "agreed", "ahead", "aided", "ailments", "aimless", "airport",
12
+ "aisle", "ajar", "akin", "alarms", "album", "alchemy", "alerts", "algebra",
13
+ "alkaline", "alley", "almost", "aloof", "alpine", "already", "also", "altitude",
14
+ "alumni", "always", "amaze", "ambush", "amended", "amidst", "ammo", "amnesty",
15
+ "among", "amply", "amused", "anchor", "android", "anecdote", "angled", "ankle",
16
+ "annoyed", "answers", "antics", "anvil", "anxiety", "anybody", "apart", "apex",
17
+ "aphid", "aplomb", "apology", "apply", "apricot", "aptitude", "aquarium", "arbitrary",
18
+ "archer", "ardent", "arena", "argue", "arises", "army", "around", "arrow",
19
+ "arsenic", "artistic", "ascend", "ashtray", "aside", "asked", "asleep", "aspire",
20
+ "assorted", "asylum", "athlete", "atlas", "atom", "atrium", "attire", "auburn",
21
+ "auctions", "audio", "august", "aunt", "austere", "autumn", "avatar", "avidly",
22
+ "avoid", "awakened", "awesome", "awful", "awkward", "awning", "awoken", "axes",
23
+ "axis", "axle", "aztec", "azure", "baby", "bacon", "badge", "baffles",
24
+ "bagpipe", "bailed", "bakery", "balding", "bamboo", "banjo", "baptism", "basin",
25
+ "batch", "bawled", "bays", "because", "beer", "befit", "begun", "behind",
26
+ "being", "below", "bemused", "benches", "berries", "bested", "betting", "bevel",
27
+ "beware", "beyond", "bias", "bicycle", "bids", "bifocals", "biggest", "bikini",
28
+ "bimonthly", "binocular", "biology", "biplane", "birth", "biscuit", "bite", "biweekly",
29
+ "blender", "blip", "bluntly", "boat", "bobsled", "bodies", "bogeys", "boil",
30
+ "boldly", "bomb", "border", "boss", "both", "bounced", "bovine", "bowling",
31
+ "boxes", "boyfriend", "broken", "brunt", "bubble", "buckets", "budget", "buffet",
32
+ "bugs", "building", "bulb", "bumper", "bunch", "business", "butter", "buying",
33
+ "buzzer", "bygones", "byline", "bypass", "cabin", "cactus", "cadets", "cafe",
34
+ "cage", "cajun", "cake", "calamity", "camp", "candy", "casket", "catch",
35
+ "cause", "cavernous", "cease", "cedar", "ceiling", "cell", "cement", "cent",
36
+ "certain", "chlorine", "chrome", "cider", "cigar", "cinema", "circle", "cistern",
37
+ "citadel", "civilian", "claim", "click", "clue", "coal", "cobra", "cocoa",
38
+ "code", "coexist", "coffee", "cogs", "cohesive", "coils", "colony", "comb",
39
+ "cool", "copy", "corrode", "costume", "cottage", "cousin", "cowl", "criminal",
40
+ "cube", "cucumber", "cuddled", "cuffs", "cuisine", "cunning", "cupcake", "custom",
41
+ "cycling", "cylinder", "cynical", "dabbing", "dads", "daft", "dagger", "daily",
42
+ "damp", "dangerous", "dapper", "darted", "dash", "dating", "dauntless", "dawn",
43
+ "daytime", "dazed", "debut", "decay", "dedicated", "deepest", "deftly", "degrees",
44
+ "dehydrate", "deity", "dejected", "delayed", "demonstrate", "dented", "deodorant", "depth",
45
+ "desk", "devoid", "dewdrop", "dexterity", "dialect", "dice", "diet", "different",
46
+ "digit", "dilute", "dime", "dinner", "diode", "diplomat", "directed", "distance",
47
+ "ditch", "divers", "dizzy", "doctor", "dodge", "does", "dogs", "doing",
48
+ "dolphin", "domestic", "donuts", "doorway", "dormant", "dosage", "dotted", "double",
49
+ "dove", "down", "dozen", "dreams", "drinks", "drowning", "drunk", "drying",
50
+ "dual", "dubbed", "duckling", "dude", "duets", "duke", "dullness", "dummy",
51
+ "dunes", "duplex", "duration", "dusted", "duties", "dwarf", "dwelt", "dwindling",
52
+ "dying", "dynamite", "dyslexic", "each", "eagle", "earth", "easy", "eating",
53
+ "eavesdrop", "eccentric", "echo", "eclipse", "economics", "ecstatic", "eden", "edgy",
54
+ "edited", "educated", "eels", "efficient", "eggs", "egotistic", "eight", "either",
55
+ "eject", "elapse", "elbow", "eldest", "eleven", "elite", "elope", "else",
56
+ "eluded", "emails", "ember", "emerge", "emit", "emotion", "empty", "emulate",
57
+ "energy", "enforce", "enhanced", "enigma", "enjoy", "enlist", "enmity", "enough",
58
+ "enraged", "ensign", "entrance", "envy", "epoxy", "equip", "erase", "erected",
59
+ "erosion", "error", "eskimos", "espionage", "essential", "estate", "etched", "eternal",
60
+ "ethics", "etiquette", "evaluate", "evenings", "evicted", "evolved", "examine", "excess",
61
+ "exhale", "exit", "exotic", "exquisite", "extra", "exult", "fabrics", "factual",
62
+ "fading", "fainted", "faked", "fall", "family", "fancy", "farming", "fatal",
63
+ "faulty", "fawns", "faxed", "fazed", "feast", "february", "federal", "feel",
64
+ "feline", "females", "fences", "ferry", "festival", "fetches", "fever", "fewest",
65
+ "fiat", "fibula", "fictional", "fidget", "fierce", "fifteen", "fight", "films",
66
+ "firm", "fishing", "fitting", "five", "fixate", "fizzle", "fleet", "flippant",
67
+ "flying", "foamy", "focus", "foes", "foggy", "foiled", "folding", "fonts",
68
+ "foolish", "fossil", "fountain", "fowls", "foxes", "foyer", "framed", "friendly",
69
+ "frown", "fruit", "frying", "fudge", "fuel", "fugitive", "fully", "fuming",
70
+ "fungal", "furnished", "fuselage", "future", "fuzzy", "gables", "gadget", "gags",
71
+ "gained", "galaxy", "gambit", "gang", "gasp", "gather", "gauze", "gave",
72
+ "gawk", "gaze", "gearbox", "gecko", "geek", "gels", "gemstone", "general",
73
+ "geometry", "germs", "gesture", "getting", "geyser", "ghetto", "ghost", "giant",
74
+ "giddy", "gifts", "gigantic", "gills", "gimmick", "ginger", "girth", "giving",
75
+ "glass", "gleeful", "glide", "gnaw", "gnome", "goat", "goblet", "godfather",
76
+ "goes", "goggles", "going", "goldfish", "gone", "goodbye", "gopher", "gorilla",
77
+ "gossip", "gotten", "gourmet", "governing", "gown", "greater", "grunt", "guarded",
78
+ "guest", "guide", "gulp", "gumball", "guru", "gusts", "gutter", "guys",
79
+ "gymnast", "gypsy", "gyrate", "habitat", "hacksaw", "haggled", "hairy", "hamburger",
80
+ "happens", "hashing", "hatchet", "haunted", "having", "hawk", "haystack", "hazard",
81
+ "hectare", "hedgehog", "heels", "hefty", "height", "hemlock", "hence", "heron",
82
+ "hesitate", "hexagon", "hickory", "hiding", "highway", "hijack", "hiker", "hills",
83
+ "himself", "hinder", "hippo", "hire", "history", "hitched", "hive", "hoax",
84
+ "hobby", "hockey", "hoisting", "hold", "honked", "hookup", "hope", "hornet",
85
+ "hospital", "hotel", "hounded", "hover", "howls", "hubcaps", "huddle", "huge",
86
+ "hull", "humid", "hunter", "hurried", "husband", "huts", "hybrid", "hydrogen",
87
+ "hyper", "iceberg", "icing", "icon", "identity", "idiom", "idled", "idols",
88
+ "igloo", "ignore", "iguana", "illness", "imagine", "imbalance", "imitate", "impel",
89
+ "inactive", "inbound", "incur", "industrial", "inexact", "inflamed", "ingested", "initiate",
90
+ "injury", "inkling", "inline", "inmate", "innocent", "inorganic", "input", "inquest",
91
+ "inroads", "insult", "intended", "inundate", "invoke", "inwardly", "ionic", "irate",
92
+ "iris", "irony", "irritate", "island", "isolated", "issued", "italics", "itches",
93
+ "items", "itinerary", "itself", "ivory", "jabbed", "jackets", "jaded", "jagged",
94
+ "jailed", "jamming", "january", "jargon", "jaunt", "javelin", "jaws", "jazz",
95
+ "jeans", "jeers", "jellyfish", "jeopardy", "jerseys", "jester", "jetting", "jewels",
96
+ "jigsaw", "jingle", "jittery", "jive", "jobs", "jockey", "jogger", "joining",
97
+ "joking", "jolted", "jostle", "journal", "joyous", "jubilee", "judge", "juggled",
98
+ "juicy", "jukebox", "july", "jump", "junk", "jury", "justice", "juvenile",
99
+ "kangaroo", "karate", "keep", "kennel", "kept", "kernels", "kettle", "keyboard",
100
+ "kickoff", "kidneys", "king", "kiosk", "kisses", "kitchens", "kiwi", "knapsack",
101
+ "knee", "knife", "knowledge", "knuckle", "koala", "laboratory", "ladder", "lagoon",
102
+ "lair", "lakes", "lamb", "language", "laptop", "large", "last", "later",
103
+ "launching", "lava", "lawsuit", "layout", "lazy", "lectures", "ledge", "leech",
104
+ "left", "legion", "leisure", "lemon", "lending", "leopard", "lesson", "lettuce",
105
+ "lexicon", "liar", "library", "licks", "lids", "lied", "lifestyle", "light",
106
+ "likewise", "lilac", "limits", "linen", "lion", "lipstick", "liquid", "listen",
107
+ "lively", "loaded", "lobster", "locker", "lodge", "lofty", "logic", "loincloth",
108
+ "long", "looking", "lopped", "lordship", "losing", "lottery", "loudly", "love",
109
+ "lower", "loyal", "lucky", "luggage", "lukewarm", "lullaby", "lumber", "lunar",
110
+ "lurk", "lush", "luxury", "lymph", "lynx", "lyrics", "macro", "madness",
111
+ "magically", "mailed", "major", "makeup", "malady", "mammal", "maps", "masterful",
112
+ "match", "maul", "maverick", "maximum", "mayor", "maze", "meant", "mechanic",
113
+ "medicate", "meeting", "megabyte", "melting", "memoir", "menu", "merger", "mesh",
114
+ "metro", "mews", "mice", "midst", "mighty", "mime", "mirror", "misery",
115
+ "mittens", "mixture", "moat", "mobile", "mocked", "mohawk", "moisture", "molten",
116
+ "moment", "money", "moon", "mops", "morsel", "mostly", "motherly", "mouth",
117
+ "movement", "mowing", "much", "muddy", "muffin", "mugged", "mullet", "mumble",
118
+ "mundane", "muppet", "mural", "musical", "muzzle", "myriad", "mystery", "myth",
119
+ "nabbing", "nagged", "nail", "names", "nanny", "napkin", "narrate", "nasty",
120
+ "natural", "nautical", "navy", "nearby", "necklace", "needed", "negative", "neither",
121
+ "neon", "nephew", "nerves", "nestle", "network", "neutral", "never", "newt",
122
+ "nexus", "nibs", "niche", "niece", "nifty", "nightly", "nimbly", "nineteen",
123
+ "nirvana", "nitrogen", "nobody", "nocturnal", "nodes", "noises", "nomad", "noodles",
124
+ "northern", "nostril", "noted", "nouns", "novelty", "nowhere", "nozzle", "nuance",
125
+ "nucleus", "nudged", "nugget", "nuisance", "null", "number", "nuns", "nurse",
126
+ "nutshell", "nylon", "oaks", "oars", "oasis", "oatmeal", "obedient", "object",
127
+ "obliged", "obnoxious", "observant", "obtains", "obvious", "occur", "ocean", "october",
128
+ "odds", "odometer", "offend", "often", "oilfield", "ointment", "okay", "older",
129
+ "olive", "olympics", "omega", "omission", "omnibus", "onboard", "oncoming", "oneself",
130
+ "ongoing", "onion", "online", "onslaught", "onto", "onward", "oozed", "opacity",
131
+ "opened", "opposite", "optical", "opus", "orange", "orbit", "orchid", "orders",
132
+ "organs", "origin", "ornament", "orphans", "oscar", "ostrich", "otherwise", "otter",
133
+ "ouch", "ought", "ounce", "ourselves", "oust", "outbreak", "oval", "oven",
134
+ "owed", "owls", "owner", "oxidant", "oxygen", "oyster", "ozone", "pact",
135
+ "paddles", "pager", "pairing", "palace", "pamphlet", "pancakes", "paper", "paradise",
136
+ "pastry", "patio", "pause", "pavements", "pawnshop", "payment", "peaches", "pebbles",
137
+ "peculiar", "pedantic", "peeled", "pegs", "pelican", "pencil", "people", "pepper",
138
+ "perfect", "pests", "petals", "phase", "pheasants", "phone", "phrases", "physics",
139
+ "piano", "picked", "pierce", "pigment", "piloted", "pimple", "pinched", "pioneer",
140
+ "pipeline", "pirate", "pistons", "pitched", "pivot", "pixels", "pizza", "playful",
141
+ "pledge", "pliers", "plotting", "plus", "plywood", "poaching", "pockets", "podcast",
142
+ "poetry", "point", "poker", "polar", "ponies", "pool", "popular", "portents",
143
+ "possible", "potato", "pouch", "poverty", "powder", "pram", "present", "pride",
144
+ "problems", "pruned", "prying", "psychic", "public", "puck", "puddle", "puffin",
145
+ "pulp", "pumpkins", "punch", "puppy", "purged", "push", "putty", "puzzled",
146
+ "pylons", "pyramid", "python", "queen", "quick", "quote", "rabbits", "racetrack",
147
+ "radar", "rafts", "rage", "railway", "raking", "rally", "ramped", "randomly",
148
+ "rapid", "rarest", "rash", "rated", "ravine", "rays", "razor", "react",
149
+ "rebel", "recipe", "reduce", "reef", "refer", "regular", "reheat", "reinvest",
150
+ "rejoices", "rekindle", "relic", "remedy", "renting", "reorder", "repent", "request",
151
+ "reruns", "rest", "return", "reunion", "revamp", "rewind", "rhino", "rhythm",
152
+ "ribbon", "richly", "ridges", "rift", "rigid", "rims", "ringing", "riots",
153
+ "ripped", "rising", "ritual", "river", "roared", "robot", "rockets", "rodent",
154
+ "rogue", "roles", "romance", "roomy", "roped", "roster", "rotate", "rounded",
155
+ "rover", "rowboat", "royal", "ruby", "rudely", "ruffled", "rugged", "ruined",
156
+ "ruling", "rumble", "runway", "rural", "rustled", "ruthless", "sabotage", "sack",
157
+ "sadness", "safety", "saga", "sailor", "sake", "salads", "sample", "sanity",
158
+ "sapling", "sarcasm", "sash", "satin", "saucepan", "saved", "sawmill", "saxophone",
159
+ "sayings", "scamper", "scenic", "school", "science", "scoop", "scrub", "scuba",
160
+ "seasons", "second", "sedan", "seeded", "segments", "seismic", "selfish", "semifinal",
161
+ "sensible", "september", "sequence", "serving", "session", "setup", "seventh", "sewage",
162
+ "shackles", "shelter", "shipped", "shocking", "shrugged", "shuffled", "shyness", "siblings",
163
+ "sickness", "sidekick", "sieve", "sifting", "sighting", "silk", "simplest", "sincerely",
164
+ "sipped", "siren", "situated", "sixteen", "sizes", "skater", "skew", "skirting",
165
+ "skulls", "skydive", "slackens", "sleepless", "slid", "slower", "slug", "smash",
166
+ "smelting", "smidgen", "smog", "smuggled", "snake", "sneeze", "sniff", "snout",
167
+ "snug", "soapy", "sober", "soccer", "soda", "software", "soggy", "soil",
168
+ "solved", "somewhere", "sonic", "soothe", "soprano", "sorry", "southern", "sovereign",
169
+ "sowed", "soya", "space", "speedy", "sphere", "spiders", "splendid", "spout",
170
+ "sprig", "spud", "spying", "square", "stacking", "stellar", "stick", "stockpile",
171
+ "strained", "stunning", "stylishly", "subtly", "succeed", "suddenly", "suede", "suffice",
172
+ "sugar", "suitcase", "sulking", "summon", "sunken", "superior", "surfer", "sushi",
173
+ "suture", "swagger", "swept", "swiftly", "sword", "swung", "syllabus", "symptoms",
174
+ "syndrome", "syringe", "system", "taboo", "tacit", "tadpoles", "tagged", "tail",
175
+ "taken", "talent", "tamper", "tanks", "tapestry", "tarnished", "tasked", "tattoo",
176
+ "taunts", "tavern", "tawny", "taxi", "teardrop", "technical", "tedious", "teeming",
177
+ "tell", "template", "tender", "tepid", "tequila", "terminal", "testing", "tether",
178
+ "textbook", "thaw", "theatrics", "thirsty", "thorn", "threaten", "thumbs", "thwart",
179
+ "ticket", "tidy", "tiers", "tiger", "tilt", "timber", "tinted", "tipsy",
180
+ "tirade", "tissue", "titans", "toaster", "tobacco", "today", "toenail", "toffee",
181
+ "together", "toilet", "token", "tolerant", "tomorrow", "tonic", "toolbox", "topic",
182
+ "torch", "tossed", "total", "touchy", "towel", "toxic", "toyed", "trash",
183
+ "trendy", "tribal", "trolling", "truth", "trying", "tsunami", "tubes", "tucks",
184
+ "tudor", "tuesday", "tufts", "tugs", "tuition", "tulips", "tumbling", "tunnel",
185
+ "turnip", "tusks", "tutor", "tuxedo", "twang", "tweezers", "twice", "twofold",
186
+ "tycoon", "typist", "tyrant", "ugly", "ulcers", "ultimate", "umbrella", "umpire",
187
+ "unafraid", "unbending", "uncle", "under", "uneven", "unfit", "ungainly", "unhappy",
188
+ "union", "unjustly", "unknown", "unlikely", "unmask", "unnoticed", "unopened", "unplugs",
189
+ "unquoted", "unrest", "unsafe", "until", "unusual", "unveil", "unwind", "unzip",
190
+ "upbeat", "upcoming", "update", "upgrade", "uphill", "upkeep", "upload", "upon",
191
+ "upper", "upright", "upstairs", "uptight", "upwards", "urban", "urchins", "urgent",
192
+ "usage", "useful", "usher", "using", "usual", "utensils", "utility", "utmost",
193
+ "utopia", "uttered", "vacation", "vague", "vain", "value", "vampire", "vane",
194
+ "vapidly", "vary", "vastness", "vats", "vaults", "vector", "veered", "vegan",
195
+ "vehicle", "vein", "velvet", "venomous", "verification", "vessel", "veteran", "vexed",
196
+ "vials", "vibrate", "victim", "video", "viewpoint", "vigilant", "viking", "village",
197
+ "vinegar", "violin", "vipers", "virtual", "visited", "vitals", "vivid", "vixen",
198
+ "vocal", "vogue", "voice", "volcano", "vortex", "voted", "voucher", "vowels",
199
+ "voyage", "vulture", "wade", "waffle", "wagtail", "waist", "waking", "wallets",
200
+ "wanted", "warped", "washing", "water", "waveform", "waxing", "wayside", "weavers",
201
+ "website", "wedge", "weekday", "weird", "welders", "went", "wept", "were",
202
+ "western", "wetsuit", "whale", "when", "whipped", "whole", "wickets", "width",
203
+ "wield", "wife", "wiggle", "wildly", "winter", "wipeout", "wiring", "wise",
204
+ "withdrawn", "wives", "wizard", "wobbly", "woes", "woken", "wolf", "womanly",
205
+ "wonders", "woozy", "worry", "wounded", "woven", "wrap", "wrist", "wrong",
206
+ "yacht", "yahoo", "yanks", "yard", "yawning", "yearbook", "yellow", "yesterday",
207
+ "yeti", "yields", "yodel", "yoga", "younger", "yoyo", "zapped", "zeal",
208
+ "zebra", "zero", "zesty", "zigzags", "zinger", "zippers", "zodiac", "zombie",
209
+ "zones", "zoom",
210
+ ];
@@ -20,15 +20,15 @@ import { swapAddressFromHalves, watchViewSeedHex } from "../monero/swapKeys.js";
20
20
  // carries HALVES, and has NO full spend key: each side has only its half, the second is revealed on chain at ETH
21
21
  // claim. So a v3 file builds a VIEWING wallet; spending becomes possible only after the reveal.
22
22
  //
23
- // deps is needed for testability: in the browser the libraries come from the vendored bundle (loaded dynamically,
24
- // as a static bundle import would break Node runs), in tests they are passed in.
23
+ // deps is needed for testability: the SDK passes its own primitives here, and tests pass their own. There is no
24
+ // second browser bundle for this branch.
25
25
  export async function restoreWalletFromPayload(payload, deps = {}) {
26
26
  const { warnings } = validatePayload(payload);
27
27
  const m = payload.moneroWallet;
28
28
  const network = m.network || payload.moneroNetwork;
29
29
  if (payload.version >= 3) return await restoreFromHalves(payload, warnings, deps);
30
30
 
31
- // The mnemonic is passed explicitly: monero-js checks its checksum and refuses a broken phrase
31
+ // The mnemonic is passed explicitly: engine/monero/mnemonic.js checks its checksum and refuses a broken phrase
32
32
  // (in wallet.js this is now an error, not a silent new-wallet generation).
33
33
  const wallet = await createSwapWallet({ seed: m.mnemonic, network });
34
34
 
@@ -70,14 +70,14 @@ export async function restoreFromHalves(payload, warnings = [], deps = {}) {
70
70
  const libs = deps.halves && deps.addressFromKeys
71
71
  ? { halves: deps.halves, addressFromKeys: deps.addressFromKeys, keccak256: deps.keccak256 }
72
72
  : await (async () => {
73
- const vendor = await import("../../assets/vendors/atomic/atomic-browser.js?v=2c038c56");
73
+ // THE SDK'S OWN PRIMITIVES, NOT A SECOND BROWSER BUNDLE. The five names are the same @noble packages
74
+ // the package already ships, and a separate build of them was exactly the duplicated crypto path this
75
+ // recovery branch used to keep alive.
76
+ const { primitives } = await import("../../src/primitives.mjs");
74
77
  const { createHalves } = await import("../atomic/halves.js");
75
78
  const { addressFromKeys } = await import("../monero/address.js");
76
- const halves = createHalves({
77
- ed25519: vendor.ed25519, secp256k1: vendor.secp256k1,
78
- keccak256: vendor.keccak256, randomBytes: vendor.randomBytes,
79
- });
80
- return { halves, addressFromKeys, keccak256: vendor.keccak256 };
79
+ const halves = createHalves(primitives);
80
+ return { halves, addressFromKeys, keccak256: primitives.keccak256 };
81
81
  })();
82
82
  if (!libs.keccak256) throw new Error("no keccak256: the address cannot be checked without it");
83
83
 
@@ -11,8 +11,6 @@
11
11
  //
12
12
  // WHAT THE SHIM PASSES TO THE CORE - exactly the seams the core asks for from outside and cannot get itself:
13
13
  // storage - the page's storage: deals and session are read from where the page puts them (core/store.js);
14
- // serverAuth - a pass to our service: only the wallet can sign the sign-in message (evm/auth.js signIn),
15
- // so the core gets the pass READY-MADE;
16
14
  // evmCall - chain reads WITH THE PAGE'S WALLET: the core has no provider of its own and must not;
17
15
  // wallet - the page wallet adapter (sdk/src/adapters/evm-wallet.mjs): signing happens only in it.
18
16
  //
@@ -38,7 +36,6 @@
38
36
 
39
37
  import { chainById, DEFAULT_CHAIN, MONERO, allowedProvidersFor, knownFactoryCodesFor, knownImplementationCodesFor } from "../core/config.js";
40
38
  import { storage as pageStorage } from "../core/store.js";
41
- import { token as authToken, signIn } from "../evm/auth.js";
42
39
  import * as evm from "../evm/index.js";
43
40
  // ORDER TERMS FOR THE CORE ARE ASSEMBLED FROM DATA, NOT FROM RULES: the windows come from the finality policy
44
41
  // (core/finality.js), the salt from the engine's generator (evm/funding.js). No deadlines or numbers of its own here.
@@ -48,9 +45,8 @@ import { newSecret } from "../evm/funding.js";
48
45
  // exposes EXACTLY the same names (markReadyOrder/claimOrder/refundOrder/orderStatus/orderDeadlines), so a screen
49
46
  // changes only the import source, not the call expression - and the guard that fixes the call site sees the old call.
50
47
  //
51
- // THE DEAL LIST AND ITS UPKEEP (the #/swaps screen). States come from the CORE: swaps.list - display, swaps.sync -
52
- // merging with the server list, swaps.forget - dropping a record. The core needs only the page's seams for this
53
- // (the pass and the storage), and both are already passed above - the shim adds no rules of its own.
48
+ // THE DEAL LIST AND ITS UPKEEP (the #/swaps screen). States come from the CORE: swaps.list - display, swaps.forget -
49
+ // dropping a record. The core needs only the page's storage, and the shim adds no rules of its own.
54
50
  //
55
51
  // WATCHING IS A PAGE MECHANISM, NOT THE CORE'S: the poll tick lives in app.js, so the focus stays in
56
52
  // core/swap.js and the screen only declares it to the shim.
@@ -68,9 +64,9 @@ import { height as nodeHeightValue } from "../monero/node.js";
68
64
 
69
65
  // THE CORE ADDRESS AS A STRING - THE BUILT BUNDLE SHIPPED WITH THE PACKAGE. A relative URL resolves both in the
70
66
  // published `engine/` tree and in the page that serves this shim from `www/js/sdk/`; ?v=<hash> keeps the cache fresh.
71
- const SDK_BUNDLE = new URL("../../assets/vendors/sdk/sdk-browser.js?v=69d79c13", import.meta.url).href;
67
+ const SDK_BUNDLE = new URL("../../assets/vendors/sdk/sdk-browser.js?v=fa7dc71a", import.meta.url).href;
72
68
 
73
- // A NAMED SEAM FOR CHECKS - THE SAME TECHNIQUE AS sdkBookUse BELOW. The asynchronous path is driven against a
69
+ // A NAMED SEAM FOR CHECKS. The asynchronous path is driven against a
74
70
  // stand-in order book (the demo network has no provider), and the ordinary escrow funding that follows a settled
75
71
  // swap can be replaced while that runs, because deploying an escrow factory on a throwaway chain is the stand's
76
72
  // job, not a check's. The replacement is named, set only by a check, and unset by the same function; production
@@ -127,12 +123,6 @@ function optionsFor(chain) {
127
123
  mode: modeOf(chain),
128
124
  // THE PAGE STORAGE BECOMES THE CORE STORAGE: deal records and the session live in one place.
129
125
  storage: pageStorage(),
130
- // A PASS TO OUR SERVICE: the core only presents it; the page wallet obtains it.
131
- serverAuth: async () => {
132
- if (authToken()) return authToken();
133
- try { await signIn(); } catch { return null; }
134
- return authToken();
135
- },
136
126
  // CHAIN READS - WITH THE PAGE'S WALLET (the core needs this seam: it has no provider of its own).
137
127
  evmCall: (request) => evm.readContract(request),
138
128
  // CONTRACT CODE - WITH THE PAGE'S WALLET: needed by the factory-code check, extcodehash is computed from it.
@@ -238,142 +228,6 @@ export async function sdkOpenRecovery(file, passphrase) {
238
228
  // The core is served to the page as a bundle, so these calls go through the REAL facade. They answer null only
239
229
  // if the bundle itself did not load - and then the cause is named in the console, not hidden.
240
230
 
241
- export async function sdkWatchQuotes(request, onSnapshot) {
242
- const ctx = await instanceFor(request && request.chain);
243
- if (!ctx) return null;
244
- return ctx.sdk.quotes.watch(request, onSnapshot);
245
- }
246
-
247
- export async function sdkQuotesSnapshot(chainSlug) {
248
- const ctx = await instanceFor(chainSlug);
249
- return ctx ? ctx.sdk.quotes.snapshot() : null;
250
- }
251
-
252
- // --- THE INDICATIVE QUOTE BOOK ON THE CORE ---------------------------------------------------------
253
- // THE BOOK (offers and refusals) COMES FROM THE CORE: quotes.watch subscribes to the core poll, quotes.snapshot
254
- // returns the last snapshot without waiting. The shim does exactly ONE job here - TRANSLATION OF SHAPE: the core
255
- // snapshot's field names are mapped to those the screen already draws. There is no selection or priority rule
256
- // here: offer, refusal or best is decided by the core (sdk/src/quotes.mjs, readBook). The core is silent or
257
- // refused - the book is empty, and the former (engine) book is not substituted: it no longer exists.
258
- //
259
- // SUBSCRIPTION IS ONE. The core polls for the duration of the subscription; a second listener would be a second
260
- // poll, so the previous subscription is removed BEFORE the new one. The last snapshot survives re-subscription:
261
- // the reader sees the previous book until a fresh one arrives - not emptiness on every tick.
262
- let bookStop = null; // unsubscribe from the core's current subscription
263
- let bookKey = null; // which request (network|side|token|size) this subscription is for
264
- let bookCore = null; // the last CORE snapshot (not the translation): the translation is done on read
265
- let bookResume = null; // waiting for the first tick after subscribing
266
- // A SEAM HOOK (sdkBookUse): a core quote surface brought from outside. Needed by checks that run WITHOUT a
267
- // browser: the core itself is not in the bundle there, and the book must be checked. Not set in production.
268
- let bookQuotes = null;
269
-
270
- // THE CORE FOR CHECKS WITHOUT A BROWSER: put in a quote surface (watch/snapshot) and work with it.
271
- export function sdkBookUse(quotesApi) {
272
- bookQuotes = quotesApi || null;
273
- bookCore = null;
274
- bookKey = null;
275
- bookResume = null;
276
- if (bookStop) { try { bookStop(); } catch { /* already removed */ } }
277
- bookStop = null;
278
- }
279
-
280
- // TRANSLATING A CORE ROW INTO A SCREEN ROW. Names only: values are carried as is. The age is computed
281
- // HERE (from the quote's own timestamp): the core computed it on its own tick, while display asks for freshness
282
- // now - otherwise the quote's lifetime would be rejuvenated by a poll tick.
283
- function bookRow(o) {
284
- const at = Number.isFinite(Number(o.at)) ? Number(o.at) : null;
285
- return {
286
- providerId: o.providerId, displayName: o.displayName, pair: o.pair,
287
- asset: o.asset, currency: o.currency,
288
- assetNetwork: o.assetNetwork, currencyNetwork: o.currencyNetwork, networkStated: o.networkStated === true,
289
- rateQuote: o.rateQuote, rate: o.rate,
290
- min: o.min, max: o.max, step: o.step, ttlMs: o.ttlMs,
291
- at, ageMs: at === null ? null : Math.max(0, Date.now() - at),
292
- seq: o.seq, why: o.why, signature: o.signature, keyId: o.keyId, finality: o.finality,
293
- networksDerived: o.networksDerived === true, networksUnnamed: o.networksUnnamed === true,
294
- };
295
- }
296
-
297
- // THE REFUSAL KIND WITH WHICH THE SCREEN NAMES THE CAUSE. The core code `disabled` is called `off` by the
298
- // screen; other code names match, and there is no reason to rename them.
299
- const REFUSAL_KIND = { disabled: "off" };
300
- function bookRefusal(r) {
301
- return { ...bookRow(r), code: r.code, kind: REFUSAL_KIND[r.code] || r.code, why: r.why };
302
- }
303
-
304
- // CORE SNAPSHOT -> SCREEN SNAPSHOT. The shape is the one the screen had: ok/error/data/at, and in data -
305
- // references (the reference rate) and best. A connection failure does not turn into the former numbers: ok is
306
- // dropped and the screen shows an honest state. Core silence (no snapshot) is also an empty book, not the former one.
307
- function bookOf(core) {
308
- if (!core) return { ok: false, error: null, data: null, at: 0, fetching: false };
309
- const offers = (Array.isArray(core.offers) ? core.offers : []).map(bookRow);
310
- const refused = (Array.isArray(core.refused) ? core.refused : []).map(bookRefusal);
311
- const stamps = offers.map((o) => o.at).filter((v) => Number.isFinite(v));
312
- return {
313
- ok: !core.error,
314
- error: core.error ? String(core.error.code || "unknown") : null,
315
- at: core.at,
316
- fetching: false,
317
- data: {
318
- offers, refused, quotes: offers,
319
- // THE BEST, AS THE SERVICE NAMED IT: by it the screen confirms its "best" mark by pair and provider.
320
- best: core.best || null,
321
- seq: core.seq === undefined ? null : core.seq,
322
- references: Array.isArray(core.references) ? core.references : [],
323
- at: stamps.length ? Math.max(...stamps) : null,
324
- },
325
- };
326
- }
327
-
328
- // ASKING THE CORE FOR THE BOOK. The subscription is ONE and is replayed only when the REQUEST CHANGED: while
329
- // size and side are the same, the core polls the book on its own tick and no second poll is created. When the
330
- // request changed, the caller waits for the first tick and gets a FRESH snapshot, not a previous one. The core
331
- // did not come up - empty (and the console names why).
332
- export async function sdkBook({ chain, direction, token, size } = {}) {
333
- let quotes = bookQuotes;
334
- let instance = "injected"; // the hook (seam) has no network: its instance is one
335
- if (!quotes) {
336
- const ctx = await instanceFor(chain);
337
- if (!ctx) {
338
- if (bookStop) { try { bookStop(); } catch { /* already removed */ } bookStop = null; }
339
- bookKey = null;
340
- bookResume = null;
341
- bookCore = null;
342
- return null;
343
- }
344
- quotes = ctx.sdk.quotes;
345
- instance = ctx.chain.id; // books of different networks must not be mixed: the network is part of the key
346
- }
347
- const dir = direction === "sell" ? "sell" : "buy";
348
- const key = instance + "|" + dir + "|" + String(token || "") + "|" + String(size === undefined || size === null ? "" : size);
349
- // THE SAME REQUEST - A POLL IS ALREADY RUNNING: return the last snapshot, do not create a second subscription.
350
- // Otherwise every screen tick would reset the core state and briefly serve an empty book to a direct reader.
351
- if (bookStop && bookKey === key) return bookCore;
352
- if (bookStop) { try { bookStop(); } catch { /* already removed */ } bookStop = null; }
353
- bookKey = key;
354
- bookResume = null;
355
- const wait = new Promise((resolve) => { bookResume = resolve; });
356
- try {
357
- bookStop = quotes.watch({ direction: dir, token, size }, (snap) => {
358
- bookCore = snap;
359
- if (bookResume) { const resume = bookResume; bookResume = null; resume(); }
360
- });
361
- } catch (error) {
362
- bookResume = null;
363
- bookCore = null;
364
- console.warn("[bridge] the quote book was not served to the core (" + ((error && error.message) || error) +
365
- "): there will be no offers; see www/js/sdk/bridge.js");
366
- return null;
367
- }
368
- await wait;
369
- return bookCore;
370
- }
371
-
372
- // THE LAST SNAPSHOT WITHOUT WAITING - in the screen's shape. The core has not been polled once - empty (and that is honest).
373
- export function sdkBookSnapshot() {
374
- return bookOf(bookCore);
375
- }
376
-
377
231
  export async function sdkListSwaps(chainSlug) {
378
232
  const ctx = await instanceFor(chainSlug);
379
233
  return ctx ? ctx.sdk.swaps.list() : null;
@@ -414,21 +268,6 @@ export function sdkOrderTerms({ chain, amountWei, finality = null, salt = null,
414
268
  };
415
269
  }
416
270
 
417
- // A FIRM QUOTE FOR THE ORDER - BEFORE SIGNING. The screen shows the fee rate and recipient BEFORE the person
418
- // signs, and hands THE SAME quote to the swap start (sdkStartSwap, field orderQuote): exactly what is shown is
419
- // signed, and no second request to the node is made.
420
- //
421
- // WHY THIS PLACE AND NOT THE SCREEN. The order terms (network, factory, depositor, amount, windows, salt) are
422
- // assembled in ONE place - sdkOrderTerms; the screen must not assemble them in a second edition. Here they are
423
- // assembled, a firm quote is requested by them through the core's path, and both go outward: `order` and `quote`.
424
- export async function sdkOrderQuote({ chain, providerId, amountWei, finality = null, salt = null, asset = "XMR" } = {}) {
425
- const ctx = await instanceFor(chain);
426
- if (!ctx) return null;
427
- const order = sdkOrderTerms({ chain: ctx.chain, amountWei, finality, salt, asset });
428
- const quote = await ctx.sdk.quotes.firm({ providerId, order });
429
- return { order, quote };
430
- }
431
-
432
271
  // STARTING THE SWAP WHOLE, BY THE CORE. Step order, the order side, deadlines into the contract, the escrow
433
272
  // address FROM THE RECEIPT, our readiness mark and watching the XMR - all of it is held by the core
434
273
  // (sdk/src/swaps.mjs, swaps.start). The screen passes only data: the quote, where to receive, the password, the
@@ -461,17 +300,8 @@ export async function sdkStartSwap(request) {
461
300
  req.order = sdkOrderTerms({ chain: ctx.chain, amountWei: req.amountWei, finality: req.finality,
462
301
  salt: req.salt, asset: req.receiveAsset });
463
302
  }
464
- // A FIRM QUOTE FOR THIS ORDER - AND IT ALSO GOES INTO THE LOCK. A screen that showed the fee BEFORE signing
465
- // brings the quote READY-MADE (sdkOrderQuote) - then we do not go to the node again and exactly what the person
466
- // saw is signed. If it did not, we request it here through the core's path (config.route("orderQuote")).
467
- //
468
- // WHY THIS SEPARATE FIELD. The lock takes the quote NOT from req.quote: req.quote is the book's indicative
469
- // quote for the guards (freshness, deadlines), while the factory needs a SIGNED SET (fee, registry, provider).
470
- // The core reads it as `request.orderQuote` (sdk/src/swaps.mjs). While the bridge did not put it there, the
471
- // start reached the deposit and failed there: "a signed quote is required: the factory takes a quote, not bare order terms".
472
- if (!req.orderQuote && req.providerId) {
473
- req.orderQuote = await ctx.sdk.quotes.firm({ providerId: req.providerId, order: req.order });
474
- }
303
+ // THE SIGNED QUOTE COMES FROM THE RELAY PATH AND IS PASSED IN. There is no direct node call to fetch one here:
304
+ // a start without `orderQuote` reaches the lock without a signed set and the core refuses it.
475
305
  if (req.orderQuote) {
476
306
  // THE CLAIMER IS NAMED BY THE PROVIDER, and enters the order context: without it the proof would not agree
477
307
  // (the core refuses - context mismatch). Here we only carry its value into the terms.
@@ -502,14 +332,9 @@ export async function sdkWatchSwap(request) {
502
332
 
503
333
  // --- THE DEAL LIST FROM THE CORE (the #/swaps screen) ---------------------------------------------
504
334
  // READING, MERGING AND DROPPING GO THROUGH THE CORE, NOT THE ENGINE ON THE PAGE. sdkListSwaps above returns
505
- // deal states (swaps.list); below is the server list (swaps.sync: the path and merge rule live in the core) and
506
- // record dropping (swaps.forget: it removes the record only here; the server and the contract keep everything).
335
+ // deal states (swaps.list) and record dropping (swaps.forget: it removes the record only here; the server and
336
+ // the contract keep everything).
507
337
  // The core did not come up - null, and the console names the cause (see sdkBundle), not silence.
508
- export async function sdkSyncSwaps(chainSlug) {
509
- const ctx = await instanceFor(chainSlug);
510
- return ctx ? ctx.sdk.swaps.sync() : null;
511
- }
512
-
513
338
  export async function sdkForgetSwap(id, chainSlug) {
514
339
  const ctx = await instanceFor(chainSlug);
515
340
  return ctx ? ctx.sdk.swaps.forget(id) : null;
@@ -599,8 +424,6 @@ export async function sdkAddressNetwork(address) {
599
424
  // modules, and the screen gets them through the seam, not by a second road into the engine;
600
425
  // * networkFromShape/networkLabel - the Monero address shape and its name: the same format module the core
601
426
  // mirrors (there is no second prefix table);
602
- // * createOrderWorker - the atomic-swap halves worker: the cryptography lives in one place and is called by a
603
- // worker so the main thread does not freeze;
604
427
  // * createSwap/createReverseSwap/activeSwaps - the RECORD of the demo and reverse deal (the record is kept by
605
428
  // the engine; the core exposes its STATE via swaps.list/swaps.progress).
606
429
  // * createSwapWallet - THE FORM'S DEAL WALLET (state between screens, ui/formState.js): the page wallet with
@@ -614,11 +437,10 @@ import { orderGasReservePlan } from "../evm/gasReserve.js";
614
437
  import { quoteDexOut, dexLegVerdict } from "../evm/dex.js";
615
438
  import { toWei } from "../evm/funding.js";
616
439
  import { cachedFeeTerms, feeWeiFor, ensureFeeTerms } from "../evm/fees.js";
617
- import { createOrderWorker } from "../atomic/order-client.js";
618
440
  import { activeSwaps, createSwap, createReverseSwap } from "../core/swap.js";
619
441
 
620
442
  export { evm, networkFromShape };
621
443
  export * as swapCore from "../core/swap.js";
622
444
  export * as moneroNode from "../monero/node.js";
623
- export { networkLabel, probeMode, createSwapWallet, amountInputValue, refreshChainPrices, priceLabel, orderGasReservePlan, quoteDexOut, dexLegVerdict, toWei, cachedFeeTerms, feeWeiFor, ensureFeeTerms, createOrderWorker, activeSwaps, createSwap, createReverseSwap };
445
+ export { networkLabel, probeMode, createSwapWallet, amountInputValue, refreshChainPrices, priceLabel, orderGasReservePlan, quoteDexOut, dexLegVerdict, toWei, cachedFeeTerms, feeWeiFor, ensureFeeTerms, activeSwaps, createSwap, createReverseSwap };
624
446