@1sat/actions 0.0.235 → 0.1.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 (96) hide show
  1. package/dist/1color/deploy.d.ts +35 -0
  2. package/dist/1color/deploy.d.ts.map +1 -0
  3. package/dist/1color/deploy.js +127 -0
  4. package/dist/1color/deploy.js.map +1 -0
  5. package/dist/{mandala → 1color}/deploy.test.d.ts.map +1 -1
  6. package/dist/1color/deploy.test.js +188 -0
  7. package/dist/1color/deploy.test.js.map +1 -0
  8. package/dist/1color/index.d.ts +10 -0
  9. package/dist/{mandala → 1color}/index.d.ts.map +1 -1
  10. package/dist/1color/index.js +12 -0
  11. package/dist/1color/index.js.map +1 -0
  12. package/dist/1color/receipt.d.ts +39 -0
  13. package/dist/1color/receipt.d.ts.map +1 -0
  14. package/dist/1color/receipt.js +91 -0
  15. package/dist/1color/receipt.js.map +1 -0
  16. package/dist/1color/send.d.ts +52 -0
  17. package/dist/1color/send.d.ts.map +1 -0
  18. package/dist/1color/send.js +175 -0
  19. package/dist/1color/send.js.map +1 -0
  20. package/dist/{mandala → 1color}/send.test.d.ts.map +1 -1
  21. package/dist/1color/send.test.js +622 -0
  22. package/dist/1color/send.test.js.map +1 -0
  23. package/dist/funding/walletFunding.d.ts +1 -2
  24. package/dist/funding/walletFunding.d.ts.map +1 -1
  25. package/dist/funding/walletFunding.js +1 -2
  26. package/dist/funding/walletFunding.js.map +1 -1
  27. package/dist/index.d.ts +1 -1
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +3 -3
  30. package/dist/index.js.map +1 -1
  31. package/dist/listings/cancelOwnedListings.d.ts.map +1 -1
  32. package/dist/listings/cancelOwnedListings.js +7 -3
  33. package/dist/listings/cancelOwnedListings.js.map +1 -1
  34. package/dist/locks/index.d.ts.map +1 -1
  35. package/dist/locks/index.js +2 -1
  36. package/dist/locks/index.js.map +1 -1
  37. package/dist/metanet/delivery.d.ts +69 -0
  38. package/dist/metanet/delivery.d.ts.map +1 -0
  39. package/dist/metanet/delivery.js +235 -0
  40. package/dist/metanet/delivery.js.map +1 -0
  41. package/dist/metanet/delivery.test.d.ts +2 -0
  42. package/dist/metanet/delivery.test.d.ts.map +1 -0
  43. package/dist/metanet/delivery.test.js +125 -0
  44. package/dist/metanet/delivery.test.js.map +1 -0
  45. package/dist/metanet/envelope.test.js +1 -1
  46. package/dist/metanet/envelope.test.js.map +1 -1
  47. package/dist/metanet/inbox.d.ts +2 -2
  48. package/dist/metanet/inbox.js +2 -2
  49. package/dist/metanet/index.d.ts +5 -3
  50. package/dist/metanet/index.d.ts.map +1 -1
  51. package/dist/metanet/index.js +6 -4
  52. package/dist/metanet/index.js.map +1 -1
  53. package/dist/metanet/receive.d.ts +46 -16
  54. package/dist/metanet/receive.d.ts.map +1 -1
  55. package/dist/metanet/receive.js +118 -17
  56. package/dist/metanet/receive.js.map +1 -1
  57. package/dist/metanet/relay.d.ts +1 -1
  58. package/dist/metanet/relay.js +1 -1
  59. package/dist/metanet/testdata/brc232-vectors.json +86 -0
  60. package/dist/opns/index.d.ts.map +1 -1
  61. package/dist/opns/index.js +2 -1
  62. package/dist/opns/index.js.map +1 -1
  63. package/dist/ordinals/index.d.ts.map +1 -1
  64. package/dist/ordinals/index.js +2 -1
  65. package/dist/ordinals/index.js.map +1 -1
  66. package/dist/payments/index.d.ts +1 -1
  67. package/dist/payments/index.js +3 -3
  68. package/dist/payments/index.js.map +1 -1
  69. package/dist/payments/sendBsvHandle.test.js +52 -34
  70. package/dist/payments/sendBsvHandle.test.js.map +1 -1
  71. package/package.json +10 -9
  72. package/dist/mandala/deploy.d.ts +0 -89
  73. package/dist/mandala/deploy.d.ts.map +0 -1
  74. package/dist/mandala/deploy.js +0 -226
  75. package/dist/mandala/deploy.js.map +0 -1
  76. package/dist/mandala/deploy.test.js +0 -281
  77. package/dist/mandala/deploy.test.js.map +0 -1
  78. package/dist/mandala/index.d.ts +0 -9
  79. package/dist/mandala/index.js +0 -17
  80. package/dist/mandala/index.js.map +0 -1
  81. package/dist/mandala/receive.d.ts +0 -58
  82. package/dist/mandala/receive.d.ts.map +0 -1
  83. package/dist/mandala/receive.js +0 -162
  84. package/dist/mandala/receive.js.map +0 -1
  85. package/dist/mandala/send.d.ts +0 -74
  86. package/dist/mandala/send.d.ts.map +0 -1
  87. package/dist/mandala/send.js +0 -313
  88. package/dist/mandala/send.js.map +0 -1
  89. package/dist/mandala/send.test.js +0 -515
  90. package/dist/mandala/send.test.js.map +0 -1
  91. package/dist/mandala/tokenId.d.ts +0 -21
  92. package/dist/mandala/tokenId.d.ts.map +0 -1
  93. package/dist/mandala/tokenId.js +0 -29
  94. package/dist/mandala/tokenId.js.map +0 -1
  95. /package/dist/{mandala → 1color}/deploy.test.d.ts +0 -0
  96. /package/dist/{mandala → 1color}/send.test.d.ts +0 -0
