mainnet-js 2.7.22 → 2.7.24
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/index.html +1 -1
- package/dist/{mainnet-2.7.22.js → mainnet-2.7.24.js} +4 -24
- package/dist/module/index.d.ts +0 -2
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +0 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/network/index.d.ts +1 -1
- package/dist/module/network/index.d.ts.map +1 -1
- package/dist/module/network/index.js +1 -1
- package/dist/module/network/index.js.map +1 -1
- package/dist/module/util/index.d.ts +0 -1
- package/dist/module/util/index.d.ts.map +1 -1
- package/dist/module/util/index.js +0 -1
- package/dist/module/util/index.js.map +1 -1
- package/dist/module/wallet/Base.d.ts +1 -2
- package/dist/module/wallet/Base.d.ts.map +1 -1
- package/dist/module/wallet/Base.js +0 -4
- package/dist/module/wallet/Base.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -2
- package/src/network/index.ts +1 -0
- package/src/util/index.ts +0 -1
- package/src/wallet/Base.ts +0 -9
- package/dist/module/util/walletConnect.d.ts +0 -22
- package/dist/module/util/walletConnect.d.ts.map +0 -1
- package/dist/module/util/walletConnect.js +0 -57
- package/dist/module/util/walletConnect.js.map +0 -1
- package/dist/module/wallet/Bcmr.d.ts +0 -108
- package/dist/module/wallet/Bcmr.d.ts.map +0 -1
- package/dist/module/wallet/Bcmr.js +0 -413
- package/dist/module/wallet/Bcmr.js.map +0 -1
- package/dist/module/wallet/bcmr-v2.schema.d.ts +0 -833
- package/dist/module/wallet/bcmr-v2.schema.d.ts.map +0 -1
- package/dist/module/wallet/bcmr-v2.schema.js +0 -2
- package/dist/module/wallet/bcmr-v2.schema.js.map +0 -1
- package/src/util/walletConnect.test.ts +0 -115
- package/src/util/walletConnect.ts +0 -156
- package/src/wallet/Bcmr.test.headless.js +0 -467
- package/src/wallet/Bcmr.test.ts +0 -979
- package/src/wallet/Bcmr.ts +0 -556
- package/src/wallet/bcmr-v2.schema.ts +0 -893
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bcmr-v2.schema.d.ts","sourceRoot":"","sources":["../../../src/wallet/bcmr-v2.schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG;IACjB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,mBAAmB,EAAE,MAAM,GACxB,MAAM,GACN;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GACzB;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG;YAAE,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CACpD,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,GAAG,GAAG;IAChB;;;;;;;;;;OAUG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,UAAU,C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zB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bcmr-v2.schema.js","sourceRoot":"","sources":["../../../src/wallet/bcmr-v2.schema.ts"],"names":[],"mappings":""}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { binToHex } from "@bitauth/libauth";
|
|
2
|
-
import { RegTestWallet } from "../wallet/Wif";
|
|
3
|
-
import { generateWcSignTransactionRequest, WcSigner } from "./walletConnect";
|
|
4
|
-
import { WcSignTransactionRequest } from "@bch-wc2/interfaces";
|
|
5
|
-
import {
|
|
6
|
-
PrivKeyConnector,
|
|
7
|
-
signWcTransaction,
|
|
8
|
-
} from "@bch-wc2/privkey-connector";
|
|
9
|
-
import { NetworkProvider } from "../network";
|
|
10
|
-
|
|
11
|
-
export const processWcSignTransactionRequest = async (
|
|
12
|
-
wcTransactionRequest: WcSignTransactionRequest,
|
|
13
|
-
signingInfo: {
|
|
14
|
-
privateKey: Uint8Array;
|
|
15
|
-
pubkeyCompressed?: Uint8Array;
|
|
16
|
-
walletLockingBytecodeHex?: string;
|
|
17
|
-
},
|
|
18
|
-
networkProvider?: NetworkProvider
|
|
19
|
-
): Promise<string> => {
|
|
20
|
-
const signedTransaction = signWcTransaction(
|
|
21
|
-
wcTransactionRequest,
|
|
22
|
-
signingInfo
|
|
23
|
-
);
|
|
24
|
-
const hexSignedTransaction = binToHex(signedTransaction);
|
|
25
|
-
|
|
26
|
-
if (wcTransactionRequest.broadcast) {
|
|
27
|
-
if (!networkProvider) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
"NetworkProvider is required for broadcasting transactions"
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
await networkProvider.sendRawTransaction(hexSignedTransaction);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return hexSignedTransaction;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
describe("Wallet Connect Utility Functions", () => {
|
|
40
|
-
it("should generate a valid WcSignTransactionRequest object and sign it", async () => {
|
|
41
|
-
const wallet = await RegTestWallet.fromId(process.env.ALICE_ID!);
|
|
42
|
-
|
|
43
|
-
const bob = await RegTestWallet.newRandom();
|
|
44
|
-
|
|
45
|
-
const sendResponse = await wallet.send(
|
|
46
|
-
{
|
|
47
|
-
cashaddr: bob.cashaddr,
|
|
48
|
-
value: 5000,
|
|
49
|
-
unit: "satoshi",
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
buildUnsigned: true,
|
|
53
|
-
queryBalance: false,
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const request = generateWcSignTransactionRequest(sendResponse, {
|
|
58
|
-
broadcast: true,
|
|
59
|
-
userPrompt: "Confirm transaction",
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
await expect(
|
|
63
|
-
processWcSignTransactionRequest(
|
|
64
|
-
request,
|
|
65
|
-
{
|
|
66
|
-
privateKey: wallet.privateKey,
|
|
67
|
-
pubkeyCompressed: wallet.publicKeyCompressed,
|
|
68
|
-
},
|
|
69
|
-
undefined
|
|
70
|
-
)
|
|
71
|
-
).rejects.toThrow(
|
|
72
|
-
"NetworkProvider is required for broadcasting transactions"
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
await processWcSignTransactionRequest(
|
|
76
|
-
request,
|
|
77
|
-
{
|
|
78
|
-
privateKey: wallet.privateKey,
|
|
79
|
-
pubkeyCompressed: wallet.publicKeyCompressed,
|
|
80
|
-
},
|
|
81
|
-
wallet.provider
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
expect(await bob.getBalance("sat")).toBe(5000);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it("should sign a transaction with WcSigner", async () => {
|
|
88
|
-
const wallet = await RegTestWallet.fromId(process.env.ALICE_ID!);
|
|
89
|
-
const bob = await RegTestWallet.newRandom();
|
|
90
|
-
|
|
91
|
-
const connector = new PrivKeyConnector({
|
|
92
|
-
privateKey: wallet.privateKey,
|
|
93
|
-
pubkeyCompressed: wallet.publicKeyCompressed,
|
|
94
|
-
networkProvider: wallet.provider,
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
const wcSigner = new WcSigner(wallet, connector);
|
|
98
|
-
|
|
99
|
-
const sendResponse = await wcSigner.send(
|
|
100
|
-
{
|
|
101
|
-
cashaddr: bob.cashaddr,
|
|
102
|
-
value: 5000,
|
|
103
|
-
unit: "satoshi",
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
userPrompt: "Confirm transaction",
|
|
107
|
-
broadcast: true,
|
|
108
|
-
}
|
|
109
|
-
);
|
|
110
|
-
|
|
111
|
-
expect(sendResponse.signedTransaction).toBeDefined();
|
|
112
|
-
|
|
113
|
-
expect(await bob.getBalance("sat")).toBe(5000);
|
|
114
|
-
});
|
|
115
|
-
});
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IConnector,
|
|
3
|
-
WcSignTransactionRequest,
|
|
4
|
-
WcSignTransactionResponse,
|
|
5
|
-
} from "@bch-wc2/interfaces";
|
|
6
|
-
import { BaseWallet } from "../wallet/Base.js";
|
|
7
|
-
import { SendRequestOptionsI } from "../wallet/interface.js";
|
|
8
|
-
import {
|
|
9
|
-
OpReturnData,
|
|
10
|
-
SendRequest,
|
|
11
|
-
SendRequestArray,
|
|
12
|
-
SendRequestType,
|
|
13
|
-
SendResponse,
|
|
14
|
-
TokenBurnRequest,
|
|
15
|
-
TokenGenesisRequest,
|
|
16
|
-
TokenMintRequest,
|
|
17
|
-
TokenSendRequest,
|
|
18
|
-
} from "../wallet/model.js";
|
|
19
|
-
|
|
20
|
-
export interface WcTransactionOptions {
|
|
21
|
-
broadcast?: boolean;
|
|
22
|
-
userPrompt?: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const generateWcSignTransactionRequest = (
|
|
26
|
-
sendResponse: SendResponse,
|
|
27
|
-
options?: WcTransactionOptions
|
|
28
|
-
): WcSignTransactionRequest => {
|
|
29
|
-
if (!sendResponse.unsignedTransaction || !sendResponse.sourceOutputs) {
|
|
30
|
-
throw new Error(
|
|
31
|
-
"SendResponse does not contain an unsigned transaction or source outputs"
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
...options,
|
|
37
|
-
transaction: sendResponse.unsignedTransaction,
|
|
38
|
-
sourceOutputs: sendResponse.sourceOutputs,
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export type WcSendResponse = SendResponse & WcSignTransactionResponse;
|
|
43
|
-
|
|
44
|
-
// A wrapper class for signing transactions with WalletConnect
|
|
45
|
-
// Interfaces are the same as the original wallet methods
|
|
46
|
-
// Meant to be a drop-in replacement for the original wallet methods
|
|
47
|
-
export class WcSigner {
|
|
48
|
-
public wallet!: BaseWallet;
|
|
49
|
-
public connector: IConnector;
|
|
50
|
-
|
|
51
|
-
constructor(wallet: BaseWallet, connector: IConnector) {
|
|
52
|
-
if (!wallet || !connector) {
|
|
53
|
-
throw new Error("Invalid wallet or connector");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
this.wallet = wallet;
|
|
57
|
-
this.connector = connector;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
private async handleTransaction(
|
|
61
|
-
walletMethod: (...args: any[]) => Promise<SendResponse>,
|
|
62
|
-
walletArgs: any[],
|
|
63
|
-
options?: SendRequestOptionsI & WcTransactionOptions,
|
|
64
|
-
errorMsg: string = "Failed to sign transaction, user may have rejected the request"
|
|
65
|
-
): Promise<WcSendResponse> {
|
|
66
|
-
const response = await walletMethod.apply(this.wallet, [
|
|
67
|
-
...walletArgs,
|
|
68
|
-
{ queryBalance: false, ...options, buildUnsigned: true },
|
|
69
|
-
]);
|
|
70
|
-
|
|
71
|
-
const signRequest = generateWcSignTransactionRequest(response, {
|
|
72
|
-
// ask to broadcast the transaction by default
|
|
73
|
-
broadcast: true,
|
|
74
|
-
...options,
|
|
75
|
-
});
|
|
76
|
-
const signResponse = await this.connector.signTransaction(signRequest);
|
|
77
|
-
|
|
78
|
-
if (!signResponse) {
|
|
79
|
-
throw new Error(errorMsg);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
...response,
|
|
84
|
-
...signResponse,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
async send(
|
|
89
|
-
requests:
|
|
90
|
-
| SendRequest
|
|
91
|
-
| TokenSendRequest
|
|
92
|
-
| OpReturnData
|
|
93
|
-
| Array<SendRequest | TokenSendRequest | OpReturnData>
|
|
94
|
-
| SendRequestArray[],
|
|
95
|
-
options?: SendRequestOptionsI & WcTransactionOptions
|
|
96
|
-
): Promise<WcSendResponse> {
|
|
97
|
-
return this.handleTransaction(
|
|
98
|
-
this.wallet.send,
|
|
99
|
-
[requests],
|
|
100
|
-
options,
|
|
101
|
-
"Failed to sign send transaction, user may have rejected the request"
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
public async sendMax(
|
|
106
|
-
cashaddr: string,
|
|
107
|
-
options?: SendRequestOptionsI & WcTransactionOptions
|
|
108
|
-
): Promise<WcSendResponse> {
|
|
109
|
-
return this.handleTransaction(
|
|
110
|
-
this.wallet.sendMax,
|
|
111
|
-
[cashaddr],
|
|
112
|
-
options,
|
|
113
|
-
"Failed to sign send max transaction, user may have rejected the request"
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
async tokenGenesis(
|
|
118
|
-
genesisRequest: TokenGenesisRequest,
|
|
119
|
-
sendRequests: SendRequestType | SendRequestType[] = [],
|
|
120
|
-
options?: SendRequestOptionsI & WcTransactionOptions
|
|
121
|
-
): Promise<WcSendResponse> {
|
|
122
|
-
return this.handleTransaction(
|
|
123
|
-
this.wallet.tokenGenesis,
|
|
124
|
-
[genesisRequest, sendRequests],
|
|
125
|
-
options,
|
|
126
|
-
"Failed to sign token genesis transaction, user may have rejected the request"
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
public async tokenMint(
|
|
131
|
-
tokenId: string,
|
|
132
|
-
mintRequests: TokenMintRequest | Array<TokenMintRequest>,
|
|
133
|
-
deductTokenAmount: boolean = false,
|
|
134
|
-
options?: SendRequestOptionsI & WcTransactionOptions
|
|
135
|
-
): Promise<WcSendResponse> {
|
|
136
|
-
return this.handleTransaction(
|
|
137
|
-
this.wallet.tokenMint,
|
|
138
|
-
[tokenId, mintRequests, deductTokenAmount],
|
|
139
|
-
options,
|
|
140
|
-
"Failed to sign token mint transaction, user may have rejected the request"
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
public async tokenBurn(
|
|
145
|
-
burnRequest: TokenBurnRequest,
|
|
146
|
-
message?: string,
|
|
147
|
-
options?: SendRequestOptionsI & WcTransactionOptions
|
|
148
|
-
): Promise<WcSendResponse> {
|
|
149
|
-
return this.handleTransaction(
|
|
150
|
-
this.wallet.tokenBurn,
|
|
151
|
-
[burnRequest, message],
|
|
152
|
-
options,
|
|
153
|
-
"Failed to sign token burn transaction, user may have rejected the request"
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
}
|