turing-wallet-provider 1.0.2 → 1.0.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
CHANGED
|
@@ -68,7 +68,17 @@ const { tbcPubKey, ordPubKey, identityPubKey } = await wallet.getPubKeys();
|
|
|
68
68
|
Before send TBC to a Bitcoin address(es), you may simply pass an `array` of payment objects.
|
|
69
69
|
|
|
70
70
|
```tsx
|
|
71
|
-
const
|
|
71
|
+
const paymentParams: = [
|
|
72
|
+
{
|
|
73
|
+
satoshis: 10000,
|
|
74
|
+
address: "18izL7Wtm2fx3ALoRY3MkY2VFSMjArP62D",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
satoshis: 54000,
|
|
78
|
+
address: "1q6td54oZU8EPM1PwJcB1Z6upPyMe3Vy2",
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
const { txid, rawtx } = await wallet.sendTbc(paymentParams);
|
|
72
82
|
```
|
|
73
83
|
|
|
74
84
|
##### Get UTXOs
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { TuringProviderType } from "
|
|
2
|
+
import { TuringProviderType } from "../types/providerTypes"
|
|
3
3
|
export declare const TuringContext: import("react").Context<TuringProviderType | undefined>;
|
|
4
4
|
interface TuringProviderProps {
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
export declare const TuringProvider: (props:TuringProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
7
|
+
export declare const TuringProvider: (props: TuringProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export { };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export type
|
|
2
|
-
|
|
3
|
-
ordPubKey: string;
|
|
4
|
-
identityPubKey: string;
|
|
1
|
+
export type PubKey = {
|
|
2
|
+
tbcPubKey: string;
|
|
3
|
+
// ordPubKey: string;
|
|
4
|
+
// identityPubKey: string;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
7
|
-
|
|
8
|
-
ordAddress: string;
|
|
9
|
-
identityAddress: string;
|
|
6
|
+
export type Address = {
|
|
7
|
+
tbcAddress: string;
|
|
8
|
+
// ordAddress: string;
|
|
9
|
+
// identityAddress: string;
|
|
10
10
|
};
|
|
11
11
|
export type Balance = {
|
|
12
|
-
|
|
13
|
-
satoshis: number;
|
|
14
|
-
usdInCents: number;
|
|
12
|
+
tbc: number;
|
|
13
|
+
// satoshis: number;
|
|
14
|
+
// usdInCents: number;
|
|
15
15
|
};
|
|
16
16
|
export type SocialProfile = {
|
|
17
17
|
displayName: string;
|
|
@@ -26,7 +26,7 @@ export type OrdinalData = {
|
|
|
26
26
|
b?: File;
|
|
27
27
|
sigma?: Sigma[];
|
|
28
28
|
list?: Listing;
|
|
29
|
-
|
|
29
|
+
tbc20?: Tbc20;
|
|
30
30
|
lock?: Lock;
|
|
31
31
|
};
|
|
32
32
|
export type Lock = {
|
|
@@ -43,20 +43,20 @@ export type Listing = {
|
|
|
43
43
|
price: number;
|
|
44
44
|
payout: string;
|
|
45
45
|
};
|
|
46
|
-
export type
|
|
46
|
+
export type Tbc20 = {
|
|
47
47
|
id?: string;
|
|
48
48
|
p: string;
|
|
49
49
|
op: string;
|
|
50
50
|
tick?: string;
|
|
51
51
|
amt: string;
|
|
52
|
-
status?:
|
|
52
|
+
status?: Tbc20Status;
|
|
53
53
|
};
|
|
54
54
|
export type Origin = {
|
|
55
55
|
outpoint: string;
|
|
56
56
|
data?: OrdinalData;
|
|
57
57
|
num?: number;
|
|
58
58
|
};
|
|
59
|
-
export declare enum
|
|
59
|
+
export declare enum Tbc20Status {
|
|
60
60
|
Invalid = -1,
|
|
61
61
|
Pending = 0,
|
|
62
62
|
Valid = 1
|
|
@@ -92,12 +92,18 @@ export type SignedMessage = {
|
|
|
92
92
|
message: string;
|
|
93
93
|
derivationTag: DerivationTag;
|
|
94
94
|
};
|
|
95
|
-
export type
|
|
95
|
+
export type SendTransaction = {
|
|
96
|
+
flag: "P2PKH" | "CREATE_COLLECTION" | "CREATE_NFT" | "TRANSFER_NFT" | "FT_MINT" | "FT_TRANSFER" | "FT_MERGE" | "POOLNFT_MINT" | "POOLNFT_INIT" | "POOLNFT_LP" | "POOLNFT_TOFT" | "POOLNFT_TOTBC" | "POOLNFT_MERGE";
|
|
97
|
+
satoshis?: number;
|
|
96
98
|
address?: string;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
collection_data?: string;
|
|
100
|
+
ft_data?: string;
|
|
101
|
+
nft_data?: string;
|
|
102
|
+
collection_id?: string;
|
|
103
|
+
nft_contract_address?: string;
|
|
104
|
+
ft_contract_address?: string;
|
|
105
|
+
tbc_amount?: number;
|
|
106
|
+
ft_amount?: number;
|
|
101
107
|
};
|
|
102
108
|
export type TransferOrdinal = {
|
|
103
109
|
address: string;
|
|
@@ -106,7 +112,7 @@ export type TransferOrdinal = {
|
|
|
106
112
|
};
|
|
107
113
|
export type InternalTuringTags = {
|
|
108
114
|
label: "Turing";
|
|
109
|
-
id: "
|
|
115
|
+
id: "tbc";
|
|
110
116
|
domain: "";
|
|
111
117
|
meta: {};
|
|
112
118
|
} | {
|
|
@@ -130,7 +136,7 @@ export type SignMessage = {
|
|
|
130
136
|
message: string;
|
|
131
137
|
encoding?: "utf8" | "hex" | "base64";
|
|
132
138
|
};
|
|
133
|
-
export type KeyTypes = "
|
|
139
|
+
export type KeyTypes = "tbc" | "ord";
|
|
134
140
|
export type Broadcast = {
|
|
135
141
|
rawtx: string;
|
|
136
142
|
fund?: boolean;
|
|
@@ -167,8 +173,8 @@ export type SignatureRequest = {
|
|
|
167
173
|
* If undefined, the whole script is used.
|
|
168
174
|
* */
|
|
169
175
|
csIdx?: number;
|
|
170
|
-
/** The
|
|
171
|
-
|
|
176
|
+
/** The flag to distinguish the transaction.*/
|
|
177
|
+
flag: "P2PKH" | "FT_MINT" | "FT_TRANSFER" | "FT_MERGE" | "POOLNFT_MINT" | "POOLNFT_INIT" | "POOLNFT_LP" | "POOLNFT_TOFT" | "POOLNFT_TOTBC" | "POOLNFT_MERGE";
|
|
172
178
|
};
|
|
173
179
|
/**
|
|
174
180
|
* `SignatureResponse` contains the signing result corresponding to a `SignatureRequest`.
|
|
@@ -186,9 +192,9 @@ export type SignatureResponse = {
|
|
|
186
192
|
csIdx?: number;
|
|
187
193
|
};
|
|
188
194
|
/**
|
|
189
|
-
* `
|
|
195
|
+
* `SendTbcResponse` contains the result of sendTbc.
|
|
190
196
|
*/
|
|
191
|
-
export type
|
|
197
|
+
export type SendTransactionResponse = {
|
|
192
198
|
txid: string;
|
|
193
199
|
rawtx: string;
|
|
194
200
|
};
|
|
@@ -233,20 +239,20 @@ export type TuringProviderType = {
|
|
|
233
239
|
connect: () => Promise<string | undefined>;
|
|
234
240
|
disconnect: () => Promise<boolean>;
|
|
235
241
|
isConnected: () => Promise<boolean>;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
getSocialProfile: () => Promise<SocialProfile | undefined>;
|
|
242
|
+
getPubKey: () => Promise<PubKey | undefined>;
|
|
243
|
+
getAddress: () => Promise<Address | undefined>;
|
|
244
|
+
// getSocialProfile: () => Promise<SocialProfile | undefined>;
|
|
239
245
|
getBalance: () => Promise<Balance | undefined>;
|
|
240
|
-
getOrdinals: () => Promise<Ordinal[] | undefined>;
|
|
241
|
-
|
|
242
|
-
transferOrdinal: (params: TransferOrdinal) => Promise<string | undefined>;
|
|
243
|
-
purchaseOrdinal: (params: PurchaseOrdinal) => Promise<string | undefined>;
|
|
244
|
-
signMessage: (params: SignMessage) => Promise<SignedMessage | undefined>;
|
|
245
|
-
getSignatures: (params: GetSignatures) => Promise<SignatureResponse[] | undefined>;
|
|
246
|
+
// getOrdinals: () => Promise<Ordinal[] | undefined>;
|
|
247
|
+
sendTransaction: (params: SendTransaction[]) => Promise<SendTransactionResponse | undefined>;
|
|
248
|
+
// transferOrdinal: (params: TransferOrdinal) => Promise<string | undefined>;
|
|
249
|
+
// purchaseOrdinal: (params: PurchaseOrdinal) => Promise<string | undefined>;
|
|
250
|
+
// signMessage: (params: SignMessage) => Promise<SignedMessage | undefined>;
|
|
251
|
+
// getSignatures: (params: GetSignatures) => Promise<SignatureResponse[] | undefined>;
|
|
246
252
|
broadcast: (params: Broadcast) => Promise<string | undefined>;
|
|
247
|
-
getExchangeRate: () => Promise<number | undefined>;
|
|
253
|
+
// getExchangeRate: () => Promise<number | undefined>;
|
|
248
254
|
getPaymentUtxos: () => Promise<Utxos[] | undefined>;
|
|
249
|
-
generateTaggedKeys: (params: TaggedDerivationRequest) => Promise<TaggedDerivationResponse>;
|
|
250
|
-
getTaggedKeys: (params: GetTaggedKeysRequest) => Promise<TaggedDerivationResponse[] | undefined>;
|
|
251
|
-
inscribe: (params: InscribeRequest[]) => Promise<
|
|
255
|
+
// generateTaggedKeys: (params: TaggedDerivationRequest) => Promise<TaggedDerivationResponse>;
|
|
256
|
+
// getTaggedKeys: (params: GetTaggedKeysRequest) => Promise<TaggedDerivationResponse[] | undefined>;
|
|
257
|
+
// inscribe: (params: InscribeRequest[]) => Promise<SendTbcResponse | undefined>;
|
|
252
258
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})(
|
|
3
|
+
exports.Tbc20Status = void 0;
|
|
4
|
+
var Tbc20Status;
|
|
5
|
+
(function (Tbc20Status) {
|
|
6
|
+
Tbc20Status[Tbc20Status["Invalid"] = -1] = "Invalid";
|
|
7
|
+
Tbc20Status[Tbc20Status["Pending"] = 0] = "Pending";
|
|
8
|
+
Tbc20Status[Tbc20Status["Valid"] = 1] = "Valid";
|
|
9
|
+
})(Tbc20Status || (exports.Tbc20Status = Tbc20Status = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turing-wallet-provider",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -15,19 +15,17 @@
|
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"typescript": "^4.5.0",
|
|
18
|
-
"react": "^17.0.0",
|
|
19
|
-
"react-dom": "^17.0.0",
|
|
20
18
|
"@types/react": "^17.0.0",
|
|
21
19
|
"@types/react-dom": "^17.0.0"
|
|
22
20
|
},
|
|
23
21
|
"keywords": [
|
|
24
22
|
"wallet",
|
|
25
23
|
"turing",
|
|
26
|
-
"
|
|
24
|
+
"tbc",
|
|
27
25
|
"bitcoin",
|
|
28
26
|
"turing wallet"
|
|
29
27
|
],
|
|
30
|
-
"author": "
|
|
28
|
+
"author": "Joe",
|
|
31
29
|
"license": "ISC",
|
|
32
30
|
"description": "A provider that makes interacting with Turing Wallet a walk in the park."
|
|
33
|
-
}
|
|
31
|
+
}
|