@@ -1,226 +0,0 @@
1
- /**
2
- * Mandala (BRC-162) deploy.
3
- *
4
- * Filing: a **label** on the transaction indexes tokens — `mandala` on every
5
- * Mandala transaction, `mandala <txid> <vout>` per token (`listActions` answers
6
- * "which tokens does this wallet track", and labels survive outputs being
7
- * spent). **Per-token baskets** `mandala <txid> <vout>` hold outputs: every
8
- * value/authority output of a token, the deploy output included.
9
- */
10
- import { OverlayClient } from '@1sat/client';
11
- import { Mandala } from '@1sat/templates';
12
- import { MANDALA_DEPLOY_PROTOCOL, MANDALA_LABEL, MANDALA_TOPIC, mandalaTokenBasket, mandalaTokenLabel, } from '@1sat/types';
13
- import { executeTrackedAction } from '../utils/createTrackedAction.js';
14
- import { resolveDestination } from '../utils/resolveDestination.js';
15
- /**
16
- * File a deploy output into its token's basket: `internalizeAction` on the
17
- * deploy transaction, vout 0 by `basket insertion` into `mandala <txid> 0` with
18
- * the derivation triple as customInstructions, labels `mandala` and
19
- * `mandala <txid> 0`.
20
- */
21
- async function fileDeploy(ctx, txid, tx, customInstructions) {
22
- const token = { txid, vout: 0 };
23
- await ctx.wallet.internalizeAction({
24
- tx,
25
- outputs: [
26
- {
27
- outputIndex: 0,
28
- protocol: 'basket insertion',
29
- insertionRemittance: {
30
- basket: mandalaTokenBasket(token),
31
- customInstructions,
32
- },
33
- },
34
- ],
35
- labels: [MANDALA_LABEL, mandalaTokenLabel(token)],
36
- description: 'File Mandala deploy',
37
- });
38
- }
39
- /**
40
- * Deploy a Mandala token: one `createAction` and one `internalizeAction` on
41
- * the same transaction.
42
- *
43
- * 1. `createAction` with the deploy output at vout 0 (`randomizeOutputs:
44
- * false`) and no basket (an output cannot later be moved out of a basket),
45
- * customInstructions = the key derivation only, label `mandala`.
46
- * Broadcast by the wallet, or via `overlay` (see
47
- * {@link DeployMandalaInput.overlay}).
48
- * 2. `internalizeAction` on that transaction: vout 0 is inserted into the
49
- * per-token basket `mandala <txid> 0` with the same customInstructions, and
50
- * the labels `mandala` and `mandala <txid> 0` are added. When this step
51
- * fails the result carries `txid`, `tx` and the error; the action is still
52
- * labelled `mandala`, and {@link fileMandalaDeploy} re-runs the filing.
53
- *
54
- * The deploy key derives under `MANDALA_DEPLOY_PROTOCOL` = `[2, 'mandala
55
- * deploy']`, keyID `mandala-deploy-<hex>`: the token id is this
56
- * transaction's txid, unknown while the key is derived.
57
- *
58
- * The token is named by its BRC-36 deploy outpoint `<txid>.0`; on chain its BRC-162
59
- * id is the 32-byte txid. Amount and id are read from the script,
60
- * `sym`/`dec`/`icon` from the deploy payload — none are copied into
61
- * customInstructions.
62
- */
63
- export const deployMandala = {
64
- meta: {
65
- name: 'deployMandala',
66
- description: 'Deploy a Mandala (BRC-162) token: amount > 0 is fixed supply, 0 is an authority deploy. The token is the BRC-36 deploy outpoint <txid>.0.',
67
- category: 'tokens',
68
- inputSchema: {
69
- type: 'object',
70
- properties: {
71
- amount: {
72
- type: 'string',
73
- description: 'Supply as a string for bigint: > 0 fixed supply, 0 authority deploy',
74
- },
75
- decimals: {
76
- type: 'integer',
77
- description: 'Decimal places (0-18)',
78
- },
79
- symbol: { type: 'string', description: 'Token symbol/ticker' },
80
- icon: {
81
- type: 'string',
82
- description: 'Icon outpoint (txid_vout), or an output index in the deploy transaction',
83
- },
84
- destination: {
85
- type: 'object',
86
- description: 'Holder destination. One of lockingScript (hex), counterparty (pubkey), or address. Defaults to self.',
87
- },
88
- overlay: {
89
- type: 'string',
90
- description: 'Overlay base URL: broadcast as a BRC-22 submit (tm_mandala, tm_<txid>) instead of the wallet broadcast',
91
- },
92
- },
93
- required: ['amount'],
94
- },
95
- },
96
- async execute(ctx, input) {
97
- try {
98
- const amount = typeof input.amount === 'string' ? BigInt(input.amount) : input.amount;
99
- const authority = amount === 0n;
100
- const resolved = await resolveDestination(ctx, input.destination, {
101
- protocolID: MANDALA_DEPLOY_PROTOCOL,
102
- keyIDPrefix: 'mandala-deploy',
103
- });
104
- const payload = {};
105
- if (input.symbol !== undefined)
106
- payload.sym = input.symbol;
107
- if (input.decimals !== undefined)
108
- payload.dec = input.decimals;
109
- if (input.icon !== undefined)
110
- payload.icon = input.icon;
111
- const deploy = authority
112
- ? Mandala.deployAuthority({ lock: resolved.lockingScript, payload })
113
- : Mandala.deployValue(amount, {
114
- lock: resolved.lockingScript,
115
- payload,
116
- });
117
- // Derivation only (absent for an address / literal-script destination).
118
- const customInstructions = resolved.customInstructions
119
- ? JSON.stringify(resolved.customInstructions)
120
- : undefined;
121
- const description = authority
122
- ? 'Deploy Mandala token (authority)'
123
- : 'Deploy Mandala token (fixed supply)';
124
- const args = {
125
- description,
126
- outputs: [
127
- {
128
- lockingScript: deploy.lock().toHex(),
129
- satoshis: 1,
130
- outputDescription: 'Mandala deploy',
131
- customInstructions,
132
- },
133
- ],
134
- labels: [MANDALA_LABEL],
135
- options: {
136
- randomizeOutputs: false,
137
- ...(input.overlay && { noSend: true }),
138
- },
139
- };
140
- const created = await executeTrackedAction(ctx.wallet, args);
141
- if (created.error)
142
- return { error: created.error };
143
- if (!created.txid || !created.tx)
144
- return { error: 'deploy-no-tx' };
145
- const txid = created.txid;
146
- const tx = created.tx;
147
- if (input.overlay) {
148
- const steak = await new OverlayClient(input.overlay).submitBrc22(tx, [
149
- MANDALA_TOPIC,
150
- `tm_${txid}`,
151
- ]);
152
- if (!steak || typeof steak !== 'object' || Array.isArray(steak)) {
153
- return { txid, tx, error: 'overlay-no-steak' };
154
- }
155
- }
156
- try {
157
- await fileDeploy(ctx, txid, tx, customInstructions);
158
- }
159
- catch (error) {
160
- return {
161
- txid,
162
- tx,
163
- tokenId: `${txid}.0`,
164
- error: `file-failed: ${error instanceof Error ? error.message : String(error)}`,
165
- };
166
- }
167
- return { txid, tx, tokenId: `${txid}.0` };
168
- }
169
- catch (error) {
170
- return {
171
- error: error instanceof Error ? error.message : 'unknown-error',
172
- };
173
- }
174
- },
175
- };
176
- /**
177
- * Re-run the filing step of {@link deployMandala} for a deploy that was
178
- * created but not filed. The customInstructions are read back from the
179
- * `mandala`-labelled action's vout 0 (`listActions`).
180
- */
181
- export const fileMandalaDeploy = {
182
- meta: {
183
- name: 'fileMandalaDeploy',
184
- description: 'File a created Mandala deploy output into its token basket (retry of the deploy internalize)',
185
- category: 'tokens',
186
- inputSchema: {
187
- type: 'object',
188
- properties: {
189
- txid: { type: 'string', description: 'Deploy txid' },
190
- tx: {
191
- type: 'array',
192
- description: 'Atomic BEEF of the deploy; fetched from services when omitted',
193
- },
194
- },
195
- required: ['txid'],
196
- },
197
- },
198
- async execute(ctx, input) {
199
- try {
200
- const txid = input.txid.toLowerCase();
201
- const listed = await ctx.wallet.listActions({
202
- labels: [MANDALA_LABEL],
203
- includeOutputs: true,
204
- limit: 10000,
205
- });
206
- const action = listed.actions.find((a) => a.txid === txid);
207
- if (!action)
208
- return { error: 'deploy-not-found' };
209
- const out = action.outputs?.find((o) => o.outputIndex === 0);
210
- let tx = input.tx;
211
- if (!tx) {
212
- if (!ctx.services)
213
- return { error: 'services-required' };
214
- tx = (await ctx.services.getBeefForTxid(txid)).toBinaryAtomic(txid);
215
- }
216
- await fileDeploy(ctx, txid, tx, out?.customInstructions);
217
- return { txid, tokenId: `${txid}.0` };
218
- }
219
- catch (error) {
220
- return {
221
- error: error instanceof Error ? error.message : String(error),
222
- };
223
- }
224
- },
225
- };
226
- //# sourceMappingURL=deploy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/mandala/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAwB,MAAM,iBAAiB,CAAA;AAC/D,OAAO,EAEN,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,iBAAiB,GACjB,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAoCnE;;;;;GAKG;AACH,KAAK,UAAU,UAAU,CACxB,GAAkB,EAClB,IAAY,EACZ,EAAc,EACd,kBAAsC;IAEtC,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,CAAA;IAC/B,MAAM,GAAG,CAAC,MAAM,CAAC,iBAAiB,CAAC;QAClC,EAAE;QACF,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,CAAC;gBACd,QAAQ,EAAE,kBAAkB;gBAC5B,mBAAmB,EAAE;oBACpB,MAAM,EAAE,kBAAkB,CAAC,KAAK,CAAC;oBACjC,kBAAkB;iBAClB;aACD;SACD;QACD,MAAM,EAAE,CAAC,aAAa,EAAE,iBAAiB,CAAC,KAAK,CAAC,CAAC;QACjD,WAAW,EAAE,qBAAqB;KAClC,CAAC,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,MAAM,aAAa,GACzB;IACC,IAAI,EAAE;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EACV,2IAA2I;QAC5I,QAAQ,EAAE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AE,CAAA;gBACxD,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;YACpE,CAAC;YACD,MAAM,UAAU,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,kBAAkB,CAAC,CAAA;YACxD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,IAAI,EAAE,CAAA;QACtC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,OAAO;gBACN,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC7D,CAAA;QACF,CAAC;IACF,CAAC;CACD,CAAA"}
@@ -1,281 +0,0 @@
1
- import { afterEach, describe, expect, test } from 'bun:test';
2
- import { Mandala } from '@1sat/templates';
3
- import { MANDALA_DEPLOY_PROTOCOL, MANDALA_LABEL, MANDALA_TOPIC, mandalaProtocol, mandalaTokenBasket, mandalaTokenLabel, parseMandalaName, } from '@1sat/types';
4
- import { LockingScript, MerklePath, P2PKH, PrivateKey, ProtoWallet, PublicKey, Transaction, UnlockingScript, } from '@bsv/sdk';
5
- import { deployMandala, fileMandalaDeploy } from './deploy.js';
6
- const proto = new ProtoWallet(PrivateKey.fromHex('01'.repeat(32)));
7
- /** Fake wallet: createAction builds the outputs into a real tx; internalize is recorded. */
8
- function setup() {
9
- const created = [];
10
- const internalized = [];
11
- const wallet = {
12
- getPublicKey: (a) => proto.getPublicKey(a),
13
- createAction: async (args) => {
14
- created.push(args);
15
- const parent = new Transaction();
16
- parent.addInput({
17
- sourceTXID: '11'.repeat(32),
18
- sourceOutputIndex: 0,
19
- unlockingScript: new UnlockingScript(),
20
- sequence: 0xffffffff,
21
- });
22
- parent.addOutput({
23
- lockingScript: new P2PKH().lock(PrivateKey.fromHex('05'.repeat(32)).toPublicKey().toAddress()),
24
- satoshis: 100_000,
25
- });
26
- parent.merklePath = new MerklePath(100, [
27
- [{ offset: 0, hash: parent.id('hex'), txid: true }],
28
- ]);
29
- const tx = new Transaction();
30
- tx.addInput({
31
- sourceTransaction: parent,
32
- sourceOutputIndex: 0,
33
- unlockingScript: new UnlockingScript(),
34
- sequence: 0xffffffff,
35
- });
36
- for (const o of args.outputs ?? []) {
37
- tx.addOutput({
38
- lockingScript: LockingScript.fromHex(o.lockingScript),
39
- satoshis: o.satoshis,
40
- });
41
- }
42
- return { txid: tx.id('hex'), tx: tx.toAtomicBEEF() };
43
- },
44
- internalizeAction: async (args) => {
45
- internalized.push(args);
46
- return { accepted: true };
47
- },
48
- };
49
- const ctx = {
50
- wallet: wallet,
51
- chain: 'main',
52
- isBaseWallet: true,
53
- };
54
- return { ctx, created, internalized };
55
- }
56
- /** The P2PKH the wallet derives under MANDALA_DEPLOY_PROTOCOL for this keyID. */
57
- async function derivedLock(ci) {
58
- const { publicKey } = await proto.getPublicKey({
59
- protocolID: MANDALA_DEPLOY_PROTOCOL,
60
- keyID: ci.keyID,
61
- counterparty: 'self',
62
- forSelf: true,
63
- });
64
- return new P2PKH().lock(PublicKey.fromString(publicKey).toAddress());
65
- }
66
- function expectFiling(created, internalized, txid) {
67
- // one createAction: deploy at vout 0, label `mandala`, derivation-only CI
68
- expect(created).toHaveLength(1);
69
- expect(created[0].options?.randomizeOutputs).toBe(false);
70
- expect(created[0].labels).toEqual([MANDALA_LABEL]);
71
- expect(created[0].outputs).toHaveLength(1);
72
- // untracked: an output cannot later be moved out of a basket
73
- expect(created[0].outputs?.[0].basket).toBeUndefined();
74
- const ci = JSON.parse(created[0].outputs?.[0].customInstructions ?? '{}');
75
- expect(Object.keys(ci).sort()).toEqual(['keyID', 'protocolID']);
76
- // deploy key: [2, 'mandala deploy'] (txid unknown at derivation time)
77
- expect(ci.protocolID).toEqual([2, 'mandala deploy']);
78
- expect(ci.keyID).toStartWith('mandala-deploy-');
79
- // one internalizeAction on the same tx: vout 0 into the per-token basket
80
- expect(internalized).toHaveLength(1);
81
- const int = internalized[0];
82
- expect(Transaction.fromAtomicBEEF(int.tx).id('hex')).toBe(txid);
83
- expect(int.labels).toEqual([MANDALA_LABEL, `mandala ${txid} 0`]);
84
- expect(int.labels).toContain(mandalaTokenLabel({ txid, vout: 0 }));
85
- expect(int.outputs).toHaveLength(1);
86
- expect(int.outputs[0].outputIndex).toBe(0);
87
- expect(int.outputs[0].protocol).toBe('basket insertion');
88
- const remit = int.outputs[0].insertionRemittance;
89
- expect(remit?.basket).toBe(`mandala ${txid} 0`);
90
- expect(remit?.basket).toBe(mandalaTokenBasket(`${txid}_0`));
91
- expect(remit?.customInstructions).toBe(created[0].outputs?.[0].customInstructions);
92
- return { ci, tx: Transaction.fromAtomicBEEF(int.tx) };
93
- }
94
- describe('deployMandala', () => {
95
- test('fixed supply: createAction + internalize into the per-token basket, tokenId = txid', async () => {
96
- const { ctx, created, internalized } = setup();
97
- const res = await deployMandala.execute(ctx, {
98
- amount: '21000000',
99
- symbol: 'GOLD',
100
- decimals: 8,
101
- });
102
- expect(res.error).toBeUndefined();
103
- expect(res.txid).toMatch(/^[0-9a-f]{64}$/);
104
- expect(res.tokenId).toBe(`${res.txid}.0`);
105
- expect(res.tx).toBeDefined();
106
- expect(created[0].options?.noSend).toBeUndefined();
107
- const { ci, tx } = expectFiling(created, internalized, res.txid);
108
- const expected = Mandala.deployValue(21000000n, {
109
- lock: await derivedLock(ci),
110
- payload: { sym: 'GOLD', dec: 8 },
111
- });
112
- expect(created[0].outputs?.[0].lockingScript).toBe(expected.lock().toHex());
113
- const decoded = Mandala.decode(tx.outputs[0].lockingScript);
114
- expect(decoded?.role).toBe('deploy');
115
- expect(decoded?.amount).toBe(21000000n);
116
- expect(decoded?.metadata).toEqual({ sym: 'GOLD', dec: 8 });
117
- });
118
- test('authority: amount 0 deploys the first authority, filed the same way', async () => {
119
- const { ctx, created, internalized } = setup();
120
- const res = await deployMandala.execute(ctx, {
121
- amount: 0n,
122
- symbol: 'STABLE',
123
- decimals: 2,
124
- icon: 1,
125
- });
126
- expect(res.error).toBeUndefined();
127
- expect(res.tokenId).toBe(`${res.txid}.0`);
128
- const { ci, tx } = expectFiling(created, internalized, res.txid);
129
- const expected = Mandala.deployAuthority({
130
- lock: await derivedLock(ci),
131
- payload: { sym: 'STABLE', dec: 2, icon: 1 },
132
- });
133
- expect(created[0].outputs?.[0].lockingScript).toBe(expected.lock().toHex());
134
- const decoded = Mandala.decode(tx.outputs[0].lockingScript);
135
- expect(decoded?.role).toBe('deploy');
136
- expect(decoded?.amount).toBe(0n);
137
- });
138
- test('an address destination carries no customInstructions', async () => {
139
- const { ctx, created, internalized } = setup();
140
- const res = await deployMandala.execute(ctx, {
141
- amount: '5',
142
- destination: {
143
- address: PrivateKey.fromHex('06'.repeat(32)).toPublicKey().toAddress(),
144
- },
145
- });
146
- expect(res.error).toBeUndefined();
147
- expect(created[0].outputs?.[0].customInstructions).toBeUndefined();
148
- expect(internalized[0].outputs[0].insertionRemittance?.customInstructions).toBeUndefined();
149
- });
150
- test('names: `mandala <txid> <vout>` from {txid, vout}, txid_vout or txid.vout', () => {
151
- const txid = 'AB'.repeat(32);
152
- const name = `mandala ${'ab'.repeat(32)} 3`;
153
- for (const ref of [{ txid, vout: 3 }, `${txid}_3`, `${txid}.3`]) {
154
- expect(mandalaTokenBasket(ref)).toBe(name);
155
- expect(mandalaTokenLabel(ref)).toBe(name);
156
- expect(mandalaProtocol(ref)).toEqual([2, name]);
157
- }
158
- expect(() => mandalaProtocol(txid)).toThrow();
159
- });
160
- test('parseMandalaName recovers {txid, vout} from basket, label or protocol', () => {
161
- const txid = 'ab'.repeat(32);
162
- expect(parseMandalaName(`mandala ${txid} 7`)).toEqual({ txid, vout: 7 });
163
- expect(parseMandalaName([2, `mandala ${txid} 0`])).toEqual({
164
- txid,
165
- vout: 0,
166
- });
167
- expect(parseMandalaName('mandala')).toBeUndefined();
168
- expect(parseMandalaName('mandala deploy')).toBeUndefined();
169
- expect(parseMandalaName(`mandala ${txid}_0`)).toBeUndefined();
170
- });
171
- });
172
- describe('deployMandala filing retry', () => {
173
- test('a failed internalize returns txid/tx/error; fileMandalaDeploy re-files from listActions', async () => {
174
- const { ctx, created, internalized } = setup();
175
- const internalize = ctx.wallet.internalizeAction;
176
- let fail = true;
177
- ctx.wallet.internalizeAction = async (args) => {
178
- if (fail)
179
- throw new Error('storage busy');
180
- return internalize(args);
181
- };
182
- const res = await deployMandala.execute(ctx, { amount: '7' });
183
- expect(res.error).toBe('file-failed: storage busy');
184
- expect(res.txid).toMatch(/^[0-9a-f]{64}$/);
185
- expect(res.tokenId).toBe(`${res.txid}.0`);
186
- expect(internalized).toHaveLength(0);
187
- const ciString = created[0].outputs?.[0].customInstructions;
188
- const listCalls = [];
189
- ctx.wallet.listActions = async (args) => {
190
- listCalls.push(args);
191
- return {
192
- totalActions: 1,
193
- actions: [
194
- {
195
- txid: res.txid,
196
- satoshis: 0,
197
- status: 'completed',
198
- isOutgoing: true,
199
- description: 'Deploy Mandala token (fixed supply)',
200
- labels: [MANDALA_LABEL],
201
- version: 1,
202
- lockTime: 0,
203
- outputs: [
204
- {
205
- outputIndex: 0,
206
- satoshis: 1,
207
- spendable: true,
208
- tags: [],
209
- outputDescription: 'Mandala deploy',
210
- basket: '',
211
- customInstructions: ciString,
212
- },
213
- ],
214
- },
215
- ],
216
- };
217
- };
218
- fail = false;
219
- const filed = await fileMandalaDeploy.execute(ctx, {
220
- txid: res.txid,
221
- tx: res.tx,
222
- });
223
- expect(filed.error).toBeUndefined();
224
- expect(filed.tokenId).toBe(`${res.txid}.0`);
225
- expect(listCalls).toEqual([
226
- { labels: [MANDALA_LABEL], includeOutputs: true, limit: 10000 },
227
- ]);
228
- expectFiling(created, internalized, res.txid);
229
- });
230
- test('fileMandalaDeploy: unknown txid', async () => {
231
- const { ctx } = setup();
232
- ctx.wallet.listActions = async () => ({ totalActions: 0, actions: [] });
233
- const filed = await fileMandalaDeploy.execute(ctx, {
234
- txid: 'cd'.repeat(32),
235
- });
236
- expect(filed.error).toBe('deploy-not-found');
237
- });
238
- });
239
- describe('deployMandala overlay', () => {
240
- const realFetch = globalThis.fetch;
241
- afterEach(() => {
242
- globalThis.fetch = realFetch;
243
- });
244
- test('creates with noSend and submits to tm_mandala and tm_<txid> before internalizing', async () => {
245
- const order = [];
246
- const submits = [];
247
- globalThis.fetch = (async (url, init) => {
248
- order.push('submit');
249
- submits.push({
250
- url: String(url),
251
- topics: new Headers(init?.headers).get('x-topics'),
252
- });
253
- return new Response(JSON.stringify({
254
- [MANDALA_TOPIC]: { outputsToAdmit: [0], coinsToRetain: [] },
255
- }), { status: 200 });
256
- });
257
- const { ctx, created, internalized } = setup();
258
- const internalize = ctx.wallet.internalizeAction;
259
- ctx.wallet.internalizeAction = async (args) => {
260
- order.push('internalize');
261
- return internalize(args);
262
- };
263
- const res = await deployMandala.execute(ctx, {
264
- amount: '1000',
265
- symbol: 'OVL',
266
- overlay: 'https://overlay.example/',
267
- });
268
- expect(res.error).toBeUndefined();
269
- expect(res.tokenId).toBe(`${res.txid}.0`);
270
- expect(created[0].options?.noSend).toBe(true);
271
- expect(submits).toEqual([
272
- {
273
- url: 'https://overlay.example/submit',
274
- topics: `${MANDALA_TOPIC},tm_${res.txid}`,
275
- },
276
- ]);
277
- expect(order).toEqual(['submit', 'internalize']);
278
- expectFiling(created, internalized, res.txid);
279
- });
280
- });
281
- //# sourceMappingURL=deploy.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deploy.test.js","sourceRoot":"","sources":["../../src/mandala/deploy.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AACzC,OAAO,EACN,uBAAuB,EACvB,aAAa,EACb,aAAa,EACb,eAAe,EACf,kBA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,GAAG,aAAa,OAAO,GAAG,CAAC,IAAI,EAAE;aACzC;SACD,CAAC,CAAA;QACF,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAA;QAChD,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,CAAC,IAAc,CAAC,CAAA;IACxD,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Mandala (BRC-162) token actions: deploy, send to a BRC-169 handle
3
- * (delivered per BRC-232), and receive from `mandala_inbox`.
4
- */
5
- export * from './deploy.js';
6
- export * from './send.js';
7
- export * from './receive.js';
8
- export declare const mandalaActions: (import("../types.js").Action<import("./deploy.js").DeployMandalaInput, import("./deploy.js").DeployMandalaResponse> | import("../types.js").Action<import("./deploy.js").FileMandalaDeployInput, import("./deploy.js").FileMandalaDeployResponse> | import("../types.js").Action<import("./receive.js").SyncMandalaInboxInput, import("./receive.js").SyncMandalaInboxResult> | import("../types.js").Action<import("./send.js").SendMandalaInput, import("./send.js").SendMandalaResult>)[];
9
- //# sourceMappingURL=index.d.ts.map
@@ -1,17 +0,0 @@
1
- /**
2
- * Mandala (BRC-162) token actions: deploy, send to a BRC-169 handle
3
- * (delivered per BRC-232), and receive from `mandala_inbox`.
4
- */
5
- import { deployMandala, fileMandalaDeploy } from './deploy.js';
6
- import { syncMandalaInbox } from './receive.js';
7
- import { sendMandala } from './send.js';
8
- export * from './deploy.js';
9
- export * from './send.js';
10
- export * from './receive.js';
11
- export const mandalaActions = [
12
- deployMandala,
13
- fileMandalaDeploy,
14
- sendMandala,
15
- syncMandalaInbox,
16
- ];
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/mandala/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,cAAc,aAAa,CAAA;AAC3B,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA;AAE5B,MAAM,CAAC,MAAM,cAAc,GAAG;IAC7B,aAAa;IACb,iBAAiB;IACjB,WAAW;IACX,gBAAgB;CAChB,CAAA"}
@@ -1,58 +0,0 @@
1
- /**
2
- * Collect BRC-232 transaction deliveries from the wallet's `mandala_inbox`.
3
- *
4
- * For each message listed (BRC-231 over BRC-104): decode the BRC-169 §7.3
5
- * DAG-CBOR envelope, verify its §7.2 signature against `sender.identityKey`,
6
- * decrypt the BRC-78 `content` with `wallet.decrypt`, check `contentHash`,
7
- * parse the MIME entity, require `application/vnd.metanet.transaction+cbor`,
8
- * decode the DAG-CBOR body and internalize its outputs:
9
- *
10
- * - `wallet payment` → `paymentRemittance { derivationPrefix,
11
- * derivationSuffix, senderIdentityKey }`;
12
- * - `basket insertion` under a `mandala <txid> <vout>` protocol → basket
13
- * `mandala <txid> <vout>`, customInstructions = the derivation triple as given,
14
- * labels `mandala` and `mandala <txid> <vout>`, after checking that the output's
15
- * script names that token.
16
- *
17
- * A message is internalized whole or not at all, and acknowledged only after
18
- * its internalize succeeds. Anything else (an unknown content type or
19
- * protocolID, a token id mismatch, a bad signature, …) leaves the message
20
- * unacknowledged and is reported. SPV is `internalizeAction`'s.
21
- */
22
- import { type WalletInterface } from '@bsv/sdk';
23
- import { type InboxSkip } from '../metanet/inbox.js';
24
- import type { Action } from '../types.js';
25
- export interface SyncMandalaInboxInput {
26
- /** MessageBox server URL (default: "https://messagebox.1sat.app") */
27
- messageboxUrl?: string;
28
- }
29
- /** A message left in the box, and why. */
30
- export type MandalaInboxSkip = InboxSkip;
31
- /** A message internalized and acknowledged. */
32
- export interface MandalaInboxReceipt {
33
- messageId: string;
34
- txid: string;
35
- /** Tokens (BRC-36 deploy outpoints `<txid>.<vout>`) of the Mandala outputs received */
36
- tokenIds: string[];
37
- }
38
- export interface SyncMandalaInboxResult {
39
- received: MandalaInboxReceipt[];
40
- /** Messages left unacknowledged */
41
- skipped: MandalaInboxSkip[];
42
- error?: string;
43
- }
44
- /**
45
- * Internalize one BRC-232 delivery (the DAG-CBOR body of an
46
- * `application/vnd.metanet.transaction+cbor` MIME entity), whole or not at
47
- * all.
48
- *
49
- * @throws InboxSkipError when the body is malformed, names an unknown
50
- * protocol or protocolID, or a token protocolID does not match the script;
51
- * the internalize error when the wallet refuses it
52
- */
53
- export declare function internalizeTransactionDelivery(wallet: Pick<WalletInterface, 'internalizeAction'>, body: Uint8Array): Promise<{
54
- txid: string;
55
- tokenIds: string[];
56
- }>;
57
- export declare const syncMandalaInbox: Action<SyncMandalaInboxInput, SyncMandalaInboxResult>;
58
- //# sourceMappingURL=receive.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"receive.d.ts","sourceRoot":"","sources":["../../src/mandala/receive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAWH,OAAO,EAGN,KAAK,eAAe,EAEpB,MAAM,UAAU,CAAA;AAEjB,OAAO,EACN,KAAK,SAAS,EAId,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAGzC,MAAM,WAAW,qBAAqB;IACrC,qEAAqE;IACrE,aAAa,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,0CAA0C;AAC1C,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAA;AAExC,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,uFAAuF;IACvF,QAAQ,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,mBAAmB,EAAE,CAAA;IAC/B,mCAAmC;IACnC,OAAO,EAAE,gBAAgB,EAAE,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;CACd;AAyHD;;;;;;;;GAQG;AACH,wBAAsB,8BAA8B,CACnD,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,mBAAmB,CAAC,EAClD,IAAI,EAAE,UAAU,GACd,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAW/C;AAED,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACpC,qBAAqB,EACrB,sBAAsB,CAqCtB,CAAA"}