@magic-ext/bitcoin 29.4.0 → 29.4.1-canary.1140.42877900768.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/cjs/index.js.map +2 -2
- package/dist/es/index.js.map +2 -2
- package/dist/es/index.mjs.map +2 -2
- package/dist/types/index.d.ts +11 -0
- package/dist/types/types.d.ts +3 -3
- package/package.json +2 -2
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["import { MultichainExtension } from '@magic-sdk/provider';\nimport {\n BitcoinConfig,\n BitcoinPayloadMethod,\n BitcoinSignedTransaction,\n BitcoinTransactionInput,\n BitcoinTransactionOutput,\n} from './types';\n\nexport * from './types';\n\nexport class BitcoinExtension extends MultichainExtension<'bitcoin'> {\n name = 'bitcoin' as const;\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super({\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n });\n }\n\n /**\n * Signs a Bitcoin transaction in the TEE. The caller supplies fully-formed\n * inputs (the UTXOs to spend, each with its value) and outputs; coin selection,\n * fee, and change are the caller's responsibility. Resolves with the\n * broadcast-ready signed transaction.\n */\n public async signTransaction(\n inputs: BitcoinTransactionInput[],\n outputs: BitcoinTransactionOutput[],\n ): Promise<BitcoinSignedTransaction> {\n return this.request<BitcoinSignedTransaction>(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [{ inputs, outputs }]),\n );\n }\n}\n", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n\n/**\n * A UTXO to spend. `value` is in BTC (not satoshis)
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAoC,+BCK7B,IAAKC,OACVA,EAAA,uBAAyB,sBADfA,OAAA,IDML,IAAMC,EAAN,cAA+B,qBAA+B,CAGnE,YAAmBC,EAA8B,CAC/C,MAAM,CACJ,OAAQA,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAASA,EAAc,OACzB,CACF,CAAC,EAPgB,mBAAAA,CAQnB,CAVA,KAAO,
|
|
4
|
+
"sourcesContent": ["import { MultichainExtension } from '@magic-sdk/provider';\nimport {\n BitcoinConfig,\n BitcoinPayloadMethod,\n BitcoinSignedTransaction,\n BitcoinTransactionInput,\n BitcoinTransactionOutput,\n} from './types';\n\nexport * from './types';\n\nexport class BitcoinExtension extends MultichainExtension<'bitcoin'> {\n name = 'bitcoin' as const;\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super({\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n });\n }\n\n /**\n * Signs a Bitcoin transaction in the TEE. The caller supplies fully-formed\n * inputs (the UTXOs to spend, each with its value) and outputs; coin selection,\n * fee, and change are the caller's responsibility. Resolves with the\n * broadcast-ready signed transaction.\n *\n * Input and output values are non-negative BTC amounts with at most eight\n * decimal places; tiny floating-point arithmetic errors (up to 0.001 sat)\n * are tolerated. Calculate fees and change in integer satoshis, then convert\n * to BTC for this method. Total outputs must not exceed total inputs; the\n * difference is the fee. There is no minimum or maximum\n * signing fee, and no dust threshold is enforced. The caller must check the\n * fee rate (sats/vB) and output amounts against the broadcasting node's\n * policy. Signing does not guarantee relay, confirmation, or UTXO availability.\n * Invalid transaction parameters reject with a MagicRPCError describing the\n * validation failure.\n */\n public async signTransaction(\n inputs: BitcoinTransactionInput[],\n outputs: BitcoinTransactionOutput[],\n ): Promise<BitcoinSignedTransaction> {\n return this.request<BitcoinSignedTransaction>(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [{ inputs, outputs }]),\n );\n }\n}\n", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n\n/**\n * A UTXO to spend. `value` is in BTC (not satoshis), with at most eight decimal\n * places. The enclave needs this value to compute its segwit (BIP143) sighash. `tx_num` is\n * the output index (vout) of the UTXO within its source transaction.\n */\nexport interface BitcoinTransactionInput {\n txid: string;\n tx_num: number;\n value: number;\n address?: string;\n}\n\n/** A transaction output. `value` is in BTC with at most eight decimal places. */\nexport interface BitcoinTransactionOutput {\n address: string;\n value: number;\n}\n\nexport interface BitcoinSignedTransaction {\n /** The broadcast-ready, fully-signed transaction as hex. */\n signedTransaction: string;\n /** The transaction hash (txid). */\n transactionHash: string;\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,sBAAAE,EAAA,yBAAAC,IAAA,eAAAC,EAAAJ,GAAA,IAAAK,EAAoC,+BCK7B,IAAKC,OACVA,EAAA,uBAAyB,sBADfA,OAAA,IDML,IAAMC,EAAN,cAA+B,qBAA+B,CAGnE,YAAmBC,EAA8B,CAC/C,MAAM,CACJ,OAAQA,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAASA,EAAc,OACzB,CACF,CAAC,EAPgB,mBAAAA,CAQnB,CAVA,KAAO,UA6BP,MAAa,gBACXC,EACAC,EACmC,CACnC,OAAO,KAAK,QACV,KAAK,MAAM,kDAAyE,CAAC,CAAE,OAAAD,EAAQ,QAAAC,CAAQ,CAAC,CAAC,CAC3G,CACF,CACF",
|
|
6
6
|
"names": ["index_exports", "__export", "BitcoinExtension", "BitcoinPayloadMethod", "__toCommonJS", "import_provider", "BitcoinPayloadMethod", "BitcoinExtension", "bitcoinConfig", "inputs", "outputs"]
|
|
7
7
|
}
|
package/dist/es/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["import { MultichainExtension } from '@magic-sdk/provider';\nimport {\n BitcoinConfig,\n BitcoinPayloadMethod,\n BitcoinSignedTransaction,\n BitcoinTransactionInput,\n BitcoinTransactionOutput,\n} from './types';\n\nexport * from './types';\n\nexport class BitcoinExtension extends MultichainExtension<'bitcoin'> {\n name = 'bitcoin' as const;\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super({\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n });\n }\n\n /**\n * Signs a Bitcoin transaction in the TEE. The caller supplies fully-formed\n * inputs (the UTXOs to spend, each with its value) and outputs; coin selection,\n * fee, and change are the caller's responsibility. Resolves with the\n * broadcast-ready signed transaction.\n */\n public async signTransaction(\n inputs: BitcoinTransactionInput[],\n outputs: BitcoinTransactionOutput[],\n ): Promise<BitcoinSignedTransaction> {\n return this.request<BitcoinSignedTransaction>(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [{ inputs, outputs }]),\n );\n }\n}\n", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n\n/**\n * A UTXO to spend. `value` is in BTC (not satoshis)
|
|
5
|
-
"mappings": "AAAA,OAAS,uBAAAA,MAA2B,sBCK7B,IAAKC,OACVA,EAAA,uBAAyB,sBADfA,OAAA,IDML,IAAMC,EAAN,cAA+BC,CAA+B,CAGnE,YAAmBC,EAA8B,CAC/C,MAAM,CACJ,OAAQA,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAASA,EAAc,OACzB,CACF,CAAC,EAPgB,mBAAAA,CAQnB,CAVA,KAAO,
|
|
4
|
+
"sourcesContent": ["import { MultichainExtension } from '@magic-sdk/provider';\nimport {\n BitcoinConfig,\n BitcoinPayloadMethod,\n BitcoinSignedTransaction,\n BitcoinTransactionInput,\n BitcoinTransactionOutput,\n} from './types';\n\nexport * from './types';\n\nexport class BitcoinExtension extends MultichainExtension<'bitcoin'> {\n name = 'bitcoin' as const;\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super({\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n });\n }\n\n /**\n * Signs a Bitcoin transaction in the TEE. The caller supplies fully-formed\n * inputs (the UTXOs to spend, each with its value) and outputs; coin selection,\n * fee, and change are the caller's responsibility. Resolves with the\n * broadcast-ready signed transaction.\n *\n * Input and output values are non-negative BTC amounts with at most eight\n * decimal places; tiny floating-point arithmetic errors (up to 0.001 sat)\n * are tolerated. Calculate fees and change in integer satoshis, then convert\n * to BTC for this method. Total outputs must not exceed total inputs; the\n * difference is the fee. There is no minimum or maximum\n * signing fee, and no dust threshold is enforced. The caller must check the\n * fee rate (sats/vB) and output amounts against the broadcasting node's\n * policy. Signing does not guarantee relay, confirmation, or UTXO availability.\n * Invalid transaction parameters reject with a MagicRPCError describing the\n * validation failure.\n */\n public async signTransaction(\n inputs: BitcoinTransactionInput[],\n outputs: BitcoinTransactionOutput[],\n ): Promise<BitcoinSignedTransaction> {\n return this.request<BitcoinSignedTransaction>(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [{ inputs, outputs }]),\n );\n }\n}\n", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n\n/**\n * A UTXO to spend. `value` is in BTC (not satoshis), with at most eight decimal\n * places. The enclave needs this value to compute its segwit (BIP143) sighash. `tx_num` is\n * the output index (vout) of the UTXO within its source transaction.\n */\nexport interface BitcoinTransactionInput {\n txid: string;\n tx_num: number;\n value: number;\n address?: string;\n}\n\n/** A transaction output. `value` is in BTC with at most eight decimal places. */\nexport interface BitcoinTransactionOutput {\n address: string;\n value: number;\n}\n\nexport interface BitcoinSignedTransaction {\n /** The broadcast-ready, fully-signed transaction as hex. */\n signedTransaction: string;\n /** The transaction hash (txid). */\n transactionHash: string;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,uBAAAA,MAA2B,sBCK7B,IAAKC,OACVA,EAAA,uBAAyB,sBADfA,OAAA,IDML,IAAMC,EAAN,cAA+BC,CAA+B,CAGnE,YAAmBC,EAA8B,CAC/C,MAAM,CACJ,OAAQA,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAASA,EAAc,OACzB,CACF,CAAC,EAPgB,mBAAAA,CAQnB,CAVA,KAAO,UA6BP,MAAa,gBACXC,EACAC,EACmC,CACnC,OAAO,KAAK,QACV,KAAK,MAAM,kDAAyE,CAAC,CAAE,OAAAD,EAAQ,QAAAC,CAAQ,CAAC,CAAC,CAC3G,CACF,CACF",
|
|
6
6
|
"names": ["MultichainExtension", "BitcoinPayloadMethod", "BitcoinExtension", "MultichainExtension", "bitcoinConfig", "inputs", "outputs"]
|
|
7
7
|
}
|
package/dist/es/index.mjs.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts", "../../src/types.ts"],
|
|
4
|
-
"sourcesContent": ["import { MultichainExtension } from '@magic-sdk/provider';\nimport {\n BitcoinConfig,\n BitcoinPayloadMethod,\n BitcoinSignedTransaction,\n BitcoinTransactionInput,\n BitcoinTransactionOutput,\n} from './types';\n\nexport * from './types';\n\nexport class BitcoinExtension extends MultichainExtension<'bitcoin'> {\n name = 'bitcoin' as const;\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super({\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n });\n }\n\n /**\n * Signs a Bitcoin transaction in the TEE. The caller supplies fully-formed\n * inputs (the UTXOs to spend, each with its value) and outputs; coin selection,\n * fee, and change are the caller's responsibility. Resolves with the\n * broadcast-ready signed transaction.\n */\n public async signTransaction(\n inputs: BitcoinTransactionInput[],\n outputs: BitcoinTransactionOutput[],\n ): Promise<BitcoinSignedTransaction> {\n return this.request<BitcoinSignedTransaction>(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [{ inputs, outputs }]),\n );\n }\n}\n", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n\n/**\n * A UTXO to spend. `value` is in BTC (not satoshis)
|
|
5
|
-
"mappings": "AAAA,OAAS,uBAAAA,MAA2B,sBCK7B,IAAKC,OACVA,EAAA,uBAAyB,sBADfA,OAAA,IDML,IAAMC,EAAN,cAA+BC,CAA+B,CAGnE,YAAmBC,EAA8B,CAC/C,MAAM,CACJ,OAAQA,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAASA,EAAc,OACzB,CACF,CAAC,EAPgB,mBAAAA,CAQnB,CAVA,KAAO,
|
|
4
|
+
"sourcesContent": ["import { MultichainExtension } from '@magic-sdk/provider';\nimport {\n BitcoinConfig,\n BitcoinPayloadMethod,\n BitcoinSignedTransaction,\n BitcoinTransactionInput,\n BitcoinTransactionOutput,\n} from './types';\n\nexport * from './types';\n\nexport class BitcoinExtension extends MultichainExtension<'bitcoin'> {\n name = 'bitcoin' as const;\n\n constructor(public bitcoinConfig: BitcoinConfig) {\n super({\n rpcUrl: bitcoinConfig.rpcUrl,\n chainType: 'BITCOIN',\n options: {\n network: bitcoinConfig.network,\n },\n });\n }\n\n /**\n * Signs a Bitcoin transaction in the TEE. The caller supplies fully-formed\n * inputs (the UTXOs to spend, each with its value) and outputs; coin selection,\n * fee, and change are the caller's responsibility. Resolves with the\n * broadcast-ready signed transaction.\n *\n * Input and output values are non-negative BTC amounts with at most eight\n * decimal places; tiny floating-point arithmetic errors (up to 0.001 sat)\n * are tolerated. Calculate fees and change in integer satoshis, then convert\n * to BTC for this method. Total outputs must not exceed total inputs; the\n * difference is the fee. There is no minimum or maximum\n * signing fee, and no dust threshold is enforced. The caller must check the\n * fee rate (sats/vB) and output amounts against the broadcasting node's\n * policy. Signing does not guarantee relay, confirmation, or UTXO availability.\n * Invalid transaction parameters reject with a MagicRPCError describing the\n * validation failure.\n */\n public async signTransaction(\n inputs: BitcoinTransactionInput[],\n outputs: BitcoinTransactionOutput[],\n ): Promise<BitcoinSignedTransaction> {\n return this.request<BitcoinSignedTransaction>(\n this.utils.createJsonRpcRequestPayload(BitcoinPayloadMethod.BitcoinSignTransaction, [{ inputs, outputs }]),\n );\n }\n}\n", "export interface BitcoinConfig {\n rpcUrl: string;\n network: string;\n}\n\nexport enum BitcoinPayloadMethod {\n BitcoinSignTransaction = 'btc_signTransaction',\n}\n\n/**\n * A UTXO to spend. `value` is in BTC (not satoshis), with at most eight decimal\n * places. The enclave needs this value to compute its segwit (BIP143) sighash. `tx_num` is\n * the output index (vout) of the UTXO within its source transaction.\n */\nexport interface BitcoinTransactionInput {\n txid: string;\n tx_num: number;\n value: number;\n address?: string;\n}\n\n/** A transaction output. `value` is in BTC with at most eight decimal places. */\nexport interface BitcoinTransactionOutput {\n address: string;\n value: number;\n}\n\nexport interface BitcoinSignedTransaction {\n /** The broadcast-ready, fully-signed transaction as hex. */\n signedTransaction: string;\n /** The transaction hash (txid). */\n transactionHash: string;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,uBAAAA,MAA2B,sBCK7B,IAAKC,OACVA,EAAA,uBAAyB,sBADfA,OAAA,IDML,IAAMC,EAAN,cAA+BC,CAA+B,CAGnE,YAAmBC,EAA8B,CAC/C,MAAM,CACJ,OAAQA,EAAc,OACtB,UAAW,UACX,QAAS,CACP,QAASA,EAAc,OACzB,CACF,CAAC,EAPgB,mBAAAA,CAQnB,CAVA,KAAO,UA6BP,MAAa,gBACXC,EACAC,EACmC,CACnC,OAAO,KAAK,QACV,KAAK,MAAM,kDAAyE,CAAC,CAAE,OAAAD,EAAQ,QAAAC,CAAQ,CAAC,CAAC,CAC3G,CACF,CACF",
|
|
6
6
|
"names": ["MultichainExtension", "BitcoinPayloadMethod", "BitcoinExtension", "MultichainExtension", "bitcoinConfig", "inputs", "outputs"]
|
|
7
7
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,6 +10,17 @@ export declare class BitcoinExtension extends MultichainExtension<'bitcoin'> {
|
|
|
10
10
|
* inputs (the UTXOs to spend, each with its value) and outputs; coin selection,
|
|
11
11
|
* fee, and change are the caller's responsibility. Resolves with the
|
|
12
12
|
* broadcast-ready signed transaction.
|
|
13
|
+
*
|
|
14
|
+
* Input and output values are non-negative BTC amounts with at most eight
|
|
15
|
+
* decimal places; tiny floating-point arithmetic errors (up to 0.001 sat)
|
|
16
|
+
* are tolerated. Calculate fees and change in integer satoshis, then convert
|
|
17
|
+
* to BTC for this method. Total outputs must not exceed total inputs; the
|
|
18
|
+
* difference is the fee. There is no minimum or maximum
|
|
19
|
+
* signing fee, and no dust threshold is enforced. The caller must check the
|
|
20
|
+
* fee rate (sats/vB) and output amounts against the broadcasting node's
|
|
21
|
+
* policy. Signing does not guarantee relay, confirmation, or UTXO availability.
|
|
22
|
+
* Invalid transaction parameters reject with a MagicRPCError describing the
|
|
23
|
+
* validation failure.
|
|
13
24
|
*/
|
|
14
25
|
signTransaction(inputs: BitcoinTransactionInput[], outputs: BitcoinTransactionOutput[]): Promise<BitcoinSignedTransaction>;
|
|
15
26
|
}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare enum BitcoinPayloadMethod {
|
|
|
6
6
|
BitcoinSignTransaction = "btc_signTransaction"
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* A UTXO to spend. `value` is in BTC (not satoshis)
|
|
10
|
-
* needs
|
|
9
|
+
* A UTXO to spend. `value` is in BTC (not satoshis), with at most eight decimal
|
|
10
|
+
* places. The enclave needs this value to compute its segwit (BIP143) sighash. `tx_num` is
|
|
11
11
|
* the output index (vout) of the UTXO within its source transaction.
|
|
12
12
|
*/
|
|
13
13
|
export interface BitcoinTransactionInput {
|
|
@@ -16,7 +16,7 @@ export interface BitcoinTransactionInput {
|
|
|
16
16
|
value: number;
|
|
17
17
|
address?: string;
|
|
18
18
|
}
|
|
19
|
-
/** A transaction output. `value` is in BTC
|
|
19
|
+
/** A transaction output. `value` is in BTC with at most eight decimal places. */
|
|
20
20
|
export interface BitcoinTransactionOutput {
|
|
21
21
|
address: string;
|
|
22
22
|
value: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic-ext/bitcoin",
|
|
3
|
-
"version": "29.4.0",
|
|
3
|
+
"version": "29.4.1-canary.1140.42877900768.0",
|
|
4
4
|
"description": "magic bitcoin extension",
|
|
5
5
|
"author": "Magic <team@magic.link> (https://magic.link/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@magic-sdk/provider": "^33.13.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "17f13376ca3c14baa359c566b8256ae486d9182c"
|
|
34
34
|
}
|