@dynamic-labs-sdk/bitcoin 0.3.0 → 0.5.0
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/addBitcoinExtension/addBitcoinExtension.d.ts +4 -2
- package/dist/addBitcoinExtension/addBitcoinExtension.d.ts.map +1 -1
- package/dist/{addBitcoinInjectedWalletsExtension-BKu16bkz.esm.js → addBitcoinInjectedWalletsExtension-BjijCDrr.esm.js} +3 -3
- package/dist/{addBitcoinInjectedWalletsExtension-BKu16bkz.esm.js.map → addBitcoinInjectedWalletsExtension-BjijCDrr.esm.js.map} +1 -1
- package/dist/{addBitcoinInjectedWalletsExtension-BK4quVzy.cjs.js → addBitcoinInjectedWalletsExtension-DNUJc7N7.cjs.js} +8 -2
- package/dist/{addBitcoinInjectedWalletsExtension-BK4quVzy.cjs.js.map → addBitcoinInjectedWalletsExtension-DNUJc7N7.cjs.js.map} +1 -1
- package/dist/errors/FeeRecommendationsFetchError.d.ts +10 -0
- package/dist/errors/FeeRecommendationsFetchError.d.ts.map +1 -0
- package/dist/errors/TransactionBroadcastFailedError.d.ts +10 -0
- package/dist/errors/TransactionBroadcastFailedError.d.ts.map +1 -0
- package/dist/errors/TransactionRequiredError.d.ts +5 -0
- package/dist/errors/TransactionRequiredError.d.ts.map +1 -0
- package/dist/errors/UTXOsFetchError.d.ts +12 -0
- package/dist/errors/UTXOsFetchError.d.ts.map +1 -0
- package/dist/exports/index.d.ts +2 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +2 -0
- package/dist/exports/waas.d.ts.map +1 -0
- package/dist/index.cjs.js +125 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +125 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/injected.cjs.js +1 -1
- package/dist/injected.esm.js +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas/WaasBitcoinWalletProvider.types.d.ts +30 -0
- package/dist/waas/WaasBitcoinWalletProvider.types.d.ts.map +1 -0
- package/dist/waas/addWaasBitcoinExtension/addWaasBitcoinExtension.d.ts +11 -0
- package/dist/waas/addWaasBitcoinExtension/addWaasBitcoinExtension.d.ts.map +1 -0
- package/dist/waas/addWaasBitcoinExtension/index.d.ts +2 -0
- package/dist/waas/addWaasBitcoinExtension/index.d.ts.map +1 -0
- package/dist/waas/constants.d.ts +36 -0
- package/dist/waas/constants.d.ts.map +1 -0
- package/dist/waas/utils/broadcastTransaction/broadcastTransaction.d.ts +10 -0
- package/dist/waas/utils/broadcastTransaction/broadcastTransaction.d.ts.map +1 -0
- package/dist/waas/utils/broadcastTransaction/index.d.ts +2 -0
- package/dist/waas/utils/broadcastTransaction/index.d.ts.map +1 -0
- package/dist/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.d.ts +4 -0
- package/dist/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.d.ts.map +1 -0
- package/dist/waas/utils/createWalletProviderForWaasBitcoin/index.d.ts +2 -0
- package/dist/waas/utils/createWalletProviderForWaasBitcoin/index.d.ts.map +1 -0
- package/dist/waas/utils/estimateTransactionFee/estimateTransactionFee.d.ts +11 -0
- package/dist/waas/utils/estimateTransactionFee/estimateTransactionFee.d.ts.map +1 -0
- package/dist/waas/utils/estimateTransactionFee/index.d.ts +2 -0
- package/dist/waas/utils/estimateTransactionFee/index.d.ts.map +1 -0
- package/dist/waas/utils/getFeeRecommendations/getFeeRecommendations.d.ts +9 -0
- package/dist/waas/utils/getFeeRecommendations/getFeeRecommendations.d.ts.map +1 -0
- package/dist/waas/utils/getFeeRecommendations/index.d.ts +2 -0
- package/dist/waas/utils/getFeeRecommendations/index.d.ts.map +1 -0
- package/dist/waas/utils/getUTXOs/getUTXOs.d.ts +10 -0
- package/dist/waas/utils/getUTXOs/getUTXOs.d.ts.map +1 -0
- package/dist/waas/utils/getUTXOs/index.d.ts +2 -0
- package/dist/waas/utils/getUTXOs/index.d.ts.map +1 -0
- package/package.json +8 -3
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseError } from '@dynamic-labs-sdk/client';
|
|
2
|
+
type FeeRecommendationsFetchErrorParams = {
|
|
3
|
+
response: Response;
|
|
4
|
+
};
|
|
5
|
+
export declare class FeeRecommendationsFetchError extends BaseError {
|
|
6
|
+
readonly response: Response;
|
|
7
|
+
constructor({ response }: FeeRecommendationsFetchErrorParams);
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=FeeRecommendationsFetchError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeeRecommendationsFetchError.d.ts","sourceRoot":"","sources":["../../src/errors/FeeRecommendationsFetchError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,KAAK,kCAAkC,GAAG;IACxC,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,qBAAa,4BAA6B,SAAQ,SAAS;IACzD,SAAgB,QAAQ,EAAE,QAAQ,CAAC;gBAEvB,EAAE,QAAQ,EAAE,EAAE,kCAAkC;CAY7D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseError } from '@dynamic-labs-sdk/client';
|
|
2
|
+
type TransactionBroadcastFailedErrorParams = {
|
|
3
|
+
response: Response;
|
|
4
|
+
};
|
|
5
|
+
export declare class TransactionBroadcastFailedError extends BaseError {
|
|
6
|
+
readonly response: Response;
|
|
7
|
+
constructor({ response }: TransactionBroadcastFailedErrorParams);
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=TransactionBroadcastFailedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionBroadcastFailedError.d.ts","sourceRoot":"","sources":["../../src/errors/TransactionBroadcastFailedError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,KAAK,qCAAqC,GAAG;IAC3C,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,qBAAa,+BAAgC,SAAQ,SAAS;IAC5D,SAAgB,QAAQ,EAAE,QAAQ,CAAC;gBAEvB,EAAE,QAAQ,EAAE,EAAE,qCAAqC;CAYhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionRequiredError.d.ts","sourceRoot":"","sources":["../../src/errors/TransactionRequiredError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,qBAAa,wBAAyB,SAAQ,SAAS;;CAUtD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseError } from '@dynamic-labs-sdk/client';
|
|
2
|
+
type UTXOsFetchErrorParams = {
|
|
3
|
+
address: string;
|
|
4
|
+
response: Response;
|
|
5
|
+
};
|
|
6
|
+
export declare class UTXOsFetchError extends BaseError {
|
|
7
|
+
readonly address: string;
|
|
8
|
+
readonly response: Response;
|
|
9
|
+
constructor({ address, response }: UTXOsFetchErrorParams);
|
|
10
|
+
}
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=UTXOsFetchError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UTXOsFetchError.d.ts","sourceRoot":"","sources":["../../src/errors/UTXOsFetchError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,KAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,SAAgB,OAAO,EAAE,MAAM,CAAC;IAEhC,SAAgB,QAAQ,EAAE,QAAQ,CAAC;gBAEvB,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,qBAAqB;CAczD"}
|
package/dist/exports/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';
|
|
|
3
3
|
export type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';
|
|
4
4
|
export type { BitcoinAddressType, BitcoinSendTransactionResponse, BitcoinSignProtocol, BitcoinSignPsbtRequest, BitcoinTransaction, } from '../BitcoinWalletProvider.types';
|
|
5
5
|
export { InvalidPsbtError } from '../errors/InvalidPsbtError';
|
|
6
|
+
export { TransactionBroadcastFailedError } from '../errors/TransactionBroadcastFailedError';
|
|
7
|
+
export { TransactionRequiredError } from '../errors/TransactionRequiredError';
|
|
6
8
|
export { isBitcoinNetworkProvider } from '../isBitcoinNetworkProvider';
|
|
7
9
|
export { isBitcoinWalletAccount } from '../isBitcoinWalletAccount';
|
|
8
10
|
export { sendBitcoin } from '../sendBitcoin';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EACV,kBAAkB,EAClB,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,YAAY,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,YAAY,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,YAAY,EACV,kBAAkB,EAClB,8BAA8B,EAC9B,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,2CAA2C,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"waas.d.ts","sourceRoot":"","sources":["../../src/exports/waas.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,19 +1,139 @@
|
|
|
1
|
-
const require_addBitcoinInjectedWalletsExtension = require('./addBitcoinInjectedWalletsExtension-
|
|
1
|
+
const require_addBitcoinInjectedWalletsExtension = require('./addBitcoinInjectedWalletsExtension-DNUJc7N7.cjs.js');
|
|
2
2
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
3
3
|
let _dynamic_labs_sdk_client_core = require("@dynamic-labs-sdk/client/core");
|
|
4
4
|
let _dynamic_labs_sdk_client = require("@dynamic-labs-sdk/client");
|
|
5
|
+
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
6
|
+
let _dynamic_labs_sdk_client_waas_core = require("@dynamic-labs-sdk/client/waas/core");
|
|
5
7
|
|
|
8
|
+
//#region src/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.ts
|
|
9
|
+
const createWalletProviderForWaasBitcoin = (sdkClient) => {
|
|
10
|
+
const chain = "BTC";
|
|
11
|
+
const walletProviderType = _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet;
|
|
12
|
+
const key = (0, _dynamic_labs_sdk_client_core.formatWalletProviderKey)({
|
|
13
|
+
chain,
|
|
14
|
+
displayName: _dynamic_labs_sdk_client_waas_core.DYNAMIC_WAAS_METADATA.displayName,
|
|
15
|
+
walletProviderType
|
|
16
|
+
});
|
|
17
|
+
const waasProvider = (0, _dynamic_labs_sdk_client_waas_core.createWaasProvider)({
|
|
18
|
+
chain,
|
|
19
|
+
sdkClient
|
|
20
|
+
});
|
|
21
|
+
const getActiveNetworkId = async () => (0, _dynamic_labs_sdk_client_core.getActiveNetworkIdFromLastKnownRegistry)({
|
|
22
|
+
client: sdkClient,
|
|
23
|
+
walletProviderKey: key
|
|
24
|
+
});
|
|
25
|
+
const switchActiveNetwork = async ({ networkId }) => (0, _dynamic_labs_sdk_client_core.switchActiveNetworkInLastKnownRegistry)({
|
|
26
|
+
client: sdkClient,
|
|
27
|
+
networkId,
|
|
28
|
+
walletProviderKey: key
|
|
29
|
+
});
|
|
30
|
+
const getConnectedAddresses = async () => {
|
|
31
|
+
return { addresses: (0, _dynamic_labs_sdk_client_waas_core.getAllUserWaasAddressesForChain)({ chain }, sdkClient) };
|
|
32
|
+
};
|
|
33
|
+
const signPsbt$1 = async ({ request: _request, walletAccount }) => {
|
|
34
|
+
(0, _dynamic_labs_sdk_client_core.assertDefined)(walletAccount, "Wallet account is required");
|
|
35
|
+
throw new _dynamic_labs_sdk_client_core.MethodNotImplementedError("signPsbt");
|
|
36
|
+
};
|
|
37
|
+
const signPsbts$1 = async ({ requests: _requests, walletAccount: _walletAccount }) => {
|
|
38
|
+
throw new _dynamic_labs_sdk_client_core.MethodNotImplementedError("signPsbts");
|
|
39
|
+
};
|
|
40
|
+
const sendBitcoin$1 = async ({ transaction: _transaction, walletAccount }) => {
|
|
41
|
+
(0, _dynamic_labs_sdk_client_core.assertDefined)(walletAccount, "Wallet account is required");
|
|
42
|
+
throw new _dynamic_labs_sdk_client_core.MethodNotImplementedError("sendBitcoin");
|
|
43
|
+
};
|
|
44
|
+
const signMessage = async ({ message: _message, walletAccount, addressType: _addressType, protocol: _protocol }) => {
|
|
45
|
+
(0, _dynamic_labs_sdk_client_core.assertDefined)(walletAccount, "Wallet account is required");
|
|
46
|
+
throw new _dynamic_labs_sdk_client_core.MethodNotImplementedError("signMessage");
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
...waasProvider,
|
|
50
|
+
chain,
|
|
51
|
+
getActiveNetworkId,
|
|
52
|
+
getConnectedAddresses,
|
|
53
|
+
groupKey: (0, _dynamic_labs_sdk_client_core.formatWalletProviderGroupKey)(_dynamic_labs_sdk_client_waas_core.DYNAMIC_WAAS_METADATA.displayName),
|
|
54
|
+
key,
|
|
55
|
+
metadata: {
|
|
56
|
+
displayName: _dynamic_labs_sdk_client_waas_core.DYNAMIC_WAAS_METADATA.displayName,
|
|
57
|
+
icon: _dynamic_labs_sdk_client_waas_core.DYNAMIC_WAAS_METADATA.icon
|
|
58
|
+
},
|
|
59
|
+
sendBitcoin: sendBitcoin$1,
|
|
60
|
+
signMessage,
|
|
61
|
+
signPsbt: signPsbt$1,
|
|
62
|
+
signPsbts: signPsbts$1,
|
|
63
|
+
switchActiveNetwork,
|
|
64
|
+
walletProviderType
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/waas/addWaasBitcoinExtension/addWaasBitcoinExtension.ts
|
|
70
|
+
const WAAS_BITCOIN_EXTENSION_KEY = "waasBitcoin";
|
|
71
|
+
/**
|
|
72
|
+
* Adds the Dynamic WaaS (Wallet as a Service) Bitcoin extension to the Dynamic client.
|
|
73
|
+
*
|
|
74
|
+
* This extension enables embedded wallet functionality for Bitcoin blockchain,
|
|
75
|
+
* allowing users to have wallets managed by Dynamic's infrastructure.
|
|
76
|
+
*
|
|
77
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
78
|
+
*/
|
|
79
|
+
const addWaasBitcoinExtension = (client = (0, _dynamic_labs_sdk_client_core.getDefaultClient)()) => {
|
|
80
|
+
if ((0, _dynamic_labs_sdk_client_core.hasExtension)({ extensionKey: WAAS_BITCOIN_EXTENSION_KEY }, client)) return;
|
|
81
|
+
(0, _dynamic_labs_sdk_client_core.registerExtension)({ extensionKey: WAAS_BITCOIN_EXTENSION_KEY }, client);
|
|
82
|
+
require_addBitcoinInjectedWalletsExtension.registerBitcoinNetworkProviderBuilder(client);
|
|
83
|
+
const walletProviderRegistry = (0, _dynamic_labs_sdk_client_core.getWalletProviderRegistry)(client);
|
|
84
|
+
const walletProvider = createWalletProviderForWaasBitcoin(client);
|
|
85
|
+
walletProviderRegistry.register({
|
|
86
|
+
priority: _dynamic_labs_sdk_client_core.WalletProviderPriority.WALLET_SDK,
|
|
87
|
+
walletProvider
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
6
92
|
//#region src/addBitcoinExtension/addBitcoinExtension.ts
|
|
7
93
|
/**
|
|
8
94
|
* Adds the Bitcoin extension to the Dynamic client.
|
|
9
95
|
*
|
|
10
|
-
* This is a convenience function that adds
|
|
11
|
-
*
|
|
96
|
+
* This is a convenience function that adds both the Bitcoin Injected Wallets extension
|
|
97
|
+
* and the Dynamic WaaS Bitcoin extension, enabling support for all Bitcoin wallet types
|
|
98
|
+
* including injected wallets (MagicEden, Xverse, Unisat, and more) and embedded wallets
|
|
99
|
+
* managed by Dynamic's infrastructure.
|
|
12
100
|
*
|
|
13
101
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
14
102
|
*/
|
|
15
103
|
const addBitcoinExtension = (client = (0, _dynamic_labs_sdk_client_core.getDefaultClient)()) => {
|
|
16
104
|
require_addBitcoinInjectedWalletsExtension.addBitcoinInjectedWalletsExtension(client);
|
|
105
|
+
addWaasBitcoinExtension(client);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/errors/TransactionBroadcastFailedError.ts
|
|
110
|
+
var TransactionBroadcastFailedError = class extends _dynamic_labs_sdk_client.BaseError {
|
|
111
|
+
response;
|
|
112
|
+
constructor({ response }) {
|
|
113
|
+
super({
|
|
114
|
+
cause: null,
|
|
115
|
+
code: "transaction_broadcast_failed_error",
|
|
116
|
+
details: `Status: ${response.status} ${response.statusText}`,
|
|
117
|
+
docsUrl: null,
|
|
118
|
+
name: "TransactionBroadcastFailedError",
|
|
119
|
+
shortMessage: "Failed to broadcast transaction to mempool"
|
|
120
|
+
});
|
|
121
|
+
this.response = response;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/errors/TransactionRequiredError.ts
|
|
127
|
+
var TransactionRequiredError = class extends _dynamic_labs_sdk_client.BaseError {
|
|
128
|
+
constructor() {
|
|
129
|
+
super({
|
|
130
|
+
cause: null,
|
|
131
|
+
code: "transaction_required_error",
|
|
132
|
+
docsUrl: null,
|
|
133
|
+
name: "TransactionRequiredError",
|
|
134
|
+
shortMessage: "No transaction specified for broadcast"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
17
137
|
};
|
|
18
138
|
|
|
19
139
|
//#endregion
|
|
@@ -183,6 +303,8 @@ const signPsbts = async ({ walletAccount, requests }, client = (0, _dynamic_labs
|
|
|
183
303
|
|
|
184
304
|
//#endregion
|
|
185
305
|
exports.InvalidPsbtError = require_addBitcoinInjectedWalletsExtension.InvalidPsbtError;
|
|
306
|
+
exports.TransactionBroadcastFailedError = TransactionBroadcastFailedError;
|
|
307
|
+
exports.TransactionRequiredError = TransactionRequiredError;
|
|
186
308
|
exports.addBitcoinExtension = addBitcoinExtension;
|
|
187
309
|
exports.isBitcoinNetworkProvider = isBitcoinNetworkProvider;
|
|
188
310
|
exports.isBitcoinWalletAccount = isBitcoinWalletAccount;
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","names":["BaseError","MethodNotImplementedError","BaseError","getMempoolApiUrl","MethodNotImplementedError","packageName","packageVersion"],"sources":["../src/addBitcoinExtension/addBitcoinExtension.ts","../src/isBitcoinNetworkProvider/isBitcoinNetworkProvider.ts","../src/isBitcoinWalletAccount/isBitcoinWalletAccount.ts","../src/errors/NotBitcoinProviderError.ts","../src/isBitcoinWalletProvider/isBitcoinWalletProvider.ts","../src/sendBitcoin/sendBitcoin.ts","../src/errors/SendBitcoinRawTransactionError.ts","../src/sendRawTransaction/sendRawTransaction.ts","../src/signMessageWithCustomOptions/signMessageWithCustomOptions.ts","../src/signPsbt/signPsbt.ts","../src/signPsbts/signPsbts.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addBitcoinInjectedWalletsExtension } from '../injected/addBitcoinInjectedWalletsExtension';\n\n/**\n * Adds the Bitcoin extension to the Dynamic client.\n *\n * This is a convenience function that adds support for a variety of Bitcoin wallets,\n * like MagicEden, Xverse, Unisat, and more.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\n\nexport const addBitcoinExtension = (client = getDefaultClient()): void => {\n addBitcoinInjectedWalletsExtension(client);\n};\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';\n\n/**\n * Type guard function to check if a network provider is a Bitcoin network provider.\n *\n * @param networkProvider - The network provider to check.\n * @returns True if the network provider is a Bitcoin network provider, false otherwise.\n */\nexport const isBitcoinNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is BitcoinNetworkProvider => networkProvider.chain === 'BTC';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\n\n/**\n * Type guard function to check if a wallet account is a Bitcoin wallet account.\n *\n * @param walletAccount - The wallet account to check.\n * @returns True if the wallet account is a Bitcoin wallet account, false otherwise.\n */\nexport const isBitcoinWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is BitcoinWalletAccount => walletAccount.chain === 'BTC';\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotBitcoinProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_bitcoin_provider_error',\n docsUrl: null,\n name: 'NotBitcoinProviderError',\n shortMessage: 'Provider is not a Bitcoin wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletProvider } from '../BitcoinWalletProvider.types';\n\nexport const isBitcoinWalletProvider = (\n provider: WalletProvider\n): provider is BitcoinWalletProvider => {\n return provider.chain === 'BTC';\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type {\n BitcoinSendTransactionResponse,\n BitcoinTransaction,\n} from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SendBitcoinParams = {\n transaction: BitcoinTransaction;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Sends a Bitcoin transaction\n * @param params.transaction - The transaction to send\n * @param params.walletAccount - The wallet account to send the transaction from\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the transaction id\n * @throws {MethodNotImplementedError} If the wallet provider does not implement the sendBitcoin method\n * @throws {NotBitcoinProviderError} If the wallet account is not a valid BitcoinWalletAccount\n */\nexport const sendBitcoin = async (\n { walletAccount, transaction }: SendBitcoinParams,\n client = getDefaultClient()\n): Promise<BitcoinSendTransactionResponse> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n if (!provider.sendBitcoin) {\n throw new MethodNotImplementedError('sendBitcoin');\n }\n\n return provider.sendBitcoin({ transaction, walletAccount });\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\ntype SendBitcoinRawTransactionErrorParams = {\n originalError: unknown;\n};\n\nexport class SendBitcoinRawTransactionError extends BaseError {\n constructor({ originalError }: SendBitcoinRawTransactionErrorParams) {\n const cause = originalError instanceof Error ? originalError : null;\n\n super({\n cause,\n code: 'send_bitcoin_raw_transaction_error',\n docsUrl: null,\n name: 'SendBitcoinRawTransactionError',\n shortMessage: 'Failed to send Bitcoin raw transaction',\n });\n }\n}\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getCore } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport { SendBitcoinRawTransactionError } from '../errors/SendBitcoinRawTransactionError';\nimport { getMempoolApiUrl } from '../utils/getMempoolApiUrl';\n\ntype SendRawTransactionParams = {\n rawTransaction: string;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Sends a raw transaction using the mempool.space API\n * @param params.rawTransaction - The raw transaction to send\n * @param params.walletAccount - The wallet account to send the transaction from\n * @returns An object containing the transaction id\n */\nexport const sendRawTransaction = async (\n { rawTransaction, walletAccount }: SendRawTransactionParams,\n client = getDefaultClient()\n): Promise<{\n transactionId: string;\n}> => {\n const fetchService = getCore(client).fetch;\n\n const API_URL = getMempoolApiUrl(walletAccount.address);\n\n const response = await fetchService(`${API_URL}/tx`, {\n body: rawTransaction,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n\n if (!response.ok) {\n throw new SendBitcoinRawTransactionError({\n originalError: await response.text(),\n });\n }\n\n // this endpoint returns the transaction ID\n const transactionId = await response.text();\n\n return { transactionId };\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type {\n BitcoinAddressType,\n BitcoinSignProtocol,\n} from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignMessageWithCustomOptionsParams = {\n addressType?: BitcoinAddressType;\n message: string;\n protocol?: BitcoinSignProtocol;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs a message with custom options, like a specific address type or protocol\n *\n * If the wallet provider does not support specifying an address type or protocol, it will use the default values.\n *\n * @param params.addressType - The address type to use for signing ('ordinals' or 'payment')\n * @param params.message - The message to sign\n * @param params.protocol - The protocol to use for signing ('ecdsa' or 'bip322-simple')\n * @param params.walletAccount - The wallet account to sign the message with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature\n * @throws {MethodNotImplementedError} If the wallet provider does not implement the signMessage method\n * @throws {NotBitcoinProviderError} If the wallet account is not a valid BitcoinWalletAccount\n */\nexport const signMessageWithCustomOptions = async (\n {\n walletAccount,\n message,\n protocol,\n addressType,\n }: SignMessageWithCustomOptionsParams,\n client = getDefaultClient()\n): Promise<{ signature: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n if (!provider.signMessage) {\n throw new MethodNotImplementedError('signMessage');\n }\n\n return provider.signMessage({\n addressType,\n message,\n protocol,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type { BitcoinSignPsbtRequest } from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignPsbtParams = {\n request: BitcoinSignPsbtRequest;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs a PSBT\n * @param params.request - The request data to sign the PSBT\n * @param params.walletAccount - The wallet account to sign the PSBT with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signed PSBT\n */\nexport const signPsbt = async (\n { walletAccount, request }: SignPsbtParams,\n client = getDefaultClient()\n): Promise<{ signedPsbt: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n return provider.signPsbt({ request, walletAccount });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type { BitcoinSignPsbtRequest } from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignPsbtsParams = {\n requests: BitcoinSignPsbtRequest[];\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs multiple PSBTs\n * @param params.requests - The list of request data to sign the PSBTs\n * @param params.walletAccount - The wallet account to sign the PSBT with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signed PSBT\n */\nexport const signPsbts = async (\n { walletAccount, requests }: SignPsbtsParams,\n client = getDefaultClient()\n): Promise<{ signedPsbts: string[] }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n return provider.signPsbts({ requests, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addBitcoinExtension } from '../addBitcoinExtension';\nexport type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';\nexport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nexport type {\n BitcoinAddressType,\n BitcoinSendTransactionResponse,\n BitcoinSignProtocol,\n BitcoinSignPsbtRequest,\n BitcoinTransaction,\n} from '../BitcoinWalletProvider.types';\nexport { InvalidPsbtError } from '../errors/InvalidPsbtError';\nexport { isBitcoinNetworkProvider } from '../isBitcoinNetworkProvider';\nexport { isBitcoinWalletAccount } from '../isBitcoinWalletAccount';\nexport { sendBitcoin } from '../sendBitcoin';\nexport { sendRawTransaction } from '../sendRawTransaction';\nexport { signMessageWithCustomOptions } from '../signMessageWithCustomOptions';\nexport { signPsbt } from '../signPsbt';\nexport { signPsb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vC,eAAe,MAAM,SAAS,MAAM,EACrC,CAAC;AAMJ,QAAO,EAAE,eAFa,MAAM,SAAS,MAAM,EAEnB;;;;;;;;;;;;;;;;;;;ACV1B,MAAa,+BAA+B,OAC1C,EACE,eACA,SACA,UACA,eAEF,yDAA2B,KACQ;CACnC,MAAM,iFACJ,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,wBAAwB,SAAS,CACpC,OAAM,IAAI,wBAAwB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGlE,KAAI,CAAC,SAAS,YACZ,OAAM,IAAIC,wDAA0B,cAAc;AAGpD,QAAO,SAAS,YAAY;EAC1B;EACA;EACA;EACA;EACD,CAAC;;;;;;;;;;;;AC5CJ,MAAa,WAAW,OACtB,EAAE,eAAe,WACjB,yDAA2B,KACS;CACpC,MAAM,iFACJ,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,wBAAwB,SAAS,CACpC,OAAM,IAAI,wBAAwB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGlE,QAAO,SAAS,SAAS;EAAE;EAAS;EAAe,CAAC;;;;;;;;;;;;ACftD,MAAa,YAAY,OACvB,EAAE,eAAe,YACjB,yDAA2B,KACY;CACvC,MAAM,iFACJ,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,wBAAwB,SAAS,CACpC,OAAM,IAAI,wBAAwB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGlE,QAAO,SAAS,UAAU;EAAE;EAAU;EAAe,CAAC;;;;;mEC7BnCC,iDAAaC,mDAAe"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","names":["WalletProviderEnum","DYNAMIC_WAAS_METADATA","getActiveNetworkId: WaasBitcoinWalletProvider['getActiveNetworkId']","switchActiveNetwork: WaasBitcoinWalletProvider['switchActiveNetwork']","getConnectedAddresses: WaasBitcoinWalletProvider['getConnectedAddresses']","signPsbt: WaasBitcoinWalletProvider['signPsbt']","MethodNotImplementedError","signPsbts: WaasBitcoinWalletProvider['signPsbts']","sendBitcoin: WaasBitcoinWalletProvider['sendBitcoin']","signMessage: WaasBitcoinWalletProvider['signMessage']","WalletProviderPriority","BaseError","BaseError","BaseError","MethodNotImplementedError","BaseError","getMempoolApiUrl","MethodNotImplementedError","packageName","packageVersion"],"sources":["../src/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.ts","../src/waas/addWaasBitcoinExtension/addWaasBitcoinExtension.ts","../src/addBitcoinExtension/addBitcoinExtension.ts","../src/errors/TransactionBroadcastFailedError.ts","../src/errors/TransactionRequiredError.ts","../src/isBitcoinNetworkProvider/isBitcoinNetworkProvider.ts","../src/isBitcoinWalletAccount/isBitcoinWalletAccount.ts","../src/errors/NotBitcoinProviderError.ts","../src/isBitcoinWalletProvider/isBitcoinWalletProvider.ts","../src/sendBitcoin/sendBitcoin.ts","../src/errors/SendBitcoinRawTransactionError.ts","../src/sendRawTransaction/sendRawTransaction.ts","../src/signMessageWithCustomOptions/signMessageWithCustomOptions.ts","../src/signPsbt/signPsbt.ts","../src/signPsbts/signPsbts.ts","../src/exports/index.ts"],"sourcesContent":["import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n assertDefined,\n formatWalletProviderGroupKey,\n formatWalletProviderKey,\n getActiveNetworkIdFromLastKnownRegistry,\n switchActiveNetworkInLastKnownRegistry,\n} from '@dynamic-labs-sdk/client/core';\nimport {\n DYNAMIC_WAAS_METADATA,\n createWaasProvider,\n getAllUserWaasAddressesForChain,\n} from '@dynamic-labs-sdk/client/waas/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { BitcoinSendTransactionResponse } from '../../../BitcoinWalletProvider.types';\nimport type { WaasBitcoinWalletProvider } from '../../WaasBitcoinWalletProvider.types';\n\nexport const createWalletProviderForWaasBitcoin = (\n sdkClient: DynamicClient\n): WaasBitcoinWalletProvider => {\n const chain = 'BTC' as const;\n\n const walletProviderType = WalletProviderEnum.EmbeddedWallet;\n\n const key = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType,\n });\n\n const waasProvider = createWaasProvider({ chain, sdkClient });\n\n const getActiveNetworkId: WaasBitcoinWalletProvider['getActiveNetworkId'] =\n async () =>\n getActiveNetworkIdFromLastKnownRegistry({\n client: sdkClient,\n walletProviderKey: key,\n });\n\n const switchActiveNetwork: WaasBitcoinWalletProvider['switchActiveNetwork'] =\n async ({ networkId }) =>\n switchActiveNetworkInLastKnownRegistry({\n client: sdkClient,\n networkId,\n walletProviderKey: key,\n });\n\n const getConnectedAddresses: WaasBitcoinWalletProvider['getConnectedAddresses'] =\n async () => {\n const waasBitcoinAddresses = getAllUserWaasAddressesForChain(\n { chain },\n sdkClient\n );\n\n return {\n addresses: waasBitcoinAddresses,\n };\n };\n\n const signPsbt: WaasBitcoinWalletProvider['signPsbt'] = async ({\n request: _request,\n walletAccount,\n }) => {\n assertDefined(walletAccount, 'Wallet account is required');\n throw new MethodNotImplementedError('signPsbt');\n };\n\n const signPsbts: WaasBitcoinWalletProvider['signPsbts'] = async ({\n requests: _requests,\n walletAccount: _walletAccount,\n }) => {\n throw new MethodNotImplementedError('signPsbts');\n };\n\n const sendBitcoin: WaasBitcoinWalletProvider['sendBitcoin'] = async ({\n transaction: _transaction,\n walletAccount,\n }): Promise<BitcoinSendTransactionResponse> => {\n assertDefined(walletAccount, 'Wallet account is required');\n throw new MethodNotImplementedError('sendBitcoin');\n };\n\n const signMessage: WaasBitcoinWalletProvider['signMessage'] = async ({\n message: _message,\n walletAccount,\n addressType: _addressType,\n protocol: _protocol,\n }) => {\n assertDefined(walletAccount, 'Wallet account is required');\n throw new MethodNotImplementedError('signMessage');\n };\n\n return {\n ...waasProvider,\n chain,\n getActiveNetworkId,\n getConnectedAddresses,\n groupKey: formatWalletProviderGroupKey(DYNAMIC_WAAS_METADATA.displayName),\n key,\n metadata: {\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n icon: DYNAMIC_WAAS_METADATA.icon,\n },\n sendBitcoin,\n signMessage,\n signPsbt,\n signPsbts,\n switchActiveNetwork,\n walletProviderType,\n };\n};\n\n","import {\n WalletProviderPriority,\n getDefaultClient,\n getWalletProviderRegistry,\n hasExtension,\n registerExtension,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { registerBitcoinNetworkProviderBuilder } from '../../registerBitcoinNetworkProviderBuilder';\nimport { createWalletProviderForWaasBitcoin } from '../utils/createWalletProviderForWaasBitcoin';\n\nexport const WAAS_BITCOIN_EXTENSION_KEY = 'waasBitcoin';\n\n/**\n * Adds the Dynamic WaaS (Wallet as a Service) Bitcoin extension to the Dynamic client.\n *\n * This extension enables embedded wallet functionality for Bitcoin blockchain,\n * allowing users to have wallets managed by Dynamic's infrastructure.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\nexport const addWaasBitcoinExtension = (client = getDefaultClient()): void => {\n if (hasExtension({ extensionKey: WAAS_BITCOIN_EXTENSION_KEY }, client)) {\n return;\n }\n\n registerExtension({ extensionKey: WAAS_BITCOIN_EXTENSION_KEY }, client);\n registerBitcoinNetworkProviderBuilder(client);\n\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n const walletProvider = createWalletProviderForWaasBitcoin(client);\n\n walletProviderRegistry.register({\n priority: WalletProviderPriority.WALLET_SDK,\n walletProvider,\n });\n};\n\n","import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addBitcoinInjectedWalletsExtension } from '../injected/addBitcoinInjectedWalletsExtension';\nimport { addWaasBitcoinExtension } from '../waas/addWaasBitcoinExtension';\n\n/**\n * Adds the Bitcoin extension to the Dynamic client.\n *\n * This is a convenience function that adds both the Bitcoin Injected Wallets extension\n * and the Dynamic WaaS Bitcoin extension, enabling support for all Bitcoin wallet types\n * including injected wallets (MagicEden, Xverse, Unisat, and more) and embedded wallets\n * managed by Dynamic's infrastructure.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\n\nexport const addBitcoinExtension = (client = getDefaultClient()): void => {\n addBitcoinInjectedWalletsExtension(client);\n addWaasBitcoinExtension(client);\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\ntype TransactionBroadcastFailedErrorParams = {\n response: Response;\n};\n\nexport class TransactionBroadcastFailedError extends BaseError {\n public readonly response: Response;\n\n constructor({ response }: TransactionBroadcastFailedErrorParams) {\n super({\n cause: null,\n code: 'transaction_broadcast_failed_error',\n details: `Status: ${response.status} ${response.statusText}`,\n docsUrl: null,\n name: 'TransactionBroadcastFailedError',\n shortMessage: 'Failed to broadcast transaction to mempool',\n });\n\n this.response = response;\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class TransactionRequiredError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'transaction_required_error',\n docsUrl: null,\n name: 'TransactionRequiredError',\n shortMessage: 'No transaction specified for broadcast',\n });\n }\n}\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';\n\n/**\n * Type guard function to check if a network provider is a Bitcoin network provider.\n *\n * @param networkProvider - The network provider to check.\n * @returns True if the network provider is a Bitcoin network provider, false otherwise.\n */\nexport const isBitcoinNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is BitcoinNetworkProvider => networkProvider.chain === 'BTC';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\n\n/**\n * Type guard function to check if a wallet account is a Bitcoin wallet account.\n *\n * @param walletAccount - The wallet account to check.\n * @returns True if the wallet account is a Bitcoin wallet account, false otherwise.\n */\nexport const isBitcoinWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is BitcoinWalletAccount => walletAccount.chain === 'BTC';\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotBitcoinProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_bitcoin_provider_error',\n docsUrl: null,\n name: 'NotBitcoinProviderError',\n shortMessage: 'Provider is not a Bitcoin wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletProvider } from '../BitcoinWalletProvider.types';\n\nexport const isBitcoinWalletProvider = (\n provider: WalletProvider\n): provider is BitcoinWalletProvider => {\n return provider.chain === 'BTC';\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type {\n BitcoinSendTransactionResponse,\n BitcoinTransaction,\n} from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SendBitcoinParams = {\n transaction: BitcoinTransaction;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Sends a Bitcoin transaction\n * @param params.transaction - The transaction to send\n * @param params.walletAccount - The wallet account to send the transaction from\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the transaction id\n * @throws {MethodNotImplementedError} If the wallet provider does not implement the sendBitcoin method\n * @throws {NotBitcoinProviderError} If the wallet account is not a valid BitcoinWalletAccount\n */\nexport const sendBitcoin = async (\n { walletAccount, transaction }: SendBitcoinParams,\n client = getDefaultClient()\n): Promise<BitcoinSendTransactionResponse> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n if (!provider.sendBitcoin) {\n throw new MethodNotImplementedError('sendBitcoin');\n }\n\n return provider.sendBitcoin({ transaction, walletAccount });\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\ntype SendBitcoinRawTransactionErrorParams = {\n originalError: unknown;\n};\n\nexport class SendBitcoinRawTransactionError extends BaseError {\n constructor({ originalError }: SendBitcoinRawTransactionErrorParams) {\n const cause = originalError instanceof Error ? originalError : null;\n\n super({\n cause,\n code: 'send_bitcoin_raw_transaction_error',\n docsUrl: null,\n name: 'SendBitcoinRawTransactionError',\n shortMessage: 'Failed to send Bitcoin raw transaction',\n });\n }\n}\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getCore } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport { SendBitcoinRawTransactionError } from '../errors/SendBitcoinRawTransactionError';\nimport { getMempoolApiUrl } from '../utils/getMempoolApiUrl';\n\ntype SendRawTransactionParams = {\n rawTransaction: string;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Sends a raw transaction using the mempool.space API\n * @param params.rawTransaction - The raw transaction to send\n * @param params.walletAccount - The wallet account to send the transaction from\n * @returns An object containing the transaction id\n */\nexport const sendRawTransaction = async (\n { rawTransaction, walletAccount }: SendRawTransactionParams,\n client = getDefaultClient()\n): Promise<{\n transactionId: string;\n}> => {\n const fetchService = getCore(client).fetch;\n\n const API_URL = getMempoolApiUrl(walletAccount.address);\n\n const response = await fetchService(`${API_URL}/tx`, {\n body: rawTransaction,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n\n if (!response.ok) {\n throw new SendBitcoinRawTransactionError({\n originalError: await response.text(),\n });\n }\n\n // this endpoint returns the transaction ID\n const transactionId = await response.text();\n\n return { transactionId };\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type {\n BitcoinAddressType,\n BitcoinSignProtocol,\n} from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignMessageWithCustomOptionsParams = {\n addressType?: BitcoinAddressType;\n message: string;\n protocol?: BitcoinSignProtocol;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs a message with custom options, like a specific address type or protocol\n *\n * If the wallet provider does not support specifying an address type or protocol, it will use the default values.\n *\n * @param params.addressType - The address type to use for signing ('ordinals' or 'payment')\n * @param params.message - The message to sign\n * @param params.protocol - The protocol to use for signing ('ecdsa' or 'bip322-simple')\n * @param params.walletAccount - The wallet account to sign the message with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature\n * @throws {MethodNotImplementedError} If the wallet provider does not implement the signMessage method\n * @throws {NotBitcoinProviderError} If the wallet account is not a valid BitcoinWalletAccount\n */\nexport const signMessageWithCustomOptions = async (\n {\n walletAccount,\n message,\n protocol,\n addressType,\n }: SignMessageWithCustomOptionsParams,\n client = getDefaultClient()\n): Promise<{ signature: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n if (!provider.signMessage) {\n throw new MethodNotImplementedError('signMessage');\n }\n\n return provider.signMessage({\n addressType,\n message,\n protocol,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type { BitcoinSignPsbtRequest } from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignPsbtParams = {\n request: BitcoinSignPsbtRequest;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs a PSBT\n * @param params.request - The request data to sign the PSBT\n * @param params.walletAccount - The wallet account to sign the PSBT with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signed PSBT\n */\nexport const signPsbt = async (\n { walletAccount, request }: SignPsbtParams,\n client = getDefaultClient()\n): Promise<{ signedPsbt: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n return provider.signPsbt({ request, walletAccount });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type { BitcoinSignPsbtRequest } from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignPsbtsParams = {\n requests: BitcoinSignPsbtRequest[];\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs multiple PSBTs\n * @param params.requests - The list of request data to sign the PSBTs\n * @param params.walletAccount - The wallet account to sign the PSBT with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signed PSBT\n */\nexport const signPsbts = async (\n { walletAccount, requests }: SignPsbtsParams,\n client = getDefaultClient()\n): Promise<{ signedPsbts: string[] }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n return provider.signPsbts({ requests, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addBitcoinExtension } from '../addBitcoinExtension';\nexport type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';\nexport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nexport type {\n BitcoinAddressType,\n BitcoinSendTransactionResponse,\n BitcoinSignProtocol,\n BitcoinSignPsbtRequest,\n BitcoinTransaction,\n} from '../BitcoinWalletProvider.types';\nexport { InvalidPsbtError } from '../errors/InvalidPsbtError';\nexport { TransactionBroadcastFailedError } from '../errors/TransactionBroadcastFailedError';\nexport { TransactionRequiredError } from '../errors/TransactionRequiredError';\nexport { isBitcoinNetworkProvider } from '../isBitcoinNetworkProvider';\nexport { isBitcoinWalletAccount } from '../isBitcoinWalletAccount';\nexport { sendBitcoin } from '../sendBitcoin';\nexport { sendRawTransaction } from '../sendRawTransaction';\nexport { signMessageWithCustomOptions } from '../signMessageWithCustomOptions';\nexport { signPsbt } from '../signPsbt';\nexport { signPsbts } from '../signPsbts';\n"],"mappings":";;;;;;;;AAmBA,MAAa,sCACX,cAC8B;CAC9B,MAAM,QAAQ;CAEd,MAAM,qBAAqBA,8CAAmB;CAE9C,MAAM,iEAA8B;EAClC;EACA,aAAaC,yDAAsB;EACnC;EACD,CAAC;CAEF,MAAM,0EAAkC;EAAE;EAAO;EAAW,CAAC;CAE7D,MAAMC,qBACJ,uFAC0C;EACtC,QAAQ;EACR,mBAAmB;EACpB,CAAC;CAEN,MAAMC,sBACJ,OAAO,EAAE,0FACgC;EACrC,QAAQ;EACR;EACA,mBAAmB;EACpB,CAAC;CAEN,MAAMC,wBACJ,YAAY;AAMV,SAAO,EACL,mFALA,EAAE,OAAO,EACT,UACD,EAIA;;CAGL,MAAMC,aAAkD,OAAO,EAC7D,SAAS,UACT,oBACI;AACJ,mDAAc,eAAe,6BAA6B;AAC1D,QAAM,IAAIC,wDAA0B,WAAW;;CAGjD,MAAMC,cAAoD,OAAO,EAC/D,UAAU,WACV,eAAe,qBACX;AACJ,QAAM,IAAID,wDAA0B,YAAY;;CAGlD,MAAME,gBAAwD,OAAO,EACnE,aAAa,cACb,oBAC6C;AAC7C,mDAAc,eAA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EACD,OACD;AAED,KAAI,CAAC,wBAAwB,SAAS,CACpC,OAAM,IAAI,wBAAwB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGlE,KAAI,CAAC,SAAS,YACZ,OAAM,IAAIC,wDAA0B,cAAc;AAGpD,QAAO,SAAS,YAAY;EAC1B;EACA;EACA;EACA;EACD,CAAC;;;;;;;;;;;;AC5CJ,MAAa,WAAW,OACtB,EAAE,eAAe,WACjB,yDAA2B,KACS;CACpC,MAAM,iFACJ,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,wBAAwB,SAAS,CACpC,OAAM,IAAI,wBAAwB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGlE,QAAO,SAAS,SAAS;EAAE;EAAS;EAAe,CAAC;;;;;;;;;;;;ACftD,MAAa,YAAY,OACvB,EAAE,eAAe,YACjB,yDAA2B,KACY;CACvC,MAAM,iFACJ,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,wBAAwB,SAAS,CACpC,OAAM,IAAI,wBAAwB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGlE,QAAO,SAAS,UAAU;EAAE;EAAU;EAAe,CAAC;;;;;mEC7BnCC,iDAAaC,mDAAe"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,19 +1,139 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as name, i as getMempoolApiUrl, n as InvalidPsbtError, o as version, r as registerBitcoinNetworkProviderBuilder, t as addBitcoinInjectedWalletsExtension } from "./addBitcoinInjectedWalletsExtension-BjijCDrr.esm.js";
|
|
2
2
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
3
|
-
import { MethodNotImplementedError, getCore, getDefaultClient, getWalletProviderFromWalletAccount } from "@dynamic-labs-sdk/client/core";
|
|
3
|
+
import { MethodNotImplementedError, WalletProviderPriority, assertDefined, formatWalletProviderGroupKey, formatWalletProviderKey, getActiveNetworkIdFromLastKnownRegistry, getCore, getDefaultClient, getWalletProviderFromWalletAccount, getWalletProviderRegistry, hasExtension, registerExtension, switchActiveNetworkInLastKnownRegistry } from "@dynamic-labs-sdk/client/core";
|
|
4
4
|
import { BaseError, getDefaultClient as getDefaultClient$1 } from "@dynamic-labs-sdk/client";
|
|
5
|
+
import { WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
6
|
+
import { DYNAMIC_WAAS_METADATA, createWaasProvider, getAllUserWaasAddressesForChain } from "@dynamic-labs-sdk/client/waas/core";
|
|
5
7
|
|
|
8
|
+
//#region src/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.ts
|
|
9
|
+
const createWalletProviderForWaasBitcoin = (sdkClient) => {
|
|
10
|
+
const chain = "BTC";
|
|
11
|
+
const walletProviderType = WalletProviderEnum.EmbeddedWallet;
|
|
12
|
+
const key = formatWalletProviderKey({
|
|
13
|
+
chain,
|
|
14
|
+
displayName: DYNAMIC_WAAS_METADATA.displayName,
|
|
15
|
+
walletProviderType
|
|
16
|
+
});
|
|
17
|
+
const waasProvider = createWaasProvider({
|
|
18
|
+
chain,
|
|
19
|
+
sdkClient
|
|
20
|
+
});
|
|
21
|
+
const getActiveNetworkId = async () => getActiveNetworkIdFromLastKnownRegistry({
|
|
22
|
+
client: sdkClient,
|
|
23
|
+
walletProviderKey: key
|
|
24
|
+
});
|
|
25
|
+
const switchActiveNetwork = async ({ networkId }) => switchActiveNetworkInLastKnownRegistry({
|
|
26
|
+
client: sdkClient,
|
|
27
|
+
networkId,
|
|
28
|
+
walletProviderKey: key
|
|
29
|
+
});
|
|
30
|
+
const getConnectedAddresses = async () => {
|
|
31
|
+
return { addresses: getAllUserWaasAddressesForChain({ chain }, sdkClient) };
|
|
32
|
+
};
|
|
33
|
+
const signPsbt$1 = async ({ request: _request, walletAccount }) => {
|
|
34
|
+
assertDefined(walletAccount, "Wallet account is required");
|
|
35
|
+
throw new MethodNotImplementedError("signPsbt");
|
|
36
|
+
};
|
|
37
|
+
const signPsbts$1 = async ({ requests: _requests, walletAccount: _walletAccount }) => {
|
|
38
|
+
throw new MethodNotImplementedError("signPsbts");
|
|
39
|
+
};
|
|
40
|
+
const sendBitcoin$1 = async ({ transaction: _transaction, walletAccount }) => {
|
|
41
|
+
assertDefined(walletAccount, "Wallet account is required");
|
|
42
|
+
throw new MethodNotImplementedError("sendBitcoin");
|
|
43
|
+
};
|
|
44
|
+
const signMessage = async ({ message: _message, walletAccount, addressType: _addressType, protocol: _protocol }) => {
|
|
45
|
+
assertDefined(walletAccount, "Wallet account is required");
|
|
46
|
+
throw new MethodNotImplementedError("signMessage");
|
|
47
|
+
};
|
|
48
|
+
return {
|
|
49
|
+
...waasProvider,
|
|
50
|
+
chain,
|
|
51
|
+
getActiveNetworkId,
|
|
52
|
+
getConnectedAddresses,
|
|
53
|
+
groupKey: formatWalletProviderGroupKey(DYNAMIC_WAAS_METADATA.displayName),
|
|
54
|
+
key,
|
|
55
|
+
metadata: {
|
|
56
|
+
displayName: DYNAMIC_WAAS_METADATA.displayName,
|
|
57
|
+
icon: DYNAMIC_WAAS_METADATA.icon
|
|
58
|
+
},
|
|
59
|
+
sendBitcoin: sendBitcoin$1,
|
|
60
|
+
signMessage,
|
|
61
|
+
signPsbt: signPsbt$1,
|
|
62
|
+
signPsbts: signPsbts$1,
|
|
63
|
+
switchActiveNetwork,
|
|
64
|
+
walletProviderType
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
//#region src/waas/addWaasBitcoinExtension/addWaasBitcoinExtension.ts
|
|
70
|
+
const WAAS_BITCOIN_EXTENSION_KEY = "waasBitcoin";
|
|
71
|
+
/**
|
|
72
|
+
* Adds the Dynamic WaaS (Wallet as a Service) Bitcoin extension to the Dynamic client.
|
|
73
|
+
*
|
|
74
|
+
* This extension enables embedded wallet functionality for Bitcoin blockchain,
|
|
75
|
+
* allowing users to have wallets managed by Dynamic's infrastructure.
|
|
76
|
+
*
|
|
77
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
78
|
+
*/
|
|
79
|
+
const addWaasBitcoinExtension = (client = getDefaultClient()) => {
|
|
80
|
+
if (hasExtension({ extensionKey: WAAS_BITCOIN_EXTENSION_KEY }, client)) return;
|
|
81
|
+
registerExtension({ extensionKey: WAAS_BITCOIN_EXTENSION_KEY }, client);
|
|
82
|
+
registerBitcoinNetworkProviderBuilder(client);
|
|
83
|
+
const walletProviderRegistry = getWalletProviderRegistry(client);
|
|
84
|
+
const walletProvider = createWalletProviderForWaasBitcoin(client);
|
|
85
|
+
walletProviderRegistry.register({
|
|
86
|
+
priority: WalletProviderPriority.WALLET_SDK,
|
|
87
|
+
walletProvider
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
6
92
|
//#region src/addBitcoinExtension/addBitcoinExtension.ts
|
|
7
93
|
/**
|
|
8
94
|
* Adds the Bitcoin extension to the Dynamic client.
|
|
9
95
|
*
|
|
10
|
-
* This is a convenience function that adds
|
|
11
|
-
*
|
|
96
|
+
* This is a convenience function that adds both the Bitcoin Injected Wallets extension
|
|
97
|
+
* and the Dynamic WaaS Bitcoin extension, enabling support for all Bitcoin wallet types
|
|
98
|
+
* including injected wallets (MagicEden, Xverse, Unisat, and more) and embedded wallets
|
|
99
|
+
* managed by Dynamic's infrastructure.
|
|
12
100
|
*
|
|
13
101
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
14
102
|
*/
|
|
15
103
|
const addBitcoinExtension = (client = getDefaultClient()) => {
|
|
16
104
|
addBitcoinInjectedWalletsExtension(client);
|
|
105
|
+
addWaasBitcoinExtension(client);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/errors/TransactionBroadcastFailedError.ts
|
|
110
|
+
var TransactionBroadcastFailedError = class extends BaseError {
|
|
111
|
+
response;
|
|
112
|
+
constructor({ response }) {
|
|
113
|
+
super({
|
|
114
|
+
cause: null,
|
|
115
|
+
code: "transaction_broadcast_failed_error",
|
|
116
|
+
details: `Status: ${response.status} ${response.statusText}`,
|
|
117
|
+
docsUrl: null,
|
|
118
|
+
name: "TransactionBroadcastFailedError",
|
|
119
|
+
shortMessage: "Failed to broadcast transaction to mempool"
|
|
120
|
+
});
|
|
121
|
+
this.response = response;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/errors/TransactionRequiredError.ts
|
|
127
|
+
var TransactionRequiredError = class extends BaseError {
|
|
128
|
+
constructor() {
|
|
129
|
+
super({
|
|
130
|
+
cause: null,
|
|
131
|
+
code: "transaction_required_error",
|
|
132
|
+
docsUrl: null,
|
|
133
|
+
name: "TransactionRequiredError",
|
|
134
|
+
shortMessage: "No transaction specified for broadcast"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
17
137
|
};
|
|
18
138
|
|
|
19
139
|
//#endregion
|
|
@@ -182,5 +302,5 @@ const signPsbts = async ({ walletAccount, requests }, client = getDefaultClient$
|
|
|
182
302
|
assertPackageVersion(name, version);
|
|
183
303
|
|
|
184
304
|
//#endregion
|
|
185
|
-
export { InvalidPsbtError, addBitcoinExtension, isBitcoinNetworkProvider, isBitcoinWalletAccount, sendBitcoin, sendRawTransaction, signMessageWithCustomOptions, signPsbt, signPsbts };
|
|
305
|
+
export { InvalidPsbtError, TransactionBroadcastFailedError, TransactionRequiredError, addBitcoinExtension, isBitcoinNetworkProvider, isBitcoinWalletAccount, sendBitcoin, sendRawTransaction, signMessageWithCustomOptions, signPsbt, signPsbts };
|
|
186
306
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","names":["getDefaultClient","getDefaultClient","getDefaultClient","getDefaultClient","getDefaultClient","packageName","packageVersion"],"sources":["../src/addBitcoinExtension/addBitcoinExtension.ts","../src/isBitcoinNetworkProvider/isBitcoinNetworkProvider.ts","../src/isBitcoinWalletAccount/isBitcoinWalletAccount.ts","../src/errors/NotBitcoinProviderError.ts","../src/isBitcoinWalletProvider/isBitcoinWalletProvider.ts","../src/sendBitcoin/sendBitcoin.ts","../src/errors/SendBitcoinRawTransactionError.ts","../src/sendRawTransaction/sendRawTransaction.ts","../src/signMessageWithCustomOptions/signMessageWithCustomOptions.ts","../src/signPsbt/signPsbt.ts","../src/signPsbts/signPsbts.ts","../src/exports/index.ts"],"sourcesContent":["import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addBitcoinInjectedWalletsExtension } from '../injected/addBitcoinInjectedWalletsExtension';\n\n/**\n * Adds the Bitcoin extension to the Dynamic client.\n *\n * This is a convenience function that adds support for a variety of Bitcoin wallets,\n * like MagicEden, Xverse, Unisat, and more.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\n\nexport const addBitcoinExtension = (client = getDefaultClient()): void => {\n addBitcoinInjectedWalletsExtension(client);\n};\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';\n\n/**\n * Type guard function to check if a network provider is a Bitcoin network provider.\n *\n * @param networkProvider - The network provider to check.\n * @returns True if the network provider is a Bitcoin network provider, false otherwise.\n */\nexport const isBitcoinNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is BitcoinNetworkProvider => networkProvider.chain === 'BTC';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\n\n/**\n * Type guard function to check if a wallet account is a Bitcoin wallet account.\n *\n * @param walletAccount - The wallet account to check.\n * @returns True if the wallet account is a Bitcoin wallet account, false otherwise.\n */\nexport const isBitcoinWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is BitcoinWalletAccount => walletAccount.chain === 'BTC';\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotBitcoinProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_bitcoin_provider_error',\n docsUrl: null,\n name: 'NotBitcoinProviderError',\n shortMessage: 'Provider is not a Bitcoin wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletProvider } from '../BitcoinWalletProvider.types';\n\nexport const isBitcoinWalletProvider = (\n provider: WalletProvider\n): provider is BitcoinWalletProvider => {\n return provider.chain === 'BTC';\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type {\n BitcoinSendTransactionResponse,\n BitcoinTransaction,\n} from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SendBitcoinParams = {\n transaction: BitcoinTransaction;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Sends a Bitcoin transaction\n * @param params.transaction - The transaction to send\n * @param params.walletAccount - The wallet account to send the transaction from\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the transaction id\n * @throws {MethodNotImplementedError} If the wallet provider does not implement the sendBitcoin method\n * @throws {NotBitcoinProviderError} If the wallet account is not a valid BitcoinWalletAccount\n */\nexport const sendBitcoin = async (\n { walletAccount, transaction }: SendBitcoinParams,\n client = getDefaultClient()\n): Promise<BitcoinSendTransactionResponse> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n if (!provider.sendBitcoin) {\n throw new MethodNotImplementedError('sendBitcoin');\n }\n\n return provider.sendBitcoin({ transaction, walletAccount });\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\ntype SendBitcoinRawTransactionErrorParams = {\n originalError: unknown;\n};\n\nexport class SendBitcoinRawTransactionError extends BaseError {\n constructor({ originalError }: SendBitcoinRawTransactionErrorParams) {\n const cause = originalError instanceof Error ? originalError : null;\n\n super({\n cause,\n code: 'send_bitcoin_raw_transaction_error',\n docsUrl: null,\n name: 'SendBitcoinRawTransactionError',\n shortMessage: 'Failed to send Bitcoin raw transaction',\n });\n }\n}\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getCore } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport { SendBitcoinRawTransactionError } from '../errors/SendBitcoinRawTransactionError';\nimport { getMempoolApiUrl } from '../utils/getMempoolApiUrl';\n\ntype SendRawTransactionParams = {\n rawTransaction: string;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Sends a raw transaction using the mempool.space API\n * @param params.rawTransaction - The raw transaction to send\n * @param params.walletAccount - The wallet account to send the transaction from\n * @returns An object containing the transaction id\n */\nexport const sendRawTransaction = async (\n { rawTransaction, walletAccount }: SendRawTransactionParams,\n client = getDefaultClient()\n): Promise<{\n transactionId: string;\n}> => {\n const fetchService = getCore(client).fetch;\n\n const API_URL = getMempoolApiUrl(walletAccount.address);\n\n const response = await fetchService(`${API_URL}/tx`, {\n body: rawTransaction,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n\n if (!response.ok) {\n throw new SendBitcoinRawTransactionError({\n originalError: await response.text(),\n });\n }\n\n // this endpoint returns the transaction ID\n const transactionId = await response.text();\n\n return { transactionId };\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type {\n BitcoinAddressType,\n BitcoinSignProtocol,\n} from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignMessageWithCustomOptionsParams = {\n addressType?: BitcoinAddressType;\n message: string;\n protocol?: BitcoinSignProtocol;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs a message with custom options, like a specific address type or protocol\n *\n * If the wallet provider does not support specifying an address type or protocol, it will use the default values.\n *\n * @param params.addressType - The address type to use for signing ('ordinals' or 'payment')\n * @param params.message - The message to sign\n * @param params.protocol - The protocol to use for signing ('ecdsa' or 'bip322-simple')\n * @param params.walletAccount - The wallet account to sign the message with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature\n * @throws {MethodNotImplementedError} If the wallet provider does not implement the signMessage method\n * @throws {NotBitcoinProviderError} If the wallet account is not a valid BitcoinWalletAccount\n */\nexport const signMessageWithCustomOptions = async (\n {\n walletAccount,\n message,\n protocol,\n addressType,\n }: SignMessageWithCustomOptionsParams,\n client = getDefaultClient()\n): Promise<{ signature: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n if (!provider.signMessage) {\n throw new MethodNotImplementedError('signMessage');\n }\n\n return provider.signMessage({\n addressType,\n message,\n protocol,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type { BitcoinSignPsbtRequest } from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignPsbtParams = {\n request: BitcoinSignPsbtRequest;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs a PSBT\n * @param params.request - The request data to sign the PSBT\n * @param params.walletAccount - The wallet account to sign the PSBT with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signed PSBT\n */\nexport const signPsbt = async (\n { walletAccount, request }: SignPsbtParams,\n client = getDefaultClient()\n): Promise<{ signedPsbt: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n return provider.signPsbt({ request, walletAccount });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type { BitcoinSignPsbtRequest } from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignPsbtsParams = {\n requests: BitcoinSignPsbtRequest[];\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs multiple PSBTs\n * @param params.requests - The list of request data to sign the PSBTs\n * @param params.walletAccount - The wallet account to sign the PSBT with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signed PSBT\n */\nexport const signPsbts = async (\n { walletAccount, requests }: SignPsbtsParams,\n client = getDefaultClient()\n): Promise<{ signedPsbts: string[] }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n return provider.signPsbts({ requests, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addBitcoinExtension } from '../addBitcoinExtension';\nexport type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';\nexport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nexport type {\n BitcoinAddressType,\n BitcoinSendTransactionResponse,\n BitcoinSignProtocol,\n BitcoinSignPsbtRequest,\n BitcoinTransaction,\n} from '../BitcoinWalletProvider.types';\nexport { InvalidPsbtError } from '../errors/InvalidPsbtError';\nexport { isBitcoinNetworkProvider } from '../isBitcoinNetworkProvider';\nexport { isBitcoinWalletAccount } from '../isBitcoinWalletAccount';\nexport { sendBitcoin } from '../sendBitcoin';\nexport { sendRawTransaction } from '../sendRawTransaction';\nexport { signMessageWithCustomOptions } from '../signMessageWithCustomOptions';\nexport { signPsbt } from '../signPsbt';\nexport { signPsbts } from '../signPsbts';\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAa,uBAAuB,SAAS,kBAAkB,KAAW;AACxE,oCAAmC,OAAO;;;;;;;;;;;ACJ5C,MAAa,4BACX,oBAC8C,gBAAgB,UAAU;;;;;;;;;;ACF1E,MAAa,0BACX,kBAC0C,cAAc,UAAU;;;;ACVpE,IAAa,0BAAb,cAA6C,UAAU;CACrD,AAAgB;CAEhB,YAAY,QAAiC;AAC3C,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;GACT,MAAM;GACN,cAAc;GACf,CAAC;AAEF,OAAK,cAAc,OAAO;;;;;;ACV9B,MAAa,2BACX,aACsC;AACtC,QAAO,SAAS,UAAU;;;;;;;;;;;;;;ACqB5B,MAAa,cAAc,OACzB,EAAE,eAAe,eACjB,SAASA,oBAAkB,KACiB;CAC5C,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,wBAAwB,SAAS,CACpC,OAAM,IAAI,wBAAwB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGlE,KAAI,CAAC,SAAS,YACZ,OAAM,IAAI,0BAA0B,cAAc;AAGpD,QAAO,SAAS,YAAY;EAAE;EAAa;EAAe,CAAC;;;;;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B,SAASC,oBAAkB,KACY;CACvC,MAAM,WAAW,mCACf,EACE,eACD,EACD,OACD;AAED,KAAI,CAAC,wBAAwB,SAAS,CACpC,OAAM,IAAI,wBAAwB,EAAE,aAAa,SAAS,KAAK,CAAC;AAGlE,QAAO,SAAS,UAAU;EAAE;EAAU;EAAe,CAAC;;;;;AC7BxD,qBAAqBC,MAAaC,QAAe"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","names":["getActiveNetworkId: WaasBitcoinWalletProvider['getActiveNetworkId']","switchActiveNetwork: WaasBitcoinWalletProvider['switchActiveNetwork']","getConnectedAddresses: WaasBitcoinWalletProvider['getConnectedAddresses']","signPsbt: WaasBitcoinWalletProvider['signPsbt']","signPsbts: WaasBitcoinWalletProvider['signPsbts']","sendBitcoin: WaasBitcoinWalletProvider['sendBitcoin']","signMessage: WaasBitcoinWalletProvider['signMessage']","getDefaultClient","getDefaultClient","getDefaultClient","getDefaultClient","getDefaultClient","packageName","packageVersion"],"sources":["../src/waas/utils/createWalletProviderForWaasBitcoin/createWalletProviderForWaasBitcoin.ts","../src/waas/addWaasBitcoinExtension/addWaasBitcoinExtension.ts","../src/addBitcoinExtension/addBitcoinExtension.ts","../src/errors/TransactionBroadcastFailedError.ts","../src/errors/TransactionRequiredError.ts","../src/isBitcoinNetworkProvider/isBitcoinNetworkProvider.ts","../src/isBitcoinWalletAccount/isBitcoinWalletAccount.ts","../src/errors/NotBitcoinProviderError.ts","../src/isBitcoinWalletProvider/isBitcoinWalletProvider.ts","../src/sendBitcoin/sendBitcoin.ts","../src/errors/SendBitcoinRawTransactionError.ts","../src/sendRawTransaction/sendRawTransaction.ts","../src/signMessageWithCustomOptions/signMessageWithCustomOptions.ts","../src/signPsbt/signPsbt.ts","../src/signPsbts/signPsbts.ts","../src/exports/index.ts"],"sourcesContent":["import type { DynamicClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n assertDefined,\n formatWalletProviderGroupKey,\n formatWalletProviderKey,\n getActiveNetworkIdFromLastKnownRegistry,\n switchActiveNetworkInLastKnownRegistry,\n} from '@dynamic-labs-sdk/client/core';\nimport {\n DYNAMIC_WAAS_METADATA,\n createWaasProvider,\n getAllUserWaasAddressesForChain,\n} from '@dynamic-labs-sdk/client/waas/core';\nimport { WalletProviderEnum } from '@dynamic-labs/sdk-api-core';\n\nimport type { BitcoinSendTransactionResponse } from '../../../BitcoinWalletProvider.types';\nimport type { WaasBitcoinWalletProvider } from '../../WaasBitcoinWalletProvider.types';\n\nexport const createWalletProviderForWaasBitcoin = (\n sdkClient: DynamicClient\n): WaasBitcoinWalletProvider => {\n const chain = 'BTC' as const;\n\n const walletProviderType = WalletProviderEnum.EmbeddedWallet;\n\n const key = formatWalletProviderKey({\n chain,\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n walletProviderType,\n });\n\n const waasProvider = createWaasProvider({ chain, sdkClient });\n\n const getActiveNetworkId: WaasBitcoinWalletProvider['getActiveNetworkId'] =\n async () =>\n getActiveNetworkIdFromLastKnownRegistry({\n client: sdkClient,\n walletProviderKey: key,\n });\n\n const switchActiveNetwork: WaasBitcoinWalletProvider['switchActiveNetwork'] =\n async ({ networkId }) =>\n switchActiveNetworkInLastKnownRegistry({\n client: sdkClient,\n networkId,\n walletProviderKey: key,\n });\n\n const getConnectedAddresses: WaasBitcoinWalletProvider['getConnectedAddresses'] =\n async () => {\n const waasBitcoinAddresses = getAllUserWaasAddressesForChain(\n { chain },\n sdkClient\n );\n\n return {\n addresses: waasBitcoinAddresses,\n };\n };\n\n const signPsbt: WaasBitcoinWalletProvider['signPsbt'] = async ({\n request: _request,\n walletAccount,\n }) => {\n assertDefined(walletAccount, 'Wallet account is required');\n throw new MethodNotImplementedError('signPsbt');\n };\n\n const signPsbts: WaasBitcoinWalletProvider['signPsbts'] = async ({\n requests: _requests,\n walletAccount: _walletAccount,\n }) => {\n throw new MethodNotImplementedError('signPsbts');\n };\n\n const sendBitcoin: WaasBitcoinWalletProvider['sendBitcoin'] = async ({\n transaction: _transaction,\n walletAccount,\n }): Promise<BitcoinSendTransactionResponse> => {\n assertDefined(walletAccount, 'Wallet account is required');\n throw new MethodNotImplementedError('sendBitcoin');\n };\n\n const signMessage: WaasBitcoinWalletProvider['signMessage'] = async ({\n message: _message,\n walletAccount,\n addressType: _addressType,\n protocol: _protocol,\n }) => {\n assertDefined(walletAccount, 'Wallet account is required');\n throw new MethodNotImplementedError('signMessage');\n };\n\n return {\n ...waasProvider,\n chain,\n getActiveNetworkId,\n getConnectedAddresses,\n groupKey: formatWalletProviderGroupKey(DYNAMIC_WAAS_METADATA.displayName),\n key,\n metadata: {\n displayName: DYNAMIC_WAAS_METADATA.displayName,\n icon: DYNAMIC_WAAS_METADATA.icon,\n },\n sendBitcoin,\n signMessage,\n signPsbt,\n signPsbts,\n switchActiveNetwork,\n walletProviderType,\n };\n};\n\n","import {\n WalletProviderPriority,\n getDefaultClient,\n getWalletProviderRegistry,\n hasExtension,\n registerExtension,\n} from '@dynamic-labs-sdk/client/core';\n\nimport { registerBitcoinNetworkProviderBuilder } from '../../registerBitcoinNetworkProviderBuilder';\nimport { createWalletProviderForWaasBitcoin } from '../utils/createWalletProviderForWaasBitcoin';\n\nexport const WAAS_BITCOIN_EXTENSION_KEY = 'waasBitcoin';\n\n/**\n * Adds the Dynamic WaaS (Wallet as a Service) Bitcoin extension to the Dynamic client.\n *\n * This extension enables embedded wallet functionality for Bitcoin blockchain,\n * allowing users to have wallets managed by Dynamic's infrastructure.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\nexport const addWaasBitcoinExtension = (client = getDefaultClient()): void => {\n if (hasExtension({ extensionKey: WAAS_BITCOIN_EXTENSION_KEY }, client)) {\n return;\n }\n\n registerExtension({ extensionKey: WAAS_BITCOIN_EXTENSION_KEY }, client);\n registerBitcoinNetworkProviderBuilder(client);\n\n const walletProviderRegistry = getWalletProviderRegistry(client);\n\n const walletProvider = createWalletProviderForWaasBitcoin(client);\n\n walletProviderRegistry.register({\n priority: WalletProviderPriority.WALLET_SDK,\n walletProvider,\n });\n};\n\n","import { getDefaultClient } from '@dynamic-labs-sdk/client/core';\n\nimport { addBitcoinInjectedWalletsExtension } from '../injected/addBitcoinInjectedWalletsExtension';\nimport { addWaasBitcoinExtension } from '../waas/addWaasBitcoinExtension';\n\n/**\n * Adds the Bitcoin extension to the Dynamic client.\n *\n * This is a convenience function that adds both the Bitcoin Injected Wallets extension\n * and the Dynamic WaaS Bitcoin extension, enabling support for all Bitcoin wallet types\n * including injected wallets (MagicEden, Xverse, Unisat, and more) and embedded wallets\n * managed by Dynamic's infrastructure.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n */\n\nexport const addBitcoinExtension = (client = getDefaultClient()): void => {\n addBitcoinInjectedWalletsExtension(client);\n addWaasBitcoinExtension(client);\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\ntype TransactionBroadcastFailedErrorParams = {\n response: Response;\n};\n\nexport class TransactionBroadcastFailedError extends BaseError {\n public readonly response: Response;\n\n constructor({ response }: TransactionBroadcastFailedErrorParams) {\n super({\n cause: null,\n code: 'transaction_broadcast_failed_error',\n details: `Status: ${response.status} ${response.statusText}`,\n docsUrl: null,\n name: 'TransactionBroadcastFailedError',\n shortMessage: 'Failed to broadcast transaction to mempool',\n });\n\n this.response = response;\n }\n}\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class TransactionRequiredError extends BaseError {\n constructor() {\n super({\n cause: null,\n code: 'transaction_required_error',\n docsUrl: null,\n name: 'TransactionRequiredError',\n shortMessage: 'No transaction specified for broadcast',\n });\n }\n}\n","import type { NetworkProvider } from '@dynamic-labs-sdk/client';\n\nimport type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';\n\n/**\n * Type guard function to check if a network provider is a Bitcoin network provider.\n *\n * @param networkProvider - The network provider to check.\n * @returns True if the network provider is a Bitcoin network provider, false otherwise.\n */\nexport const isBitcoinNetworkProvider = (\n networkProvider: NetworkProvider\n): networkProvider is BitcoinNetworkProvider => networkProvider.chain === 'BTC';\n","import type { WalletAccount } from '@dynamic-labs-sdk/client';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\n\n/**\n * Type guard function to check if a wallet account is a Bitcoin wallet account.\n *\n * @param walletAccount - The wallet account to check.\n * @returns True if the wallet account is a Bitcoin wallet account, false otherwise.\n */\nexport const isBitcoinWalletAccount = (\n walletAccount: WalletAccount\n): walletAccount is BitcoinWalletAccount => walletAccount.chain === 'BTC';\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\nexport class NotBitcoinProviderError extends BaseError {\n public readonly providerKey: string;\n\n constructor(params: { providerKey: string }) {\n super({\n cause: null,\n code: 'not_bitcoin_provider_error',\n docsUrl: null,\n name: 'NotBitcoinProviderError',\n shortMessage: 'Provider is not a Bitcoin wallet provider',\n });\n\n this.providerKey = params.providerKey;\n }\n}\n","import type { WalletProvider } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletProvider } from '../BitcoinWalletProvider.types';\n\nexport const isBitcoinWalletProvider = (\n provider: WalletProvider\n): provider is BitcoinWalletProvider => {\n return provider.chain === 'BTC';\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type {\n BitcoinSendTransactionResponse,\n BitcoinTransaction,\n} from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SendBitcoinParams = {\n transaction: BitcoinTransaction;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Sends a Bitcoin transaction\n * @param params.transaction - The transaction to send\n * @param params.walletAccount - The wallet account to send the transaction from\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the transaction id\n * @throws {MethodNotImplementedError} If the wallet provider does not implement the sendBitcoin method\n * @throws {NotBitcoinProviderError} If the wallet account is not a valid BitcoinWalletAccount\n */\nexport const sendBitcoin = async (\n { walletAccount, transaction }: SendBitcoinParams,\n client = getDefaultClient()\n): Promise<BitcoinSendTransactionResponse> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n if (!provider.sendBitcoin) {\n throw new MethodNotImplementedError('sendBitcoin');\n }\n\n return provider.sendBitcoin({ transaction, walletAccount });\n};\n","import { BaseError } from '@dynamic-labs-sdk/client';\n\ntype SendBitcoinRawTransactionErrorParams = {\n originalError: unknown;\n};\n\nexport class SendBitcoinRawTransactionError extends BaseError {\n constructor({ originalError }: SendBitcoinRawTransactionErrorParams) {\n const cause = originalError instanceof Error ? originalError : null;\n\n super({\n cause,\n code: 'send_bitcoin_raw_transaction_error',\n docsUrl: null,\n name: 'SendBitcoinRawTransactionError',\n shortMessage: 'Failed to send Bitcoin raw transaction',\n });\n }\n}\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getCore } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport { SendBitcoinRawTransactionError } from '../errors/SendBitcoinRawTransactionError';\nimport { getMempoolApiUrl } from '../utils/getMempoolApiUrl';\n\ntype SendRawTransactionParams = {\n rawTransaction: string;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Sends a raw transaction using the mempool.space API\n * @param params.rawTransaction - The raw transaction to send\n * @param params.walletAccount - The wallet account to send the transaction from\n * @returns An object containing the transaction id\n */\nexport const sendRawTransaction = async (\n { rawTransaction, walletAccount }: SendRawTransactionParams,\n client = getDefaultClient()\n): Promise<{\n transactionId: string;\n}> => {\n const fetchService = getCore(client).fetch;\n\n const API_URL = getMempoolApiUrl(walletAccount.address);\n\n const response = await fetchService(`${API_URL}/tx`, {\n body: rawTransaction,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded',\n },\n method: 'POST',\n });\n\n if (!response.ok) {\n throw new SendBitcoinRawTransactionError({\n originalError: await response.text(),\n });\n }\n\n // this endpoint returns the transaction ID\n const transactionId = await response.text();\n\n return { transactionId };\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport {\n MethodNotImplementedError,\n getWalletProviderFromWalletAccount,\n} from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type {\n BitcoinAddressType,\n BitcoinSignProtocol,\n} from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignMessageWithCustomOptionsParams = {\n addressType?: BitcoinAddressType;\n message: string;\n protocol?: BitcoinSignProtocol;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs a message with custom options, like a specific address type or protocol\n *\n * If the wallet provider does not support specifying an address type or protocol, it will use the default values.\n *\n * @param params.addressType - The address type to use for signing ('ordinals' or 'payment')\n * @param params.message - The message to sign\n * @param params.protocol - The protocol to use for signing ('ecdsa' or 'bip322-simple')\n * @param params.walletAccount - The wallet account to sign the message with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signature\n * @throws {MethodNotImplementedError} If the wallet provider does not implement the signMessage method\n * @throws {NotBitcoinProviderError} If the wallet account is not a valid BitcoinWalletAccount\n */\nexport const signMessageWithCustomOptions = async (\n {\n walletAccount,\n message,\n protocol,\n addressType,\n }: SignMessageWithCustomOptionsParams,\n client = getDefaultClient()\n): Promise<{ signature: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n if (!provider.signMessage) {\n throw new MethodNotImplementedError('signMessage');\n }\n\n return provider.signMessage({\n addressType,\n message,\n protocol,\n walletAccount,\n });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type { BitcoinSignPsbtRequest } from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignPsbtParams = {\n request: BitcoinSignPsbtRequest;\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs a PSBT\n * @param params.request - The request data to sign the PSBT\n * @param params.walletAccount - The wallet account to sign the PSBT with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signed PSBT\n */\nexport const signPsbt = async (\n { walletAccount, request }: SignPsbtParams,\n client = getDefaultClient()\n): Promise<{ signedPsbt: string }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n return provider.signPsbt({ request, walletAccount });\n};\n","import { getDefaultClient } from '@dynamic-labs-sdk/client';\nimport { getWalletProviderFromWalletAccount } from '@dynamic-labs-sdk/client/core';\n\nimport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nimport type { BitcoinSignPsbtRequest } from '../BitcoinWalletProvider.types';\nimport { NotBitcoinProviderError } from '../errors/NotBitcoinProviderError';\nimport { isBitcoinWalletProvider } from '../isBitcoinWalletProvider';\n\ntype SignPsbtsParams = {\n requests: BitcoinSignPsbtRequest[];\n walletAccount: BitcoinWalletAccount;\n};\n\n/**\n * Signs multiple PSBTs\n * @param params.requests - The list of request data to sign the PSBTs\n * @param params.walletAccount - The wallet account to sign the PSBT with\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns An object containing the signed PSBT\n */\nexport const signPsbts = async (\n { walletAccount, requests }: SignPsbtsParams,\n client = getDefaultClient()\n): Promise<{ signedPsbts: string[] }> => {\n const provider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n if (!isBitcoinWalletProvider(provider)) {\n throw new NotBitcoinProviderError({ providerKey: provider.key });\n }\n\n return provider.signPsbts({ requests, walletAccount });\n};\n","import { assertPackageVersion } from '@dynamic-labs-sdk/assert-package-version';\n\nimport {\n name as packageName,\n version as packageVersion,\n} from '../../package.json';\nassertPackageVersion(packageName, packageVersion);\n\nexport { addBitcoinExtension } from '../addBitcoinExtension';\nexport type { BitcoinNetworkProvider } from '../BitcoinNetworkProvider.types';\nexport type { BitcoinWalletAccount } from '../BitcoinWalletAccount.types';\nexport type {\n BitcoinAddressType,\n BitcoinSendTransactionResponse,\n BitcoinSignProtocol,\n BitcoinSignPsbtRequest,\n BitcoinTransaction,\n} from '../BitcoinWalletProvider.types';\nexport { InvalidPsbtError } from '../errors/InvalidPsbtError';\nexport { TransactionBroadcastFailedError } from '../errors/TransactionBroadcastFailedError';\nexport { TransactionRequiredError } from '../errors/TransactionRequiredError';\nexport { isBitcoinNetworkProvider } from '../isBitcoinNetworkProvider';\nexport { isBitcoinWalletAccount } from '../isBitcoinWalletAccount';\nexport { sendBitcoin } from '../sendBitcoin';\nexport { sendRawTransaction } from '../sendRawTransaction';\nexport { signMessageWithCustomOptions } from '../signMessageWithCustomOptions';\nexport { signPsbt } from '../signPsbt';\nexport { signPsbts } from '../signPsbts';\n"],"mappings":";;;;;;;;AAmBA,MAAa,sCACX,cAC8B;CAC9B,MAAM,QAAQ;CAEd,MAAM,qBAAqB,mBAAmB;CAE9C,MAAM,MAAM,wBAAwB;EAClC;EACA,aAAa,sBAAsB;EACnC;EACD,CAAC;CAEF,MAAM,eAAe,mBAAmB;EAAE;EAAO;EAAW,CAAC;CAE7D,MAAMA,qBACJ,YACE,wCAAwC;EACtC,QAAQ;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AAU;EAAe,CAAC;;;;;AC7BxD,qBAAqBC,MAAaC,QAAe"}
|
package/dist/injected.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_addBitcoinInjectedWalletsExtension = require('./addBitcoinInjectedWalletsExtension-
|
|
1
|
+
const require_addBitcoinInjectedWalletsExtension = require('./addBitcoinInjectedWalletsExtension-DNUJc7N7.cjs.js');
|
|
2
2
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
3
3
|
|
|
4
4
|
//#region src/exports/injected.ts
|
package/dist/injected.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as name, o as version, t as addBitcoinInjectedWalletsExtension } from "./addBitcoinInjectedWalletsExtension-BjijCDrr.esm.js";
|
|
2
2
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
3
3
|
|
|
4
4
|
//#region src/exports/injected.ts
|