sats-connect
Advanced tools
Comparing version 0.1.2 to 0.1.3
export * from './src/address/index'; | ||
export * from './src/provider/bitcoin.provider'; | ||
export * from './src/auth'; | ||
export * from './src/provider'; | ||
export * from './src/call'; | ||
export * from './src/transactions/signTransaction'; |
export * from './src/address/index'; | ||
export * from './src/provider/bitcoin.provider'; | ||
export * from './src/auth'; | ||
export * from './src/provider'; | ||
export * from './src/call'; | ||
export * from './src/transactions/signTransaction'; | ||
//# sourceMappingURL=index.js.map |
import { GetAddressOptions } from './types'; | ||
export declare const openRequestAddressPopup: (options: GetAddressOptions) => Promise<void>; | ||
export declare const getAddress: (options: GetAddressOptions) => Promise<void>; | ||
export * from './types'; |
@@ -37,4 +37,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
export var openRequestAddressPopup = function (options) { return __awaiter(void 0, void 0, void 0, function () { | ||
var _a, message, network, purpose, provider, addressResponse, error_1; | ||
import { createUnsecuredToken } from 'jsontokens'; | ||
export var getAddress = function (options) { return __awaiter(void 0, void 0, void 0, function () { | ||
var _a, message, network, purposes, provider, request, addressResponse, error_1; | ||
var _b, _c; | ||
@@ -44,3 +45,3 @@ return __generator(this, function (_d) { | ||
case 0: | ||
_a = options.payload, message = _a.message, network = _a.network, purpose = _a.purpose; | ||
_a = options.payload, message = _a.message, network = _a.network, purposes = _a.purposes; | ||
provider = window.BitcoinProvider; | ||
@@ -50,6 +51,10 @@ if (!provider) { | ||
} | ||
if (!purposes) { | ||
throw new Error('Address purposes are required'); | ||
} | ||
_d.label = 1; | ||
case 1: | ||
_d.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, provider.getAddress(purpose, message, network)]; | ||
request = createUnsecuredToken(options.payload); | ||
return [4 /*yield*/, provider.getAddress(request)]; | ||
case 2: | ||
@@ -56,0 +61,0 @@ addressResponse = _d.sent(); |
@@ -1,11 +0,23 @@ | ||
import { BitcoinNetwork, Purpose } from '../provider/bitcoin.provider'; | ||
interface GetAddressPayload { | ||
purpose: Purpose; | ||
import { BitcoinNetwork } from '../provider'; | ||
export declare enum AddressPurposes { | ||
PAYMENT = "payment", | ||
ORDINALS = "ordinals" | ||
} | ||
export interface Purpose { | ||
derivation_path?: string; | ||
purpose: AddressPurposes; | ||
} | ||
export interface GetAddressPayload { | ||
purposes: Array<Purpose>; | ||
message: string; | ||
network: BitcoinNetwork; | ||
} | ||
export interface GetAddressResponse { | ||
export interface Address { | ||
address: string; | ||
network: string; | ||
publicKey: string; | ||
purpose: Purpose; | ||
} | ||
export interface GetAddressResponse { | ||
addresses: Array<Address>; | ||
} | ||
export interface GetAddressOptions { | ||
@@ -16,2 +28,1 @@ onFinish: (response: GetAddressResponse) => void; | ||
} | ||
export {}; |
@@ -1,2 +0,6 @@ | ||
export {}; | ||
export var AddressPurposes; | ||
(function (AddressPurposes) { | ||
AddressPurposes["PAYMENT"] = "payment"; | ||
AddressPurposes["ORDINALS"] = "ordinals"; | ||
})(AddressPurposes || (AddressPurposes = {})); | ||
//# sourceMappingURL=types.js.map |
export * from './src/address/index'; | ||
export * from './src/provider'; | ||
export * from './src/call'; | ||
export * from './src/transactions/signPsbt'; | ||
export * from './src/transactions/signTransaction'; |
{ | ||
"name": "sats-connect", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -15,3 +15,3 @@ import { createUnsecuredToken, Json } from 'jsontokens'; | ||
const request = createUnsecuredToken(options.payload as unknown as Json); | ||
const addressResponse = await provider.connect(request); | ||
const addressResponse = await provider.getAddress(request); | ||
options.onFinish?.(addressResponse); | ||
@@ -18,0 +18,0 @@ } catch (error) { |
@@ -17,3 +17,3 @@ import { createUnsecuredToken, Json } from 'jsontokens'; | ||
export enum CallMethod { | ||
SIGN_PSBT = 'signPsbt', | ||
SIGN_TRANSACTION = 'signTransaction', | ||
GET_ADDRESS = 'getAddress', | ||
@@ -20,0 +20,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { SignPsbtResponse } from '../transactions/signPsbt'; | ||
import { SignTransactionResponse } from '../transactions/signTransaction'; | ||
import { GetAddressResponse } from '../address'; | ||
@@ -10,5 +10,5 @@ | ||
export interface BitcoinProvider { | ||
connect: (request: string) => Promise<GetAddressResponse>; | ||
getAddress: (request: string) => Promise<GetAddressResponse>; | ||
call: (request: string) => Promise<Record<string, any>>; | ||
signPsbt: (request: string) => Promise<SignPsbtResponse>; | ||
signTransaction: (request: string) => Promise<SignTransactionResponse>; | ||
} | ||
@@ -15,0 +15,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
26796
543
1