@1sat/actions 0.0.145 → 0.0.146
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/addresses/index.d.ts +4 -6
- package/dist/addresses/index.d.ts.map +1 -1
- package/dist/addresses/index.js +9 -24
- package/dist/addresses/index.js.map +1 -1
- package/dist/collections/index.js +7 -7
- package/dist/collections/index.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/inscriptions/index.js +7 -7
- package/dist/inscriptions/index.js.map +1 -1
- package/dist/ordinals/index.d.ts.map +1 -1
- package/dist/ordinals/index.js +36 -21
- package/dist/ordinals/index.js.map +1 -1
- package/dist/sweep/index.d.ts.map +1 -1
- package/dist/sweep/index.js +17 -11
- package/dist/sweep/index.js.map +1 -1
- package/dist/sync/index.d.ts +2 -2
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +7 -22
- package/dist/sync/index.js.map +1 -1
- package/dist/tokens/index.js +18 -18
- package/package.json +6 -6
package/dist/tokens/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { BSV21, OrdLock, P2MS } from '@1sat/templates';
|
|
7
7
|
import { parseOutpoint } from '@1sat/utils';
|
|
8
8
|
import { Beef, BigNumber, LockingScript, OP, P2PKH, PublicKey, Transaction, TransactionSignature, UnlockingScript, Utils, } from '@bsv/sdk';
|
|
9
|
-
import { BSV21_AUTH_BASKET, BSV21_BASKET, BSV21_DEPLOY_FUNDING_BASKET,
|
|
9
|
+
import { BSV21_AUTH_BASKET, BSV21_BASKET, BSV21_DEPLOY_FUNDING_BASKET, P1SAT_PROTOCOL, } from '../constants';
|
|
10
10
|
import { executeTrackedAction } from '../utils/createTrackedAction';
|
|
11
11
|
import { getDisplayValue } from '../utils/displayValue';
|
|
12
12
|
import { resolveDestination } from '../utils/resolveDestination';
|
|
@@ -260,7 +260,7 @@ export const sendBsv21 = {
|
|
|
260
260
|
// Build recipient outputs
|
|
261
261
|
for (const r of resolved) {
|
|
262
262
|
const recipientResolved = await resolveDestination(ctx, r.destination, {
|
|
263
|
-
protocolID:
|
|
263
|
+
protocolID: P1SAT_PROTOCOL,
|
|
264
264
|
keyIDPrefix: tokenId,
|
|
265
265
|
});
|
|
266
266
|
recipientKeyIDs.push(recipientResolved.customInstructions?.keyID);
|
|
@@ -279,7 +279,7 @@ export const sendBsv21 = {
|
|
|
279
279
|
tokenOutputCount += 1;
|
|
280
280
|
changeKeyID = `${tokenId}-${Date.now()}`;
|
|
281
281
|
const { publicKey } = await ctx.wallet.getPublicKey({
|
|
282
|
-
protocolID:
|
|
282
|
+
protocolID: P1SAT_PROTOCOL,
|
|
283
283
|
keyID: changeKeyID,
|
|
284
284
|
counterparty: 'self',
|
|
285
285
|
forSelf: true,
|
|
@@ -304,7 +304,7 @@ export const sendBsv21 = {
|
|
|
304
304
|
: []),
|
|
305
305
|
],
|
|
306
306
|
customInstructions: JSON.stringify({
|
|
307
|
-
protocolID:
|
|
307
|
+
protocolID: P1SAT_PROTOCOL,
|
|
308
308
|
keyID: changeKeyID,
|
|
309
309
|
...(tokenDetails.token.sym && {
|
|
310
310
|
sym: tokenDetails.token.sym,
|
|
@@ -372,7 +372,7 @@ export const sendBsv21 = {
|
|
|
372
372
|
if (ctx.debug && ctx.log) {
|
|
373
373
|
const logOutputs = resolved.map((_r, i) => ({
|
|
374
374
|
index: i,
|
|
375
|
-
protocolID:
|
|
375
|
+
protocolID: P1SAT_PROTOCOL,
|
|
376
376
|
keyID: recipientKeyIDs[i],
|
|
377
377
|
basket: BSV21_BASKET,
|
|
378
378
|
satoshis: 1,
|
|
@@ -380,7 +380,7 @@ export const sendBsv21 = {
|
|
|
380
380
|
if (change > 0n) {
|
|
381
381
|
logOutputs.push({
|
|
382
382
|
index: resolved.length,
|
|
383
|
-
protocolID:
|
|
383
|
+
protocolID: P1SAT_PROTOCOL,
|
|
384
384
|
keyID: changeKeyID,
|
|
385
385
|
basket: BSV21_BASKET,
|
|
386
386
|
satoshis: 1,
|
|
@@ -483,7 +483,7 @@ export const purchaseBsv21 = {
|
|
|
483
483
|
}
|
|
484
484
|
const bsv21KeyID = `${tokenId}-${outpoint}`;
|
|
485
485
|
const { publicKey } = await ctx.wallet.getPublicKey({
|
|
486
|
-
protocolID:
|
|
486
|
+
protocolID: P1SAT_PROTOCOL,
|
|
487
487
|
keyID: bsv21KeyID,
|
|
488
488
|
counterparty: 'self',
|
|
489
489
|
forSelf: true,
|
|
@@ -508,7 +508,7 @@ export const purchaseBsv21 = {
|
|
|
508
508
|
: []),
|
|
509
509
|
],
|
|
510
510
|
customInstructions: JSON.stringify({
|
|
511
|
-
protocolID:
|
|
511
|
+
protocolID: P1SAT_PROTOCOL,
|
|
512
512
|
keyID: bsv21KeyID,
|
|
513
513
|
...(tokenDetails.token.sym && {
|
|
514
514
|
sym: tokenDetails.token.sym,
|
|
@@ -584,7 +584,7 @@ export const purchaseBsv21 = {
|
|
|
584
584
|
outputs: [
|
|
585
585
|
{
|
|
586
586
|
index: 0,
|
|
587
|
-
protocolID:
|
|
587
|
+
protocolID: P1SAT_PROTOCOL,
|
|
588
588
|
keyID: bsv21KeyID,
|
|
589
589
|
basket: BSV21_BASKET,
|
|
590
590
|
satoshis: 1,
|
|
@@ -655,7 +655,7 @@ async function executeBsv21Deploy(args) {
|
|
|
655
655
|
const fundingValue = 1 + fee + 5;
|
|
656
656
|
const fundingKeyID = `bsv21-deploy-fund-${symbol}-${Date.now()}`;
|
|
657
657
|
const { publicKey: fundingPubKey } = await ctx.wallet.getPublicKey({
|
|
658
|
-
protocolID:
|
|
658
|
+
protocolID: P1SAT_PROTOCOL,
|
|
659
659
|
keyID: fundingKeyID,
|
|
660
660
|
counterparty: 'self',
|
|
661
661
|
forSelf: true,
|
|
@@ -671,7 +671,7 @@ async function executeBsv21Deploy(args) {
|
|
|
671
671
|
outputDescription: 'Deploy funding intermediate',
|
|
672
672
|
basket: BSV21_DEPLOY_FUNDING_BASKET,
|
|
673
673
|
customInstructions: JSON.stringify({
|
|
674
|
-
protocolID:
|
|
674
|
+
protocolID: P1SAT_PROTOCOL,
|
|
675
675
|
keyID: fundingKeyID,
|
|
676
676
|
}),
|
|
677
677
|
},
|
|
@@ -702,7 +702,7 @@ async function executeBsv21Deploy(args) {
|
|
|
702
702
|
lockingScript: deployScript,
|
|
703
703
|
satoshis: 1,
|
|
704
704
|
});
|
|
705
|
-
const sigResult = await signP2PKHInput(ctx, deployTx, 0,
|
|
705
|
+
const sigResult = await signP2PKHInput(ctx, deployTx, 0, P1SAT_PROTOCOL, fundingKeyID);
|
|
706
706
|
if (typeof sigResult !== 'string') {
|
|
707
707
|
return { error: sigResult.error };
|
|
708
708
|
}
|
|
@@ -800,7 +800,7 @@ export const deployBsv21Mint = {
|
|
|
800
800
|
return { error: 'amount-must-be-positive' };
|
|
801
801
|
}
|
|
802
802
|
const resolved = await resolveDestination(ctx, destination, {
|
|
803
|
-
protocolID:
|
|
803
|
+
protocolID: P1SAT_PROTOCOL,
|
|
804
804
|
keyIDPrefix: `bsv21-deploy-${symbol}`,
|
|
805
805
|
});
|
|
806
806
|
const deployScript = BSV21.deployMint(symbol, amount, decimals, icon).lock(resolved.lockingScript);
|
|
@@ -850,7 +850,7 @@ export const deployBsv21Mint = {
|
|
|
850
850
|
outputs: [
|
|
851
851
|
{
|
|
852
852
|
index: 0,
|
|
853
|
-
protocolID:
|
|
853
|
+
protocolID: P1SAT_PROTOCOL,
|
|
854
854
|
keyID: resolved.customInstructions?.keyID,
|
|
855
855
|
basket: BSV21_BASKET,
|
|
856
856
|
satoshis: 1,
|
|
@@ -910,7 +910,7 @@ export const deployBsv21Auth = {
|
|
|
910
910
|
try {
|
|
911
911
|
const { symbol, decimals = 0, icon, destination } = input;
|
|
912
912
|
const resolved = await resolveDestination(ctx, destination, {
|
|
913
|
-
protocolID:
|
|
913
|
+
protocolID: P1SAT_PROTOCOL,
|
|
914
914
|
keyIDPrefix: `bsv21-auth-${symbol}`,
|
|
915
915
|
});
|
|
916
916
|
const deployScript = BSV21.deployAuth(symbol, decimals, icon).lock(resolved.lockingScript);
|
|
@@ -949,7 +949,7 @@ export const deployBsv21Auth = {
|
|
|
949
949
|
outputs: [
|
|
950
950
|
{
|
|
951
951
|
index: 0,
|
|
952
|
-
protocolID:
|
|
952
|
+
protocolID: P1SAT_PROTOCOL,
|
|
953
953
|
keyID: resolved.customInstructions?.keyID,
|
|
954
954
|
basket: BSV21_AUTH_BASKET,
|
|
955
955
|
satoshis: 1,
|
|
@@ -1055,7 +1055,7 @@ export const mintBsv21 = {
|
|
|
1055
1055
|
let authOutputIndex;
|
|
1056
1056
|
if (mint) {
|
|
1057
1057
|
const mintResolved = await resolveDestination(ctx, mint.destination, {
|
|
1058
|
-
protocolID:
|
|
1058
|
+
protocolID: P1SAT_PROTOCOL,
|
|
1059
1059
|
keyIDPrefix: `bsv21-mint-${tokenId}`,
|
|
1060
1060
|
});
|
|
1061
1061
|
const mintScript = BSV21.mint(tokenId, mintAmount).lock(mintResolved.lockingScript);
|
|
@@ -1089,7 +1089,7 @@ export const mintBsv21 = {
|
|
|
1089
1089
|
}
|
|
1090
1090
|
if (!endMinting) {
|
|
1091
1091
|
const authResolved = await resolveDestination(ctx, auth?.destination, {
|
|
1092
|
-
protocolID:
|
|
1092
|
+
protocolID: P1SAT_PROTOCOL,
|
|
1093
1093
|
keyIDPrefix: `bsv21-auth-${tokenId}`,
|
|
1094
1094
|
});
|
|
1095
1095
|
const authScript = BSV21.auth(tokenId).lock(authResolved.lockingScript);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1sat/actions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.146",
|
|
4
4
|
"description": "Action definitions for the 1Sat SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
],
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@1sat/client": "0.0.
|
|
33
|
-
"@1sat/types": "0.0.
|
|
34
|
-
"@1sat/utils": "0.0.
|
|
35
|
-
"@1sat/wallet": "0.0.
|
|
36
|
-
"@1sat/templates": "0.0.
|
|
32
|
+
"@1sat/client": "0.0.33",
|
|
33
|
+
"@1sat/types": "0.0.26",
|
|
34
|
+
"@1sat/utils": "0.0.21",
|
|
35
|
+
"@1sat/wallet": "0.0.76",
|
|
36
|
+
"@1sat/templates": "0.0.17",
|
|
37
37
|
"@bsv/p2p": "^1.1.6"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|