@tomo-inc/inject-providers 0.0.6 → 0.0.7
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.cjs +102 -39
- package/dist/index.d.cts +32 -14
- package/dist/index.d.ts +32 -14
- package/dist/index.js +102 -39
- package/package.json +2 -2
- package/src/dogecoin/dogecoin.ts +131 -48
package/dist/index.cjs
CHANGED
|
@@ -515,12 +515,6 @@ var DogecoinProvider = class extends events.EventEmitter {
|
|
|
515
515
|
params: {}
|
|
516
516
|
});
|
|
517
517
|
};
|
|
518
|
-
//res = { address, balance }
|
|
519
|
-
this.getBalance = async () => {
|
|
520
|
-
return this._request({
|
|
521
|
-
method: "getBalance"
|
|
522
|
-
});
|
|
523
|
-
};
|
|
524
518
|
//res = { disconnected }
|
|
525
519
|
this.disconnect = async () => {
|
|
526
520
|
return this._request({
|
|
@@ -528,22 +522,26 @@ var DogecoinProvider = class extends events.EventEmitter {
|
|
|
528
522
|
params: {}
|
|
529
523
|
});
|
|
530
524
|
};
|
|
531
|
-
//
|
|
532
|
-
this.
|
|
525
|
+
//unisat public methods
|
|
526
|
+
this.requestAccounts = async () => {
|
|
533
527
|
return this._request({
|
|
534
|
-
method: "
|
|
535
|
-
params: {}
|
|
528
|
+
method: "requestAccounts"
|
|
536
529
|
});
|
|
537
530
|
};
|
|
538
|
-
|
|
539
|
-
this.requestTransaction = async ({ recipientAddress, dogeAmount }) => {
|
|
531
|
+
this.getAccounts = async () => {
|
|
540
532
|
return this._request({
|
|
541
|
-
method: "
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
533
|
+
method: "getAccounts"
|
|
534
|
+
});
|
|
535
|
+
};
|
|
536
|
+
this.getPublicKey = async () => {
|
|
537
|
+
return this._request({
|
|
538
|
+
method: "getPublicKey"
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
//res = { address, balance }
|
|
542
|
+
this.getBalance = async () => {
|
|
543
|
+
return this._request({
|
|
544
|
+
method: "getBalance"
|
|
547
545
|
});
|
|
548
546
|
};
|
|
549
547
|
//res = {status === 'confirmed', confirmations > 1}
|
|
@@ -563,6 +561,13 @@ var DogecoinProvider = class extends events.EventEmitter {
|
|
|
563
561
|
}
|
|
564
562
|
});
|
|
565
563
|
};
|
|
564
|
+
this.signMessage = async (message, type) => {
|
|
565
|
+
const { signedMessage } = await this.requestSignedMessage({
|
|
566
|
+
message,
|
|
567
|
+
type
|
|
568
|
+
});
|
|
569
|
+
return signedMessage;
|
|
570
|
+
};
|
|
566
571
|
//res = { decryptedMessage }
|
|
567
572
|
this.requestDecryptedMessage = async ({ message }) => {
|
|
568
573
|
return this._request({
|
|
@@ -572,6 +577,85 @@ var DogecoinProvider = class extends events.EventEmitter {
|
|
|
572
577
|
}
|
|
573
578
|
});
|
|
574
579
|
};
|
|
580
|
+
//res = { ?signedRawTx, ?txId }
|
|
581
|
+
this.requestPsbt = async ({
|
|
582
|
+
rawTx,
|
|
583
|
+
indexes,
|
|
584
|
+
feeOnly,
|
|
585
|
+
signOnly,
|
|
586
|
+
partial,
|
|
587
|
+
sighashType
|
|
588
|
+
}) => {
|
|
589
|
+
return this._request({
|
|
590
|
+
method: "requestPsbt",
|
|
591
|
+
params: {
|
|
592
|
+
rawTx,
|
|
593
|
+
indexes,
|
|
594
|
+
feeOnly,
|
|
595
|
+
signOnly,
|
|
596
|
+
partial,
|
|
597
|
+
sighashType
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
};
|
|
601
|
+
this.signPsbt = async (psbtHex, options) => {
|
|
602
|
+
return this._request({
|
|
603
|
+
method: "signPsbt",
|
|
604
|
+
params: {
|
|
605
|
+
psbtHex,
|
|
606
|
+
options: {
|
|
607
|
+
autoFinalized: options == null ? void 0 : options.autoFinalized
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
this.signPsbts = async (psbtHexs, options) => {
|
|
613
|
+
return this._request({
|
|
614
|
+
method: "signPsbts",
|
|
615
|
+
params: {
|
|
616
|
+
psbtHexs,
|
|
617
|
+
options
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
};
|
|
621
|
+
//res = { txId }
|
|
622
|
+
this.requestTransaction = async ({ recipientAddress, dogeAmount }) => {
|
|
623
|
+
return this._request({
|
|
624
|
+
method: "requestTransaction",
|
|
625
|
+
params: {
|
|
626
|
+
to: recipientAddress,
|
|
627
|
+
amount: dogeAmount,
|
|
628
|
+
type: 3 /* SEND_DOGECOIN */
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
};
|
|
632
|
+
this.send = async (toAddress, satoshis, options) => {
|
|
633
|
+
return this._request({
|
|
634
|
+
method: "send",
|
|
635
|
+
params: {
|
|
636
|
+
to: toAddress,
|
|
637
|
+
amount: satoshis,
|
|
638
|
+
options
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
};
|
|
642
|
+
this.sendDogecoin = async (toAddress, satoshis, options) => {
|
|
643
|
+
return this._request({
|
|
644
|
+
method: "sendDogecoin",
|
|
645
|
+
params: {
|
|
646
|
+
to: toAddress,
|
|
647
|
+
amount: satoshis,
|
|
648
|
+
options
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
};
|
|
652
|
+
//res = { "connected, address, selectedWalletAddress }
|
|
653
|
+
this.getConnectionStatus = async () => {
|
|
654
|
+
return this._request({
|
|
655
|
+
method: "getConnectionStatus",
|
|
656
|
+
params: {}
|
|
657
|
+
});
|
|
658
|
+
};
|
|
575
659
|
//res = { signedMessage }
|
|
576
660
|
this.getDRC20Balances = async (address, ticker) => {
|
|
577
661
|
return this._request({
|
|
@@ -623,27 +707,6 @@ var DogecoinProvider = class extends events.EventEmitter {
|
|
|
623
707
|
}
|
|
624
708
|
});
|
|
625
709
|
};
|
|
626
|
-
//res = { ?signedRawTx, ?txId }
|
|
627
|
-
this.requestPsbt = async ({
|
|
628
|
-
rawTx,
|
|
629
|
-
indexes,
|
|
630
|
-
feeOnly,
|
|
631
|
-
signOnly,
|
|
632
|
-
partial,
|
|
633
|
-
sighashType
|
|
634
|
-
}) => {
|
|
635
|
-
return this._request({
|
|
636
|
-
method: "requestPsbt",
|
|
637
|
-
params: {
|
|
638
|
-
rawTx,
|
|
639
|
-
indexes,
|
|
640
|
-
feeOnly,
|
|
641
|
-
signOnly,
|
|
642
|
-
partial,
|
|
643
|
-
sighashType
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
|
-
};
|
|
647
710
|
//---------//dunes
|
|
648
711
|
this.getDunesBalance = async (params) => {
|
|
649
712
|
return this._request({
|
package/dist/index.d.cts
CHANGED
|
@@ -119,13 +119,15 @@ declare class DogecoinProvider extends EventEmitter {
|
|
|
119
119
|
params: any;
|
|
120
120
|
}) => Promise<any>;
|
|
121
121
|
connect: () => Promise<any>;
|
|
122
|
-
getBalance: () => Promise<any>;
|
|
123
122
|
disconnect: () => Promise<any>;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
requestAccounts: () => Promise<string[]>;
|
|
124
|
+
getAccounts: () => Promise<string[]>;
|
|
125
|
+
getPublicKey: () => Promise<string>;
|
|
126
|
+
getBalance: () => Promise<{
|
|
127
|
+
confirmed: number;
|
|
128
|
+
unconfirmed: number;
|
|
129
|
+
total: number;
|
|
130
|
+
}>;
|
|
129
131
|
getTransactionStatus: ({ txId }: {
|
|
130
132
|
txId: string;
|
|
131
133
|
}) => Promise<any>;
|
|
@@ -133,9 +135,33 @@ declare class DogecoinProvider extends EventEmitter {
|
|
|
133
135
|
message: string;
|
|
134
136
|
type?: string;
|
|
135
137
|
}) => Promise<any>;
|
|
138
|
+
signMessage: (message: string, type?: string) => Promise<string>;
|
|
136
139
|
requestDecryptedMessage: ({ message }: {
|
|
137
140
|
message: string;
|
|
138
141
|
}) => Promise<any>;
|
|
142
|
+
requestPsbt: ({ rawTx, indexes, feeOnly, signOnly, partial, sighashType, }: {
|
|
143
|
+
rawTx: string;
|
|
144
|
+
indexes?: [];
|
|
145
|
+
feeOnly?: boolean;
|
|
146
|
+
signOnly?: boolean;
|
|
147
|
+
partial?: boolean;
|
|
148
|
+
sighashType?: string;
|
|
149
|
+
}) => Promise<any>;
|
|
150
|
+
signPsbt: (psbtHex: string, options?: any) => Promise<string>;
|
|
151
|
+
signPsbts: (psbtHexs: string[], options?: any) => Promise<any>;
|
|
152
|
+
requestTransaction: ({ recipientAddress, dogeAmount }: {
|
|
153
|
+
recipientAddress: string;
|
|
154
|
+
dogeAmount: number;
|
|
155
|
+
}) => Promise<any>;
|
|
156
|
+
send: (toAddress: string, satoshis?: number, options?: {
|
|
157
|
+
feeRate: number;
|
|
158
|
+
memo?: string;
|
|
159
|
+
}) => Promise<string>;
|
|
160
|
+
sendDogecoin: (toAddress: string, satoshis?: number, options?: {
|
|
161
|
+
feeRate: number;
|
|
162
|
+
memo?: string;
|
|
163
|
+
}) => Promise<string>;
|
|
164
|
+
getConnectionStatus: () => Promise<any>;
|
|
139
165
|
getDRC20Balances: (address: string, ticker?: string) => Promise<any>;
|
|
140
166
|
getDRC20Balance: ({ ticker }: {
|
|
141
167
|
ticker?: string;
|
|
@@ -151,14 +177,6 @@ declare class DogecoinProvider extends EventEmitter {
|
|
|
151
177
|
location: string;
|
|
152
178
|
recipientAddress: string;
|
|
153
179
|
}) => Promise<any>;
|
|
154
|
-
requestPsbt: ({ rawTx, indexes, feeOnly, signOnly, partial, sighashType, }: {
|
|
155
|
-
rawTx: string;
|
|
156
|
-
indexes?: [];
|
|
157
|
-
feeOnly?: boolean;
|
|
158
|
-
signOnly?: boolean;
|
|
159
|
-
partial?: boolean;
|
|
160
|
-
sighashType?: string;
|
|
161
|
-
}) => Promise<any>;
|
|
162
180
|
getDunesBalance: (params: {
|
|
163
181
|
ticker: string;
|
|
164
182
|
}) => Promise<any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -119,13 +119,15 @@ declare class DogecoinProvider extends EventEmitter {
|
|
|
119
119
|
params: any;
|
|
120
120
|
}) => Promise<any>;
|
|
121
121
|
connect: () => Promise<any>;
|
|
122
|
-
getBalance: () => Promise<any>;
|
|
123
122
|
disconnect: () => Promise<any>;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
requestAccounts: () => Promise<string[]>;
|
|
124
|
+
getAccounts: () => Promise<string[]>;
|
|
125
|
+
getPublicKey: () => Promise<string>;
|
|
126
|
+
getBalance: () => Promise<{
|
|
127
|
+
confirmed: number;
|
|
128
|
+
unconfirmed: number;
|
|
129
|
+
total: number;
|
|
130
|
+
}>;
|
|
129
131
|
getTransactionStatus: ({ txId }: {
|
|
130
132
|
txId: string;
|
|
131
133
|
}) => Promise<any>;
|
|
@@ -133,9 +135,33 @@ declare class DogecoinProvider extends EventEmitter {
|
|
|
133
135
|
message: string;
|
|
134
136
|
type?: string;
|
|
135
137
|
}) => Promise<any>;
|
|
138
|
+
signMessage: (message: string, type?: string) => Promise<string>;
|
|
136
139
|
requestDecryptedMessage: ({ message }: {
|
|
137
140
|
message: string;
|
|
138
141
|
}) => Promise<any>;
|
|
142
|
+
requestPsbt: ({ rawTx, indexes, feeOnly, signOnly, partial, sighashType, }: {
|
|
143
|
+
rawTx: string;
|
|
144
|
+
indexes?: [];
|
|
145
|
+
feeOnly?: boolean;
|
|
146
|
+
signOnly?: boolean;
|
|
147
|
+
partial?: boolean;
|
|
148
|
+
sighashType?: string;
|
|
149
|
+
}) => Promise<any>;
|
|
150
|
+
signPsbt: (psbtHex: string, options?: any) => Promise<string>;
|
|
151
|
+
signPsbts: (psbtHexs: string[], options?: any) => Promise<any>;
|
|
152
|
+
requestTransaction: ({ recipientAddress, dogeAmount }: {
|
|
153
|
+
recipientAddress: string;
|
|
154
|
+
dogeAmount: number;
|
|
155
|
+
}) => Promise<any>;
|
|
156
|
+
send: (toAddress: string, satoshis?: number, options?: {
|
|
157
|
+
feeRate: number;
|
|
158
|
+
memo?: string;
|
|
159
|
+
}) => Promise<string>;
|
|
160
|
+
sendDogecoin: (toAddress: string, satoshis?: number, options?: {
|
|
161
|
+
feeRate: number;
|
|
162
|
+
memo?: string;
|
|
163
|
+
}) => Promise<string>;
|
|
164
|
+
getConnectionStatus: () => Promise<any>;
|
|
139
165
|
getDRC20Balances: (address: string, ticker?: string) => Promise<any>;
|
|
140
166
|
getDRC20Balance: ({ ticker }: {
|
|
141
167
|
ticker?: string;
|
|
@@ -151,14 +177,6 @@ declare class DogecoinProvider extends EventEmitter {
|
|
|
151
177
|
location: string;
|
|
152
178
|
recipientAddress: string;
|
|
153
179
|
}) => Promise<any>;
|
|
154
|
-
requestPsbt: ({ rawTx, indexes, feeOnly, signOnly, partial, sighashType, }: {
|
|
155
|
-
rawTx: string;
|
|
156
|
-
indexes?: [];
|
|
157
|
-
feeOnly?: boolean;
|
|
158
|
-
signOnly?: boolean;
|
|
159
|
-
partial?: boolean;
|
|
160
|
-
sighashType?: string;
|
|
161
|
-
}) => Promise<any>;
|
|
162
180
|
getDunesBalance: (params: {
|
|
163
181
|
ticker: string;
|
|
164
182
|
}) => Promise<any>;
|
package/dist/index.js
CHANGED
|
@@ -509,12 +509,6 @@ var DogecoinProvider = class extends EventEmitter {
|
|
|
509
509
|
params: {}
|
|
510
510
|
});
|
|
511
511
|
};
|
|
512
|
-
//res = { address, balance }
|
|
513
|
-
this.getBalance = async () => {
|
|
514
|
-
return this._request({
|
|
515
|
-
method: "getBalance"
|
|
516
|
-
});
|
|
517
|
-
};
|
|
518
512
|
//res = { disconnected }
|
|
519
513
|
this.disconnect = async () => {
|
|
520
514
|
return this._request({
|
|
@@ -522,22 +516,26 @@ var DogecoinProvider = class extends EventEmitter {
|
|
|
522
516
|
params: {}
|
|
523
517
|
});
|
|
524
518
|
};
|
|
525
|
-
//
|
|
526
|
-
this.
|
|
519
|
+
//unisat public methods
|
|
520
|
+
this.requestAccounts = async () => {
|
|
527
521
|
return this._request({
|
|
528
|
-
method: "
|
|
529
|
-
params: {}
|
|
522
|
+
method: "requestAccounts"
|
|
530
523
|
});
|
|
531
524
|
};
|
|
532
|
-
|
|
533
|
-
this.requestTransaction = async ({ recipientAddress, dogeAmount }) => {
|
|
525
|
+
this.getAccounts = async () => {
|
|
534
526
|
return this._request({
|
|
535
|
-
method: "
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
527
|
+
method: "getAccounts"
|
|
528
|
+
});
|
|
529
|
+
};
|
|
530
|
+
this.getPublicKey = async () => {
|
|
531
|
+
return this._request({
|
|
532
|
+
method: "getPublicKey"
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
//res = { address, balance }
|
|
536
|
+
this.getBalance = async () => {
|
|
537
|
+
return this._request({
|
|
538
|
+
method: "getBalance"
|
|
541
539
|
});
|
|
542
540
|
};
|
|
543
541
|
//res = {status === 'confirmed', confirmations > 1}
|
|
@@ -557,6 +555,13 @@ var DogecoinProvider = class extends EventEmitter {
|
|
|
557
555
|
}
|
|
558
556
|
});
|
|
559
557
|
};
|
|
558
|
+
this.signMessage = async (message, type) => {
|
|
559
|
+
const { signedMessage } = await this.requestSignedMessage({
|
|
560
|
+
message,
|
|
561
|
+
type
|
|
562
|
+
});
|
|
563
|
+
return signedMessage;
|
|
564
|
+
};
|
|
560
565
|
//res = { decryptedMessage }
|
|
561
566
|
this.requestDecryptedMessage = async ({ message }) => {
|
|
562
567
|
return this._request({
|
|
@@ -566,6 +571,85 @@ var DogecoinProvider = class extends EventEmitter {
|
|
|
566
571
|
}
|
|
567
572
|
});
|
|
568
573
|
};
|
|
574
|
+
//res = { ?signedRawTx, ?txId }
|
|
575
|
+
this.requestPsbt = async ({
|
|
576
|
+
rawTx,
|
|
577
|
+
indexes,
|
|
578
|
+
feeOnly,
|
|
579
|
+
signOnly,
|
|
580
|
+
partial,
|
|
581
|
+
sighashType
|
|
582
|
+
}) => {
|
|
583
|
+
return this._request({
|
|
584
|
+
method: "requestPsbt",
|
|
585
|
+
params: {
|
|
586
|
+
rawTx,
|
|
587
|
+
indexes,
|
|
588
|
+
feeOnly,
|
|
589
|
+
signOnly,
|
|
590
|
+
partial,
|
|
591
|
+
sighashType
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
};
|
|
595
|
+
this.signPsbt = async (psbtHex, options) => {
|
|
596
|
+
return this._request({
|
|
597
|
+
method: "signPsbt",
|
|
598
|
+
params: {
|
|
599
|
+
psbtHex,
|
|
600
|
+
options: {
|
|
601
|
+
autoFinalized: options == null ? void 0 : options.autoFinalized
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
};
|
|
606
|
+
this.signPsbts = async (psbtHexs, options) => {
|
|
607
|
+
return this._request({
|
|
608
|
+
method: "signPsbts",
|
|
609
|
+
params: {
|
|
610
|
+
psbtHexs,
|
|
611
|
+
options
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
};
|
|
615
|
+
//res = { txId }
|
|
616
|
+
this.requestTransaction = async ({ recipientAddress, dogeAmount }) => {
|
|
617
|
+
return this._request({
|
|
618
|
+
method: "requestTransaction",
|
|
619
|
+
params: {
|
|
620
|
+
to: recipientAddress,
|
|
621
|
+
amount: dogeAmount,
|
|
622
|
+
type: 3 /* SEND_DOGECOIN */
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
};
|
|
626
|
+
this.send = async (toAddress, satoshis, options) => {
|
|
627
|
+
return this._request({
|
|
628
|
+
method: "send",
|
|
629
|
+
params: {
|
|
630
|
+
to: toAddress,
|
|
631
|
+
amount: satoshis,
|
|
632
|
+
options
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
};
|
|
636
|
+
this.sendDogecoin = async (toAddress, satoshis, options) => {
|
|
637
|
+
return this._request({
|
|
638
|
+
method: "sendDogecoin",
|
|
639
|
+
params: {
|
|
640
|
+
to: toAddress,
|
|
641
|
+
amount: satoshis,
|
|
642
|
+
options
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
};
|
|
646
|
+
//res = { "connected, address, selectedWalletAddress }
|
|
647
|
+
this.getConnectionStatus = async () => {
|
|
648
|
+
return this._request({
|
|
649
|
+
method: "getConnectionStatus",
|
|
650
|
+
params: {}
|
|
651
|
+
});
|
|
652
|
+
};
|
|
569
653
|
//res = { signedMessage }
|
|
570
654
|
this.getDRC20Balances = async (address, ticker) => {
|
|
571
655
|
return this._request({
|
|
@@ -617,27 +701,6 @@ var DogecoinProvider = class extends EventEmitter {
|
|
|
617
701
|
}
|
|
618
702
|
});
|
|
619
703
|
};
|
|
620
|
-
//res = { ?signedRawTx, ?txId }
|
|
621
|
-
this.requestPsbt = async ({
|
|
622
|
-
rawTx,
|
|
623
|
-
indexes,
|
|
624
|
-
feeOnly,
|
|
625
|
-
signOnly,
|
|
626
|
-
partial,
|
|
627
|
-
sighashType
|
|
628
|
-
}) => {
|
|
629
|
-
return this._request({
|
|
630
|
-
method: "requestPsbt",
|
|
631
|
-
params: {
|
|
632
|
-
rawTx,
|
|
633
|
-
indexes,
|
|
634
|
-
feeOnly,
|
|
635
|
-
signOnly,
|
|
636
|
-
partial,
|
|
637
|
-
sighashType
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
};
|
|
641
704
|
//---------//dunes
|
|
642
705
|
this.getDunesBalance = async (params) => {
|
|
643
706
|
return this._request({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomo-inc/inject-providers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"author": "tomo.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"json-rpc-middleware-stream": "^3.0.0",
|
|
26
26
|
"tronweb": "^6.0.3",
|
|
27
27
|
"viem": "^2.38.3",
|
|
28
|
-
"@tomo-inc/wallet-utils": "0.0.
|
|
28
|
+
"@tomo-inc/wallet-utils": "0.0.9"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^20.0.0",
|
package/src/dogecoin/dogecoin.ts
CHANGED
|
@@ -123,13 +123,6 @@ export class DogecoinProvider extends EventEmitter {
|
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
125
|
|
|
126
|
-
//res = { address, balance }
|
|
127
|
-
getBalance = async () => {
|
|
128
|
-
return this._request({
|
|
129
|
-
method: "getBalance",
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
|
|
133
126
|
//res = { disconnected }
|
|
134
127
|
disconnect = async () => {
|
|
135
128
|
return this._request({
|
|
@@ -138,23 +131,33 @@ export class DogecoinProvider extends EventEmitter {
|
|
|
138
131
|
});
|
|
139
132
|
};
|
|
140
133
|
|
|
141
|
-
//
|
|
142
|
-
|
|
134
|
+
//unisat public methods
|
|
135
|
+
requestAccounts = async (): Promise<string[]> => {
|
|
143
136
|
return this._request({
|
|
144
|
-
method: "
|
|
145
|
-
params: {},
|
|
137
|
+
method: "requestAccounts",
|
|
146
138
|
});
|
|
147
139
|
};
|
|
148
140
|
|
|
149
|
-
|
|
150
|
-
requestTransaction = async ({ recipientAddress, dogeAmount }: { recipientAddress: string; dogeAmount: number }) => {
|
|
141
|
+
getAccounts = async (): Promise<string[]> => {
|
|
151
142
|
return this._request({
|
|
152
|
-
method: "
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
143
|
+
method: "getAccounts",
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
getPublicKey = async (): Promise<string> => {
|
|
148
|
+
return this._request({
|
|
149
|
+
method: "getPublicKey",
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
//res = { address, balance }
|
|
154
|
+
getBalance = async (): Promise<{
|
|
155
|
+
confirmed: number;
|
|
156
|
+
unconfirmed: number;
|
|
157
|
+
total: number;
|
|
158
|
+
}> => {
|
|
159
|
+
return this._request({
|
|
160
|
+
method: "getBalance",
|
|
158
161
|
});
|
|
159
162
|
};
|
|
160
163
|
|
|
@@ -177,6 +180,14 @@ export class DogecoinProvider extends EventEmitter {
|
|
|
177
180
|
});
|
|
178
181
|
};
|
|
179
182
|
|
|
183
|
+
signMessage = async (message: string, type?: string): Promise<string> => {
|
|
184
|
+
const { signedMessage } = await this.requestSignedMessage({
|
|
185
|
+
message,
|
|
186
|
+
type,
|
|
187
|
+
});
|
|
188
|
+
return signedMessage;
|
|
189
|
+
};
|
|
190
|
+
|
|
180
191
|
//res = { decryptedMessage }
|
|
181
192
|
requestDecryptedMessage = async ({ message }: { message: string }) => {
|
|
182
193
|
return this._request({
|
|
@@ -187,6 +198,107 @@ export class DogecoinProvider extends EventEmitter {
|
|
|
187
198
|
});
|
|
188
199
|
};
|
|
189
200
|
|
|
201
|
+
//res = { ?signedRawTx, ?txId }
|
|
202
|
+
requestPsbt = async ({
|
|
203
|
+
rawTx,
|
|
204
|
+
indexes,
|
|
205
|
+
feeOnly,
|
|
206
|
+
signOnly,
|
|
207
|
+
partial,
|
|
208
|
+
sighashType,
|
|
209
|
+
}: {
|
|
210
|
+
rawTx: string;
|
|
211
|
+
indexes?: [];
|
|
212
|
+
feeOnly?: boolean;
|
|
213
|
+
signOnly?: boolean;
|
|
214
|
+
partial?: boolean;
|
|
215
|
+
sighashType?: string;
|
|
216
|
+
}) => {
|
|
217
|
+
return this._request({
|
|
218
|
+
method: "requestPsbt",
|
|
219
|
+
params: {
|
|
220
|
+
rawTx,
|
|
221
|
+
indexes,
|
|
222
|
+
feeOnly,
|
|
223
|
+
signOnly,
|
|
224
|
+
partial,
|
|
225
|
+
sighashType,
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
signPsbt = async (psbtHex: string, options?: any): Promise<string> => {
|
|
231
|
+
return this._request({
|
|
232
|
+
method: "signPsbt",
|
|
233
|
+
params: {
|
|
234
|
+
psbtHex,
|
|
235
|
+
options: {
|
|
236
|
+
autoFinalized: options?.autoFinalized,
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
signPsbts = async (psbtHexs: string[], options?: any) => {
|
|
243
|
+
return this._request({
|
|
244
|
+
method: "signPsbts",
|
|
245
|
+
params: {
|
|
246
|
+
psbtHexs,
|
|
247
|
+
options,
|
|
248
|
+
},
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
//res = { txId }
|
|
253
|
+
requestTransaction = async ({ recipientAddress, dogeAmount }: { recipientAddress: string; dogeAmount: number }) => {
|
|
254
|
+
return this._request({
|
|
255
|
+
method: "requestTransaction",
|
|
256
|
+
params: {
|
|
257
|
+
to: recipientAddress,
|
|
258
|
+
amount: dogeAmount,
|
|
259
|
+
type: TxType.SEND_DOGECOIN,
|
|
260
|
+
},
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
send = async (
|
|
265
|
+
toAddress: string,
|
|
266
|
+
satoshis?: number,
|
|
267
|
+
options?: { feeRate: number; memo?: string },
|
|
268
|
+
): Promise<string> => {
|
|
269
|
+
return this._request({
|
|
270
|
+
method: "send",
|
|
271
|
+
params: {
|
|
272
|
+
to: toAddress,
|
|
273
|
+
amount: satoshis,
|
|
274
|
+
options,
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
sendDogecoin = async (
|
|
280
|
+
toAddress: string,
|
|
281
|
+
satoshis?: number,
|
|
282
|
+
options?: { feeRate: number; memo?: string },
|
|
283
|
+
): Promise<string> => {
|
|
284
|
+
return this._request({
|
|
285
|
+
method: "sendDogecoin",
|
|
286
|
+
params: {
|
|
287
|
+
to: toAddress,
|
|
288
|
+
amount: satoshis,
|
|
289
|
+
options,
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
//res = { "connected, address, selectedWalletAddress }
|
|
295
|
+
getConnectionStatus = async () => {
|
|
296
|
+
return this._request({
|
|
297
|
+
method: "getConnectionStatus",
|
|
298
|
+
params: {},
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
|
|
190
302
|
//res = { signedMessage }
|
|
191
303
|
getDRC20Balances = async (address: string, ticker?: string) => {
|
|
192
304
|
return this._request({
|
|
@@ -246,35 +358,6 @@ export class DogecoinProvider extends EventEmitter {
|
|
|
246
358
|
});
|
|
247
359
|
};
|
|
248
360
|
|
|
249
|
-
//res = { ?signedRawTx, ?txId }
|
|
250
|
-
requestPsbt = async ({
|
|
251
|
-
rawTx,
|
|
252
|
-
indexes,
|
|
253
|
-
feeOnly,
|
|
254
|
-
signOnly,
|
|
255
|
-
partial,
|
|
256
|
-
sighashType,
|
|
257
|
-
}: {
|
|
258
|
-
rawTx: string;
|
|
259
|
-
indexes?: [];
|
|
260
|
-
feeOnly?: boolean;
|
|
261
|
-
signOnly?: boolean;
|
|
262
|
-
partial?: boolean;
|
|
263
|
-
sighashType?: string;
|
|
264
|
-
}) => {
|
|
265
|
-
return this._request({
|
|
266
|
-
method: "requestPsbt",
|
|
267
|
-
params: {
|
|
268
|
-
rawTx,
|
|
269
|
-
indexes,
|
|
270
|
-
feeOnly,
|
|
271
|
-
signOnly,
|
|
272
|
-
partial,
|
|
273
|
-
sighashType,
|
|
274
|
-
},
|
|
275
|
-
});
|
|
276
|
-
};
|
|
277
|
-
|
|
278
361
|
//---------//dunes
|
|
279
362
|
getDunesBalance = async (params: { ticker: string }) => {
|
|
280
363
|
return this._request({
|