@1sat/sweep-ui 0.0.21 → 0.0.22
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/index.js +12 -5
- package/dist/lib/sweeper.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/lib/sweeper.ts +12 -5
package/dist/index.js
CHANGED
|
@@ -342,11 +342,18 @@ async function sweepBsv21Token(params) {
|
|
|
342
342
|
const ctx = createContext(wallet, { services: getServices(), chain: "main" });
|
|
343
343
|
onProgress(`Sweeping ${token.symbol ?? token.tokenId.slice(0, 8)}...`);
|
|
344
344
|
try {
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
const sweepInputs = await prepareSweepInputs(ctx, token.outputs);
|
|
346
|
+
const sweepInputMap = new Map(sweepInputs.map((s) => [s.outpoint, s]));
|
|
347
|
+
const inputs = token.outputs.map((out) => {
|
|
348
|
+
const base = sweepInputMap.get(out.outpoint);
|
|
349
|
+
if (!base)
|
|
350
|
+
throw new Error(`Missing sweep input for ${out.outpoint}`);
|
|
351
|
+
return {
|
|
352
|
+
...base,
|
|
353
|
+
tokenId: token.tokenId,
|
|
354
|
+
amount: token.amounts.get(out.outpoint) ?? "0"
|
|
355
|
+
};
|
|
356
|
+
});
|
|
350
357
|
const tokenKeys = buildKeys(token.outputs, keys);
|
|
351
358
|
const result = await sweepBsv21.execute(ctx, { inputs, keys: tokenKeys });
|
|
352
359
|
if (result.error)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sweeper.d.ts","sourceRoot":"","sources":["../../src/lib/sweeper.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAG7C,MAAM,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U,EAAE,MAAM,EAAE,CAAA;IACpB,MAAM,EAAE,MAAM,EAAE,CAAA;CAChB;AAmBD;;GAEG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE;IAC1C,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC7B,OAAO,EAAE,aAAa,EAAE,CAAA;IACxB,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,GAAG,OAAO,CAAC,WAAW,CAAC,CA6CvB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE;IAC7C,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;IAC7B,KAAK,EAAE,YAAY,CAAA;IACnB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC,GAAG,OAAO,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CA4B7C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/sweep-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.22",
|
|
4
4
|
"description": "Sweep UI components for migrating legacy BSV assets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@1sat/actions": "0.0.
|
|
32
|
+
"@1sat/actions": "0.0.86",
|
|
33
33
|
"@1sat/client": "0.0.20",
|
|
34
34
|
"@1sat/connect": "0.0.29",
|
|
35
35
|
"@1sat/types": "0.0.16",
|
package/src/lib/sweeper.ts
CHANGED
|
@@ -107,11 +107,18 @@ export async function sweepBsv21Token(params: {
|
|
|
107
107
|
onProgress(`Sweeping ${token.symbol ?? token.tokenId.slice(0, 8)}...`)
|
|
108
108
|
|
|
109
109
|
try {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
const sweepInputs = await prepareSweepInputs(ctx, token.outputs)
|
|
111
|
+
const sweepInputMap = new Map(sweepInputs.map((s) => [s.outpoint, s]))
|
|
112
|
+
|
|
113
|
+
const inputs = token.outputs.map((out) => {
|
|
114
|
+
const base = sweepInputMap.get(out.outpoint)
|
|
115
|
+
if (!base) throw new Error(`Missing sweep input for ${out.outpoint}`)
|
|
116
|
+
return {
|
|
117
|
+
...base,
|
|
118
|
+
tokenId: token.tokenId,
|
|
119
|
+
amount: token.amounts.get(out.outpoint) ?? '0',
|
|
120
|
+
}
|
|
121
|
+
})
|
|
115
122
|
|
|
116
123
|
const tokenKeys = buildKeys(token.outputs, keys)
|
|
117
124
|
|