turing-wallet-provider 1.4.4 → 1.4.6
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/README.md +16 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -168,45 +168,43 @@ broadcastTXsraw(txs.map((tx) => ({ txraw: tx.uncheckedSerialize() })));
|
|
|
168
168
|
|
|
169
169
|
```ts
|
|
170
170
|
//使用示例
|
|
171
|
-
interface
|
|
171
|
+
interface Input {
|
|
172
172
|
txId?: string;
|
|
173
173
|
script?: string;
|
|
174
174
|
satoshis?: number;
|
|
175
175
|
outputIndex: number;
|
|
176
|
-
unfinishedScriptSig: string
|
|
177
|
-
sigPosition: number;
|
|
176
|
+
unfinishedScriptSig: string;//asm 签名使用7369676e6174757265占位
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
interface
|
|
181
|
-
script: string
|
|
179
|
+
interface Output {
|
|
180
|
+
script: string;//asm或hex
|
|
182
181
|
satoshis: number;
|
|
183
182
|
}
|
|
184
183
|
|
|
185
184
|
interface SignAssociatedTransactionRequestData {
|
|
186
185
|
mode: 'sequential' | 'fromSource';//sequential:连续父子交易,fromSource:使用源头交易的所有输出 默认为sequential
|
|
187
186
|
sourceTxraw: string;
|
|
188
|
-
sourceUtxos:
|
|
189
|
-
inputs:
|
|
190
|
-
outputs:
|
|
187
|
+
sourceUtxos: Input[];
|
|
188
|
+
inputs: Input[][];
|
|
189
|
+
outputs: Output[][];
|
|
191
190
|
autoChange: boolean;//默认为true true则子交易最后一个输出由钱包设置为找零输出
|
|
192
191
|
}
|
|
193
192
|
|
|
194
193
|
//p2pkh示例参数
|
|
195
|
-
const sourceUtxos:
|
|
194
|
+
const sourceUtxos: Input[] = [
|
|
196
195
|
{
|
|
197
196
|
txId: "",
|
|
198
197
|
outputIndex: 0,
|
|
199
198
|
satoshis: 1000000000,
|
|
200
199
|
script: tbc.Script.buildPublicKeyHashOut(address).toString(),
|
|
201
|
-
unfinishedScriptSig:
|
|
202
|
-
sigPosition: 0
|
|
200
|
+
unfinishedScriptSig: `7369676e6174757265 ${publicKey}`,
|
|
203
201
|
}
|
|
204
202
|
]
|
|
205
203
|
|
|
206
|
-
const inputs:
|
|
204
|
+
const inputs: Input[][] = [
|
|
207
205
|
[
|
|
208
|
-
{ outputIndex: 0, unfinishedScriptSig:
|
|
209
|
-
{ outputIndex: 1, unfinishedScriptSig:
|
|
206
|
+
{ outputIndex: 0, unfinishedScriptSig: `7369676e6174757265 ${publicKey}`},
|
|
207
|
+
{ outputIndex: 1, unfinishedScriptSig: `7369676e6174757265 ${publicKey}`},
|
|
210
208
|
{
|
|
211
209
|
txId: "",
|
|
212
210
|
outputIndex: 1,
|
|
@@ -217,13 +215,13 @@ const inputs: intput[][] = [
|
|
|
217
215
|
}//和父子交易无关的输入
|
|
218
216
|
],
|
|
219
217
|
[
|
|
220
|
-
{ outputIndex: 0, unfinishedScriptSig:
|
|
221
|
-
{ outputIndex: 1, unfinishedScriptSig:
|
|
218
|
+
{ outputIndex: 0, unfinishedScriptSig: `7369676e6174757265 ${publicKey}`},
|
|
219
|
+
{ outputIndex: 1, unfinishedScriptSig: `7369676e6174757265 ${publicKey}`}
|
|
222
220
|
]
|
|
223
221
|
];
|
|
224
222
|
|
|
225
|
-
const outputs:
|
|
226
|
-
[{ script: tbc.Script.buildPublicKeyHashOut(address).toString(), satoshis:
|
|
223
|
+
const outputs: Output[][] = [
|
|
224
|
+
[{ script: tbc.Script.buildPublicKeyHashOut(address).toString(), satoshis: 5000000 }, { script: tbc.Script.buildPublicKeyHashOut(address).toString(), satoshis: 5000000 }]
|
|
227
225
|
|
|
228
226
|
, [{ script: tbc.Script.buildPublicKeyHashOut(address).toString(), satoshis: 5000000 }, { script: tbc.Script.buildPublicKeyHashOut(address).toString(), satoshis: 5000000 }]
|
|
229
227
|
]
|