ecash-agora 0.1.1-rc
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/.eslintignore +8 -0
- package/.nycrc +4 -0
- package/README.md +122 -0
- package/agora.py +771 -0
- package/dist/ad.d.ts +15 -0
- package/dist/ad.d.ts.map +1 -0
- package/dist/ad.js +111 -0
- package/dist/ad.js.map +1 -0
- package/dist/agora.d.ts +178 -0
- package/dist/agora.d.ts.map +1 -0
- package/dist/agora.js +432 -0
- package/dist/agora.js.map +1 -0
- package/dist/consts.d.ts +5 -0
- package/dist/consts.d.ts.map +1 -0
- package/dist/consts.js +9 -0
- package/dist/consts.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/oneshot.d.ts +34 -0
- package/dist/oneshot.d.ts.map +1 -0
- package/dist/oneshot.js +204 -0
- package/dist/oneshot.js.map +1 -0
- package/dist/partial.d.ts +256 -0
- package/dist/partial.d.ts.map +1 -0
- package/dist/partial.js +955 -0
- package/dist/partial.js.map +1 -0
- package/eslint.config.js +16 -0
- package/package.json +52 -0
- package/tests/oneshot.test.ts +569 -0
- package/tests/partial-helper-alp.ts +131 -0
- package/tests/partial-helper-slp.ts +154 -0
- package/tests/partial.alp.bigsats.test.ts +694 -0
- package/tests/partial.alp.test.ts +586 -0
- package/tests/partial.slp.bigsats.test.ts +681 -0
- package/tests/partial.slp.test.ts +630 -0
- package/tsconfig.build.json +13 -0
- package/tsconfig.json +19 -0
package/dist/oneshot.js
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// Copyright (c) 2024 The Bitcoin developers
|
|
2
|
+
// Distributed under the MIT software license, see the accompanying
|
|
3
|
+
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
+
import { ALL_ANYONECANPAY_BIP143, ALL_BIP143, Bytes, OP_0, OP_1, OP_2, OP_3DUP, OP_CAT, OP_CHECKDATASIGVERIFY, OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CODESEPARATOR, OP_DROP, OP_ELSE, OP_ENDIF, OP_EQUAL, OP_EQUALVERIFY, OP_HASH256, OP_IF, OP_NIP, OP_NUM2BIN, OP_OVER, OP_ROT, OP_SHA256, OP_SPLIT, OP_SWAP, Script, WriterBytes, WriterLength, flagSignature, isPushOp, pushBytesOp, readTxOutput, sha256d, strToBytes, writeTxOutput, } from 'ecash-lib';
|
|
5
|
+
import { AGORA_LOKAD_ID } from './consts.js';
|
|
6
|
+
/**
|
|
7
|
+
* Agora offer that has to be accepted in "one shot", i.e. all or nothing.
|
|
8
|
+
* This is useful for offers that offer exactly 1 token, especially NFTs.
|
|
9
|
+
*
|
|
10
|
+
* The covenant is reasonably simple, see
|
|
11
|
+
* https://read.cash/@pein/bch-covenants-with-spedn-4a980ed3 for an explanation of the
|
|
12
|
+
* covenant mechanism, but uses two optimizations:
|
|
13
|
+
* 1. It uses ANYONECANPAY as sighash for the "accept" path, which makes the sighash
|
|
14
|
+
* preimage start with `1000....00000`, which can be created with
|
|
15
|
+
* `OP_1 68 OP_NUM2BIN`, saving around 64 bytes.
|
|
16
|
+
* 2. It uses OP_CODESEPARATOR before the OP_CHECKSIG, which cuts out the entire script
|
|
17
|
+
* code, leaving only the OP_CHECKSIG behind. The scriptCode part in the BIP143
|
|
18
|
+
* sighash now just becomes `01ac`, which is both easier to deal with in the OP_SPLIT
|
|
19
|
+
* and also saves 100 bytes or so (depending on the enforced outputs).
|
|
20
|
+
**/
|
|
21
|
+
export class AgoraOneshot {
|
|
22
|
+
constructor({ enforcedOutputs, cancelPk, }) {
|
|
23
|
+
this.enforcedOutputs = enforcedOutputs;
|
|
24
|
+
this.cancelPk = cancelPk;
|
|
25
|
+
}
|
|
26
|
+
/** Build the Script enforcing the Agora offer covenant. */
|
|
27
|
+
script() {
|
|
28
|
+
const serEnforcedOutputs = (writer) => {
|
|
29
|
+
for (const output of this.enforcedOutputs) {
|
|
30
|
+
writeTxOutput(output, writer);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const writerLength = new WriterLength();
|
|
34
|
+
serEnforcedOutputs(writerLength);
|
|
35
|
+
const writer = new WriterBytes(writerLength.length);
|
|
36
|
+
serEnforcedOutputs(writer);
|
|
37
|
+
const enforcedOutputsSer = writer.data;
|
|
38
|
+
return Script.fromOps([
|
|
39
|
+
OP_IF, // if is_accept
|
|
40
|
+
pushBytesOp(enforcedOutputsSer), // push enforced_outputs
|
|
41
|
+
OP_SWAP, // swap buyer_outputs, enforced_outputs
|
|
42
|
+
OP_CAT, // outputs = OP_CAT(enforced_outputs, buyer_outputs)
|
|
43
|
+
OP_HASH256, // expected_hash_outputs = OP_HASH256(outputs)
|
|
44
|
+
OP_OVER, // duplicate preimage_4_10,
|
|
45
|
+
// push hash_outputs_idx:
|
|
46
|
+
pushBytesOp(new Uint8Array([
|
|
47
|
+
36 + // 4. outpoint
|
|
48
|
+
2 + // 5. scriptCode, truncated to 01ac via OP_CODESEPARATOR
|
|
49
|
+
8 + // 6. value
|
|
50
|
+
4, // 7. sequence
|
|
51
|
+
])),
|
|
52
|
+
OP_SPLIT, // split into preimage_4_7 and preimage_8_10
|
|
53
|
+
OP_NIP, // remove preimage_4_7
|
|
54
|
+
pushBytesOp(new Uint8Array([32])), // push 32 onto the stack
|
|
55
|
+
OP_SPLIT, // split into actual_hash_outputs and preimage_9_10
|
|
56
|
+
OP_DROP, // drop preimage_9_10
|
|
57
|
+
OP_EQUALVERIFY, // expected_hash_outputs == actual_hash_outputs
|
|
58
|
+
OP_2, // push tx version
|
|
59
|
+
// length of BIP143 preimage parts 1 to 3
|
|
60
|
+
pushBytesOp(new Uint8Array([4 + 32 + 32])),
|
|
61
|
+
// build BIP143 preimage parts 1 to 3 for ANYONECANPAY using OP_NUM2BIN
|
|
62
|
+
OP_NUM2BIN,
|
|
63
|
+
OP_SWAP, // swap preimage_4_10 and preimage_1_3
|
|
64
|
+
OP_CAT, // preimage = OP_CAT(preimage_1_3, preimage_4_10)
|
|
65
|
+
OP_SHA256, // preimage_sha256 = OP_SHA256(preimage)
|
|
66
|
+
OP_3DUP, // OP_3DUP(covenant_pk, covenant_sig, preimage_sha256)
|
|
67
|
+
OP_ROT, // -> covenant_sig | preimage_sha256 | covenant_pk
|
|
68
|
+
OP_CHECKDATASIGVERIFY, // verify preimage matches covenant_sig
|
|
69
|
+
OP_DROP, // drop preimage_sha256
|
|
70
|
+
// push ALL|ANYONECANPAY|BIP143 onto the stack
|
|
71
|
+
pushBytesOp(new Uint8Array([ALL_ANYONECANPAY_BIP143.toInt()])),
|
|
72
|
+
OP_CAT, // append sighash flags onto covenant_sig
|
|
73
|
+
OP_SWAP, // swap covenant_pk, covenant_sig_flagged
|
|
74
|
+
OP_ELSE, // cancel path
|
|
75
|
+
pushBytesOp(this.cancelPk), // pubkey that can cancel the covenant
|
|
76
|
+
OP_ENDIF,
|
|
77
|
+
// cut out everything except the OP_CHECKSIG from the BIP143 scriptCode
|
|
78
|
+
OP_CODESEPARATOR,
|
|
79
|
+
OP_CHECKSIG,
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
static fromRedeemScript(redeemScript, opreturnScript) {
|
|
83
|
+
const ops = redeemScript.ops();
|
|
84
|
+
const outputsSerOp = ops.next();
|
|
85
|
+
if (!isPushOp(outputsSerOp)) {
|
|
86
|
+
throw new Error('Op 0 expected to be pushop for outputsSer');
|
|
87
|
+
}
|
|
88
|
+
if (ops.next() !== OP_DROP) {
|
|
89
|
+
throw new Error('Op 1 expected to be OP_DROP');
|
|
90
|
+
}
|
|
91
|
+
const cancelPkOp = ops.next();
|
|
92
|
+
if (!isPushOp(cancelPkOp)) {
|
|
93
|
+
throw new Error('Op 2 expected to be pushop for cancelPk');
|
|
94
|
+
}
|
|
95
|
+
if (cancelPkOp.data.length != 33) {
|
|
96
|
+
throw new Error(`Expected cancelPk to be 33 bytes`);
|
|
97
|
+
}
|
|
98
|
+
if (ops.next() !== OP_CHECKSIGVERIFY) {
|
|
99
|
+
throw new Error('Op 3 expected to be OP_CHECKSIGVERIFY');
|
|
100
|
+
}
|
|
101
|
+
const covenantVariantOp = ops.next();
|
|
102
|
+
if (!isPushOp(covenantVariantOp)) {
|
|
103
|
+
throw new Error('Op 4 expected to be pushop for covenantVariant');
|
|
104
|
+
}
|
|
105
|
+
if (ops.next() !== OP_EQUALVERIFY) {
|
|
106
|
+
throw new Error('Op 5 expected to be OP_EQUALVERIFY');
|
|
107
|
+
}
|
|
108
|
+
const lokadIdOp = ops.next();
|
|
109
|
+
if (!isPushOp(lokadIdOp)) {
|
|
110
|
+
throw new Error('Op 6 expected to be pushop for LOKAD ID');
|
|
111
|
+
}
|
|
112
|
+
const outputsSerBytes = new Bytes(outputsSerOp.data);
|
|
113
|
+
const enforcedOutputs = [
|
|
114
|
+
{
|
|
115
|
+
value: BigInt(0),
|
|
116
|
+
script: opreturnScript,
|
|
117
|
+
},
|
|
118
|
+
];
|
|
119
|
+
while (outputsSerBytes.data.length > outputsSerBytes.idx) {
|
|
120
|
+
enforcedOutputs.push(readTxOutput(outputsSerBytes));
|
|
121
|
+
}
|
|
122
|
+
return new AgoraOneshot({
|
|
123
|
+
enforcedOutputs,
|
|
124
|
+
cancelPk: cancelPkOp.data,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
adScript() {
|
|
128
|
+
const serOutputs = (writer) => {
|
|
129
|
+
for (const output of this.enforcedOutputs.slice(1)) {
|
|
130
|
+
writeTxOutput(output, writer);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
const writerLength = new WriterLength();
|
|
134
|
+
serOutputs(writerLength);
|
|
135
|
+
const writer = new WriterBytes(writerLength.length);
|
|
136
|
+
serOutputs(writer);
|
|
137
|
+
const outputsSer = writer.data;
|
|
138
|
+
return Script.fromOps([
|
|
139
|
+
pushBytesOp(outputsSer),
|
|
140
|
+
OP_DROP,
|
|
141
|
+
pushBytesOp(this.cancelPk),
|
|
142
|
+
OP_CHECKSIGVERIFY,
|
|
143
|
+
pushBytesOp(strToBytes(AgoraOneshot.COVENANT_VARIANT)),
|
|
144
|
+
OP_EQUALVERIFY,
|
|
145
|
+
pushBytesOp(AGORA_LOKAD_ID),
|
|
146
|
+
OP_EQUAL,
|
|
147
|
+
]);
|
|
148
|
+
}
|
|
149
|
+
askedSats() {
|
|
150
|
+
return this.enforcedOutputs.reduce((prev, output) => prev + BigInt(output.value), 0n);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
AgoraOneshot.COVENANT_VARIANT = 'ONESHOT';
|
|
154
|
+
export const AgoraOneshotSignatory = (covenantSk, covenantPk, numEnforcedOutputs) => {
|
|
155
|
+
return (ecc, input) => {
|
|
156
|
+
const preimage = input.sigHashPreimage(ALL_ANYONECANPAY_BIP143, 0);
|
|
157
|
+
const sighash = sha256d(preimage.bytes);
|
|
158
|
+
const covenantSig = ecc.schnorrSign(covenantSk, sighash);
|
|
159
|
+
const serBuyerOutputs = (writer) => {
|
|
160
|
+
for (const output of input.unsignedTx.tx.outputs.slice(numEnforcedOutputs)) {
|
|
161
|
+
writeTxOutput(output, writer);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const writerLength = new WriterLength();
|
|
165
|
+
serBuyerOutputs(writerLength);
|
|
166
|
+
const writer = new WriterBytes(writerLength.length);
|
|
167
|
+
serBuyerOutputs(writer);
|
|
168
|
+
const buyerOutputsSer = writer.data;
|
|
169
|
+
return Script.fromOps([
|
|
170
|
+
pushBytesOp(covenantPk),
|
|
171
|
+
pushBytesOp(covenantSig),
|
|
172
|
+
pushBytesOp(preimage.bytes.slice(4 + 32 + 32)), // preimage_4_10
|
|
173
|
+
pushBytesOp(buyerOutputsSer),
|
|
174
|
+
OP_1, // is_accept = true
|
|
175
|
+
pushBytesOp(preimage.redeemScript.bytecode),
|
|
176
|
+
]);
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
export const AgoraOneshotCancelSignatory = (cancelSk) => {
|
|
180
|
+
return (ecc, input) => {
|
|
181
|
+
const preimage = input.sigHashPreimage(ALL_BIP143, 0);
|
|
182
|
+
const sighash = sha256d(preimage.bytes);
|
|
183
|
+
const cancelSig = flagSignature(ecc.schnorrSign(cancelSk, sighash), ALL_BIP143);
|
|
184
|
+
return Script.fromOps([
|
|
185
|
+
pushBytesOp(cancelSig),
|
|
186
|
+
OP_0, // is_accept = false
|
|
187
|
+
pushBytesOp(preimage.redeemScript.bytecode),
|
|
188
|
+
]);
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
export const AgoraOneshotAdSignatory = (cancelSk) => {
|
|
192
|
+
return (ecc, input) => {
|
|
193
|
+
const preimage = input.sigHashPreimage(ALL_BIP143);
|
|
194
|
+
const sighash = sha256d(preimage.bytes);
|
|
195
|
+
const cancelSig = flagSignature(ecc.schnorrSign(cancelSk, sighash), ALL_BIP143);
|
|
196
|
+
return Script.fromOps([
|
|
197
|
+
pushBytesOp(AGORA_LOKAD_ID),
|
|
198
|
+
pushBytesOp(strToBytes(AgoraOneshot.COVENANT_VARIANT)),
|
|
199
|
+
pushBytesOp(cancelSig),
|
|
200
|
+
pushBytesOp(preimage.redeemScript.bytecode),
|
|
201
|
+
]);
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=oneshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oneshot.js","sourceRoot":"","sources":["../src/oneshot.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,mEAAmE;AACnE,sEAAsE;AAEtE,OAAO,EACH,uBAAuB,EACvB,UAAU,EACV,KAAK,EAEL,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,MAAM,EACN,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,UAAU,EACV,KAAK,EACL,MAAM,EAC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signatory, UnsignedTxInput } from 'ecash-lib';
|
|
2
|
+
/**
|
|
3
|
+
* "Human viable" parameters for partial Agora offers, can serve as a basis to
|
|
4
|
+
* approximate the actual Script parameters via AgoraPartial.approximateParams.
|
|
5
|
+
**/
|
|
6
|
+
export interface AgoraPartialParams {
|
|
7
|
+
/**
|
|
8
|
+
* Offered tokens in base tokens. After param approximation, this may differ
|
|
9
|
+
* from `AgoraPartial`.offeredTokens(), so make sure to use that when
|
|
10
|
+
* preparing the offer!
|
|
11
|
+
*
|
|
12
|
+
* For SLP, the maximum allowed value here is 0xffffffffffffffff, for ALP it
|
|
13
|
+
* is 0xffffffffffff.
|
|
14
|
+
**/
|
|
15
|
+
offeredTokens: bigint;
|
|
16
|
+
/**
|
|
17
|
+
* Price in nano sats per (base) token.
|
|
18
|
+
* Using nsats allows users to specify a very large range of prices, from
|
|
19
|
+
* tokens where billions of them cost a single sat, to offers where single
|
|
20
|
+
* tokens can cost millions of XEC.
|
|
21
|
+
**/
|
|
22
|
+
priceNanoSatsPerToken: bigint;
|
|
23
|
+
/**
|
|
24
|
+
* Public key of the offering party.
|
|
25
|
+
* This is the public key of the wallet, and it serves both as the pubkey to
|
|
26
|
+
* cancel the offer, as well as the pubkey of the P2PKH script to send the
|
|
27
|
+
* sats to.
|
|
28
|
+
**/
|
|
29
|
+
makerPk: Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Minimum number of tokens that can be accepted.
|
|
32
|
+
* Can be used to avoid spam and prevent exploits with really small
|
|
33
|
+
* accept amounts.
|
|
34
|
+
* Also, small amounts can have very bad precision, and raising the minimum
|
|
35
|
+
* amount can mitigate this.
|
|
36
|
+
* It can also just be used to increase the minimum for which tokens are
|
|
37
|
+
* available.
|
|
38
|
+
* It is recommended to set this to 0.1% of the offered amount.
|
|
39
|
+
**/
|
|
40
|
+
minAcceptedTokens: bigint;
|
|
41
|
+
/** Token ID of the offered token, in big-endian hex. */
|
|
42
|
+
tokenId: string;
|
|
43
|
+
/** Token type of the offered token. */
|
|
44
|
+
tokenType: number;
|
|
45
|
+
/** Token protocol of the offered token. */
|
|
46
|
+
tokenProtocol: 'SLP' | 'ALP';
|
|
47
|
+
/** Dust amount to be used by the script. */
|
|
48
|
+
dustAmount?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Minimum tokenScaleFactor when approximating numTokenTruncBytes.
|
|
51
|
+
* It is recommended to leave this at the default (1000), but it is exposed
|
|
52
|
+
* to either increase price precision and granularity of token amounts (by
|
|
53
|
+
* raising the limit), or to lower price precision but allow more fine-
|
|
54
|
+
* grained token amounts (by lowering the limit).
|
|
55
|
+
**/
|
|
56
|
+
minTokenScaleFactor?: bigint;
|
|
57
|
+
/**
|
|
58
|
+
* Minimum integer when representing the price
|
|
59
|
+
* (scaledTruncTokensPerTruncSat), the approximation will truncate
|
|
60
|
+
* additional sats bytes in order to make scaledTruncTokensPerTruncSat
|
|
61
|
+
* bigger.
|
|
62
|
+
* It is recommended to leave this at the default (1000), but it is exposed
|
|
63
|
+
* for cases where a small number of tokens are offered for a big price,
|
|
64
|
+
* this can be used to improve precision.
|
|
65
|
+
**/
|
|
66
|
+
minPriceInteger?: bigint;
|
|
67
|
+
/**
|
|
68
|
+
* Minimum ratio tokenScaleFactor / scaledTruncTokensPerTruncSat, this can
|
|
69
|
+
* be used to limit the additional truncation introduced by minPriceInteger.
|
|
70
|
+
* It is recommended to leave this at the default (1000), but it is exposed
|
|
71
|
+
* for cases where the askedSats for small accept amounts are very
|
|
72
|
+
* inaccurate.
|
|
73
|
+
**/
|
|
74
|
+
minScaleRatio?: bigint;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* An Agora offer that can partially be accepted.
|
|
78
|
+
* In contrast to oneshot offers, these can be partially accepted, with the
|
|
79
|
+
* remainder sent back to a new UTXO with the same terms but reduced token
|
|
80
|
+
* amount.
|
|
81
|
+
* This is useful for fungible tokens, where the maker doesn't know upfront how
|
|
82
|
+
* many tokens the takers would like to acquire.
|
|
83
|
+
*
|
|
84
|
+
* The Script enforces that the taker re-creates an offer with the same terms
|
|
85
|
+
* with tokens he didn't buy.
|
|
86
|
+
* It calculates the required sats to accept the offer based on the price per
|
|
87
|
+
* token, and the number of tokens requested by the taker, and enforces the
|
|
88
|
+
* correct amount of satoshis are sent to the P2PKH of the maker of this offer.
|
|
89
|
+
*
|
|
90
|
+
* Offers can also be cancelled by the maker of the offer.
|
|
91
|
+
*
|
|
92
|
+
* One complication is the price calculation, due to eCash's limited precision
|
|
93
|
+
* and range (31-bits plus 1 sign bit) of its Script integers.
|
|
94
|
+
* We employ two strategies to increase precision and range:
|
|
95
|
+
* - "Scaling": We scale up values to the maximum representable, such that we
|
|
96
|
+
* make full use of the 31 bits available. Values that have been scaled up
|
|
97
|
+
* have the prefix "scaled", and the scale factor is "tokenScaleFactor". We
|
|
98
|
+
* only scale token amounts.
|
|
99
|
+
* - "Truncation": We cut off bytes at the "end" of numbers, essentially
|
|
100
|
+
* dividing them by 256 for each truncation, until they fit in 31 bits, so we
|
|
101
|
+
* can use arithmetic opcodes. Later we "un-truncate" values again by adding
|
|
102
|
+
* the bytes back. We use OP_CAT to un-truncate values, which doesn't care
|
|
103
|
+
* about the 31-bit limit. Values that have been truncated have the "trunc"
|
|
104
|
+
* prefix. We truncate both token amounts (by numTokenTruncBytes bytes) and
|
|
105
|
+
* sats amounts (by numSatsTruncBytes).
|
|
106
|
+
*
|
|
107
|
+
* Scaling and truncation can be combined, such that the token price is in
|
|
108
|
+
* "scaledTruncTokensPerTruncSat".
|
|
109
|
+
* Together, they give us a very large range of representable values, while
|
|
110
|
+
* keeping a decent precision.
|
|
111
|
+
*
|
|
112
|
+
* Ideally, eCash can eventually raise the maximum integer size to e.g. 64-bits,
|
|
113
|
+
* which would greatly increase the precision. The strategies employed are
|
|
114
|
+
* useful there too, we simply get a much more accurate price calculation.
|
|
115
|
+
**/
|
|
116
|
+
export declare class AgoraPartial {
|
|
117
|
+
static COVENANT_VARIANT: string;
|
|
118
|
+
/**
|
|
119
|
+
* Truncated amount that's offered.
|
|
120
|
+
* The last numTokenTruncBytes bytes are truncated to allow representing it
|
|
121
|
+
* in Script or to increase precision.
|
|
122
|
+
* This means that tokens can only be accepted at a granularity of
|
|
123
|
+
* 2^(8*numTokenTruncBytes).
|
|
124
|
+
* offeredTokens = truncTokens * 2^(8*numTokenTruncBytes).
|
|
125
|
+
**/
|
|
126
|
+
truncTokens: bigint;
|
|
127
|
+
/**
|
|
128
|
+
* How many bytes are truncated from the real token amount, so it fits into
|
|
129
|
+
* 31-bit ints, or to increase precision.
|
|
130
|
+
**/
|
|
131
|
+
numTokenTruncBytes: number;
|
|
132
|
+
/**
|
|
133
|
+
* Factor token amounts will be multiplied with in the Script to improve
|
|
134
|
+
* precision.
|
|
135
|
+
**/
|
|
136
|
+
tokenScaleFactor: bigint;
|
|
137
|
+
/**
|
|
138
|
+
* Price in scaled trunc tokens per truncated sat.
|
|
139
|
+
* This unit may seem a bit bizzare, but it is exactly what is needed in the
|
|
140
|
+
* Script calculation: The "acceptedTokens" coming from the taker is both
|
|
141
|
+
* scaled by tokenScaleFactor and also truncated by numTokenTruncBytes
|
|
142
|
+
* bytes, so we only have to divide the acceptedTokens by this number to get
|
|
143
|
+
* the required (truncated) sats. So we only have to un-truncate that and we
|
|
144
|
+
* have the asked sats.
|
|
145
|
+
**/
|
|
146
|
+
scaledTruncTokensPerTruncSat: bigint;
|
|
147
|
+
/**
|
|
148
|
+
* How many bytes are truncated from the real sats amount, so it fits into
|
|
149
|
+
* 31-bit ints or to improve precision.
|
|
150
|
+
**/
|
|
151
|
+
numSatsTruncBytes: number;
|
|
152
|
+
/**
|
|
153
|
+
* Where the sats for the tokens should go, and who can cancel the trade.
|
|
154
|
+
**/
|
|
155
|
+
makerPk: Uint8Array;
|
|
156
|
+
/**
|
|
157
|
+
* How many tokens (scaled and truncated) at minimum have to be accepted.
|
|
158
|
+
**/
|
|
159
|
+
minAcceptedScaledTruncTokens: bigint;
|
|
160
|
+
/** Token of the contract, in big-endian hex. */
|
|
161
|
+
tokenId: string;
|
|
162
|
+
/** Token type offered */
|
|
163
|
+
tokenType: number;
|
|
164
|
+
/** Token protocol of the offered token */
|
|
165
|
+
tokenProtocol: 'SLP' | 'ALP';
|
|
166
|
+
/** Byte length of the Script, after OP_CODESEPARATOR. */
|
|
167
|
+
scriptLen: number;
|
|
168
|
+
/**
|
|
169
|
+
* Dust amount of the network, the Script will enforce token outputs to have
|
|
170
|
+
* this amount.
|
|
171
|
+
**/
|
|
172
|
+
dustAmount: number;
|
|
173
|
+
constructor(params: {
|
|
174
|
+
truncTokens: bigint;
|
|
175
|
+
numTokenTruncBytes: number;
|
|
176
|
+
tokenScaleFactor: bigint;
|
|
177
|
+
scaledTruncTokensPerTruncSat: bigint;
|
|
178
|
+
numSatsTruncBytes: number;
|
|
179
|
+
makerPk: Uint8Array;
|
|
180
|
+
minAcceptedScaledTruncTokens: bigint;
|
|
181
|
+
tokenId: string;
|
|
182
|
+
tokenType: number;
|
|
183
|
+
tokenProtocol: 'SLP' | 'ALP';
|
|
184
|
+
scriptLen: number;
|
|
185
|
+
dustAmount: number;
|
|
186
|
+
});
|
|
187
|
+
/**
|
|
188
|
+
* Approximate good script parameters for the given offer params.
|
|
189
|
+
* Note: This is not guaranteed to be optimal and is done on a best-effort
|
|
190
|
+
* basis.
|
|
191
|
+
* @param params Offer params to approximate, see AgoraPartialParams for
|
|
192
|
+
* details.
|
|
193
|
+
* @param scriptIntegerBits How many bits Script integers have on the
|
|
194
|
+
* network. On XEC, this must be 32, but if it is raised in the
|
|
195
|
+
* future to e.g. 64-bit integers, this can be set to 64 to greatly
|
|
196
|
+
* increase accuracy.
|
|
197
|
+
**/
|
|
198
|
+
static approximateParams(params: AgoraPartialParams, scriptIntegerBits?: bigint): AgoraPartial;
|
|
199
|
+
updateScriptLen(): void;
|
|
200
|
+
/**
|
|
201
|
+
* How many tokens are accually offered by the Script.
|
|
202
|
+
* This may differ from the offeredTokens in the AgoraPartialParams used to
|
|
203
|
+
* approximate this AgoraPartial.
|
|
204
|
+
**/
|
|
205
|
+
offeredTokens(): bigint;
|
|
206
|
+
/**
|
|
207
|
+
* Actual minimum acceptable tokens of this Script.
|
|
208
|
+
* This may differ from the minAcceptedTokens in the AgoraPartialParams used
|
|
209
|
+
* to approximate this AgoraPartial.
|
|
210
|
+
**/
|
|
211
|
+
minAcceptedTokens(): bigint;
|
|
212
|
+
/**
|
|
213
|
+
* Calculate the actually asked satoshi amount for the given accepted number of tokens.
|
|
214
|
+
* This is the exact amount that has to be sent to makerPk's P2PKH address
|
|
215
|
+
* to accept the offer.
|
|
216
|
+
* `acceptedTokens` must have the lowest numTokenTruncBytes bytes set to 0,
|
|
217
|
+
* use prepareAcceptedTokens to do so.
|
|
218
|
+
**/
|
|
219
|
+
askedSats(acceptedTokens: bigint): bigint;
|
|
220
|
+
/**
|
|
221
|
+
* Prepare the given acceptedTokens amount for the Script; `acceptedTokens`
|
|
222
|
+
* must have the lowest numTokenTruncBytes bytes set to 0 and this function
|
|
223
|
+
* does this for us.
|
|
224
|
+
**/
|
|
225
|
+
prepareAcceptedTokens(acceptedTokens: bigint): bigint;
|
|
226
|
+
/**
|
|
227
|
+
* Calculate the actual priceNanoSatsPerToken of this offer, factoring in
|
|
228
|
+
* all approximation inacurracies.
|
|
229
|
+
* Due to the rounding, the price can change based on the accepted token
|
|
230
|
+
* amount. By default it calculates the price per token for accepting the
|
|
231
|
+
* entire offer.
|
|
232
|
+
**/
|
|
233
|
+
priceNanoSatsPerToken(acceptedTokens?: bigint): bigint;
|
|
234
|
+
adPushdata(): Uint8Array;
|
|
235
|
+
covenantConsts(): [Uint8Array, number];
|
|
236
|
+
script(): Script;
|
|
237
|
+
private _scriptBuildOpReturn;
|
|
238
|
+
private _scriptBuildSlpOpReturn;
|
|
239
|
+
private _scriptBuildAlpOpReturn;
|
|
240
|
+
private _scriptSerTruncTokens;
|
|
241
|
+
private _scriptOutro;
|
|
242
|
+
/**
|
|
243
|
+
* redeemScript of the Script advertizing this offer.
|
|
244
|
+
* It requires a setup tx followed by the actual offer, which reveals
|
|
245
|
+
* the covenantConsts.
|
|
246
|
+
* The reason we have an OP_CHECKSIGVERIFY (as opposed to just leaving it
|
|
247
|
+
* as "anyone can spend with this pushdata") is so that others on the
|
|
248
|
+
* network can't spend this UTXO (and potentially take the tokens in it),
|
|
249
|
+
* and only the maker can spend it.
|
|
250
|
+
**/
|
|
251
|
+
adScript(): Script;
|
|
252
|
+
}
|
|
253
|
+
export declare const AgoraPartialSignatory: (params: AgoraPartial, acceptedTruncTokens: bigint, covenantSk: Uint8Array, covenantPk: Uint8Array) => Signatory;
|
|
254
|
+
export declare const AgoraPartialCancelSignatory: (makerSk: Uint8Array, tokenProtocol: 'SLP' | 'ALP') => Signatory;
|
|
255
|
+
export declare const AgoraPartialAdSignatory: (makerSk: Uint8Array) => (ecc: Ecc, input: UnsignedTxInput) => Script;
|
|
256
|
+
//# sourceMappingURL=partial.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial.d.ts","sourceRoot":"","sources":["../src/partial.ts"],"names":[],"mappings":"AAIA,OAAO,EAKH,GAAG,EAsDH,MAAM,EAEN,SAAS,EAGT,eAAe,EAKlB,MAAM,WAAW,CAAC;AAGnB;;;IAGI;AACJ,MAAM,WAAW,kBAAkB;IAC/B;;;;;;;QAOI;IACJ,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;QAKI;IACJ,qBAAqB,EAAE,MAAM,CAAC;IAC9B;;;;;QAKI;IACJ,OAAO,EAAE,UAAU,CAAC;IACpB;;;;;;;;;QASI;IACJ,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,2CAA2C;IAC3C,aAAa,EAAE,KAAK,GAAG,KAAK,CAAC;IAC7B,4CAA4C;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;IAC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