@bsv/sdk 2.0.13 → 2.0.15
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/README.md +2 -0
- package/dist/cjs/package.json +14 -14
- package/dist/cjs/src/identity/IdentityClient.js +3 -3
- package/dist/cjs/src/identity/IdentityClient.js.map +1 -1
- package/dist/cjs/src/identity/types/index.js +1 -1
- package/dist/cjs/src/identity/types/index.js.map +1 -1
- package/dist/cjs/src/primitives/Hash.js +1 -1
- package/dist/cjs/src/primitives/Hash.js.map +1 -1
- package/dist/cjs/src/primitives/TransactionSignature.js +10 -3
- package/dist/cjs/src/primitives/TransactionSignature.js.map +1 -1
- package/dist/cjs/src/script/Script.js +60 -13
- package/dist/cjs/src/script/Script.js.map +1 -1
- package/dist/cjs/src/script/Spend.js +434 -59
- package/dist/cjs/src/script/Spend.js.map +1 -1
- package/dist/cjs/src/storage/StorageUploader.js +315 -96
- package/dist/cjs/src/storage/StorageUploader.js.map +1 -1
- package/dist/cjs/src/storage/index.js +3 -1
- package/dist/cjs/src/storage/index.js.map +1 -1
- package/dist/cjs/src/transaction/http/BinaryFetchClient.js +6 -2
- package/dist/cjs/src/transaction/http/BinaryFetchClient.js.map +1 -1
- package/dist/cjs/src/transaction/http/DefaultHttpClient.js +8 -4
- package/dist/cjs/src/transaction/http/DefaultHttpClient.js.map +1 -1
- package/dist/cjs/src/wallet/WERR_REVIEW_ACTIONS.js +2 -2
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/src/identity/IdentityClient.js +3 -3
- package/dist/esm/src/identity/IdentityClient.js.map +1 -1
- package/dist/esm/src/identity/types/index.js +1 -1
- package/dist/esm/src/identity/types/index.js.map +1 -1
- package/dist/esm/src/primitives/Hash.js +1 -1
- package/dist/esm/src/primitives/Hash.js.map +1 -1
- package/dist/esm/src/primitives/TransactionSignature.js +10 -3
- package/dist/esm/src/primitives/TransactionSignature.js.map +1 -1
- package/dist/esm/src/script/Script.js +60 -13
- package/dist/esm/src/script/Script.js.map +1 -1
- package/dist/esm/src/script/Spend.js +438 -59
- package/dist/esm/src/script/Spend.js.map +1 -1
- package/dist/esm/src/storage/StorageUploader.js +319 -95
- package/dist/esm/src/storage/StorageUploader.js.map +1 -1
- package/dist/esm/src/storage/index.js +1 -1
- package/dist/esm/src/storage/index.js.map +1 -1
- package/dist/esm/src/transaction/http/BinaryFetchClient.js +6 -2
- package/dist/esm/src/transaction/http/BinaryFetchClient.js.map +1 -1
- package/dist/esm/src/transaction/http/DefaultHttpClient.js +8 -4
- package/dist/esm/src/transaction/http/DefaultHttpClient.js.map +1 -1
- package/dist/esm/src/wallet/WERR_REVIEW_ACTIONS.js +2 -2
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/types/src/primitives/TransactionSignature.d.ts +1 -0
- package/dist/types/src/primitives/TransactionSignature.d.ts.map +1 -1
- package/dist/types/src/script/Script.d.ts +1 -0
- package/dist/types/src/script/Script.d.ts.map +1 -1
- package/dist/types/src/script/ScriptChunk.d.ts +1 -0
- package/dist/types/src/script/ScriptChunk.d.ts.map +1 -1
- package/dist/types/src/script/Spend.d.ts +29 -0
- package/dist/types/src/script/Spend.d.ts.map +1 -1
- package/dist/types/src/storage/StorageUploader.d.ts +94 -55
- package/dist/types/src/storage/StorageUploader.d.ts.map +1 -1
- package/dist/types/src/storage/index.d.ts +1 -1
- package/dist/types/src/storage/index.d.ts.map +1 -1
- package/dist/types/src/transaction/http/BinaryFetchClient.d.ts.map +1 -1
- package/dist/types/src/transaction/http/DefaultHttpClient.d.ts +2 -2
- package/dist/types/src/transaction/http/DefaultHttpClient.d.ts.map +1 -1
- package/dist/types/src/wallet/WERR_REVIEW_ACTIONS.d.ts +2 -2
- package/dist/types/src/wallet/Wallet.interfaces.d.ts +2 -2
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/umd/bundle.js +4 -5
- package/docs/index.md +3 -1
- package/docs/reference/identity.md +1 -1
- package/docs/reference/primitives.md +1 -0
- package/docs/reference/script.md +7 -0
- package/docs/reference/storage.md +214 -85
- package/docs/reference/transaction.md +4 -4
- package/docs/reference/wallet.md +4 -4
- package/package.json +14 -14
- package/src/identity/IdentityClient.ts +3 -3
- package/src/identity/__tests/IdentityClient.additional.test.ts +3 -3
- package/src/identity/types/index.ts +1 -1
- package/src/primitives/Hash.ts +1 -1
- package/src/primitives/TransactionSignature.ts +11 -3
- package/src/script/Script.ts +59 -13
- package/src/script/ScriptChunk.ts +1 -0
- package/src/script/Spend.ts +483 -61
- package/src/script/__tests/NormativeVectors.test.ts +465 -0
- package/src/script/__tests/fixtures/SOURCES.md +25 -0
- package/src/script/__tests/fixtures/bitcoin-sv/script_tests.json +2591 -0
- package/src/script/__tests/fixtures/bitcoin-sv/sighash.json +1003 -0
- package/src/script/__tests/fixtures/bitcoin-sv/tx_invalid.json +285 -0
- package/src/script/__tests/fixtures/bitcoin-sv/tx_valid.json +367 -0
- package/src/script/__tests/fixtures/teranode/script_tests.json +2432 -0
- package/src/script/__tests/fixtures/teranode/sighash.json +1003 -0
- package/src/script/__tests/fixtures/teranode/tx_invalid.json +285 -0
- package/src/script/__tests/fixtures/teranode/tx_valid.json +367 -0
- package/src/storage/StorageUploader.ts +427 -105
- package/src/storage/__tests/StorageUploader.test.ts +881 -64
- package/src/storage/index.ts +1 -1
- package/src/transaction/broadcasters/__tests/ARC.test.ts +26 -4
- package/src/transaction/broadcasters/__tests/WhatsOnChainBroadcaster.test.ts +26 -4
- package/src/transaction/chaintrackers/__tests/WhatsOnChainChainTracker.test.ts +32 -10
- package/src/transaction/http/BinaryFetchClient.ts +5 -2
- package/src/transaction/http/DefaultHttpClient.ts +7 -4
- package/src/transaction/http/__tests/DefaultHttpClient.additional.test.ts +19 -1
- package/src/wallet/WERR_REVIEW_ACTIONS.ts +2 -2
- package/src/wallet/Wallet.interfaces.ts +2 -2
- package/dist/cjs/src/auth/clients/__tests__/AuthFetch.additional.test.js +0 -827
- package/dist/cjs/src/auth/clients/__tests__/AuthFetch.additional.test.js.map +0 -1
- package/dist/cjs/src/auth/clients/__tests__/AuthFetch.test.js +0 -266
- package/dist/cjs/src/auth/clients/__tests__/AuthFetch.test.js.map +0 -1
- package/dist/cjs/src/auth/transports/__tests__/SimplifiedFetchTransport.additional.test.js +0 -654
- package/dist/cjs/src/auth/transports/__tests__/SimplifiedFetchTransport.additional.test.js.map +0 -1
- package/dist/cjs/src/auth/transports/__tests__/SimplifiedFetchTransport.test.js +0 -144
- package/dist/cjs/src/auth/transports/__tests__/SimplifiedFetchTransport.test.js.map +0 -1
- package/dist/esm/src/auth/clients/__tests__/AuthFetch.additional.test.js +0 -825
- package/dist/esm/src/auth/clients/__tests__/AuthFetch.additional.test.js.map +0 -1
- package/dist/esm/src/auth/clients/__tests__/AuthFetch.test.js +0 -264
- package/dist/esm/src/auth/clients/__tests__/AuthFetch.test.js.map +0 -1
- package/dist/esm/src/auth/transports/__tests__/SimplifiedFetchTransport.additional.test.js +0 -619
- package/dist/esm/src/auth/transports/__tests__/SimplifiedFetchTransport.additional.test.js.map +0 -1
- package/dist/esm/src/auth/transports/__tests__/SimplifiedFetchTransport.test.js +0 -109
- package/dist/esm/src/auth/transports/__tests__/SimplifiedFetchTransport.test.js.map +0 -1
- package/dist/types/src/auth/clients/__tests__/AuthFetch.additional.test.d.ts +0 -21
- package/dist/types/src/auth/clients/__tests__/AuthFetch.additional.test.d.ts.map +0 -1
- package/dist/types/src/auth/clients/__tests__/AuthFetch.test.d.ts +0 -2
- package/dist/types/src/auth/clients/__tests__/AuthFetch.test.d.ts.map +0 -1
- package/dist/types/src/auth/transports/__tests__/SimplifiedFetchTransport.additional.test.d.ts +0 -2
- package/dist/types/src/auth/transports/__tests__/SimplifiedFetchTransport.additional.test.d.ts.map +0 -1
- package/dist/types/src/auth/transports/__tests__/SimplifiedFetchTransport.test.d.ts +0 -2
- package/dist/types/src/auth/transports/__tests__/SimplifiedFetchTransport.test.d.ts.map +0 -1
- package/dist/umd/bundle.js.map +0 -1
package/src/storage/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * as StorageUtils from './StorageUtils.js'
|
|
2
2
|
|
|
3
|
-
export { StorageUploader } from './StorageUploader.js'
|
|
3
|
+
export { StorageUploader, DEFAULT_UHRP_SERVERS, RenewResiliencyError } from './StorageUploader.js'
|
|
4
4
|
|
|
5
5
|
export { StorageDownloader } from './StorageDownloader.js'
|
|
@@ -36,13 +36,33 @@ describe('ARC Broadcaster', () => {
|
|
|
36
36
|
transaction = new Transaction()
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
+
async function withoutGlobalFetch<T> (callback: () => Promise<T>): Promise<T> {
|
|
40
|
+
const originalFetchDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'fetch')
|
|
41
|
+
Object.defineProperty(globalThis, 'fetch', {
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: undefined
|
|
45
|
+
})
|
|
46
|
+
try {
|
|
47
|
+
return await callback()
|
|
48
|
+
} finally {
|
|
49
|
+
if (originalFetchDescriptor !== undefined) {
|
|
50
|
+
Object.defineProperty(globalThis, 'fetch', originalFetchDescriptor)
|
|
51
|
+
} else {
|
|
52
|
+
delete (globalThis as { fetch?: unknown }).fetch
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
it('should broadcast successfully using window.fetch', async () => {
|
|
40
58
|
// Mocking window.fetch
|
|
41
59
|
const mockFetch = mockedFetch(successResponse)
|
|
42
60
|
global.window = { fetch: mockFetch } as unknown as Window & typeof globalThis
|
|
43
61
|
|
|
44
|
-
const
|
|
45
|
-
|
|
62
|
+
const response = await withoutGlobalFetch(async () => {
|
|
63
|
+
const broadcaster = new ARC(URL)
|
|
64
|
+
return await broadcaster.broadcast(transaction)
|
|
65
|
+
})
|
|
46
66
|
|
|
47
67
|
expect(mockFetch).toHaveBeenCalled()
|
|
48
68
|
expect(response).toEqual({
|
|
@@ -59,8 +79,10 @@ describe('ARC Broadcaster', () => {
|
|
|
59
79
|
delete (globalThis as { window?: unknown }).window // ✅ Explicit property check
|
|
60
80
|
}
|
|
61
81
|
|
|
62
|
-
const
|
|
63
|
-
|
|
82
|
+
const response = await withoutGlobalFetch(async () => {
|
|
83
|
+
const broadcaster = new ARC(URL)
|
|
84
|
+
return await broadcaster.broadcast(transaction)
|
|
85
|
+
})
|
|
64
86
|
|
|
65
87
|
expect(response).toEqual({
|
|
66
88
|
status: 'success',
|
|
@@ -30,13 +30,33 @@ describe('WhatsOnChainBroadcaster', () => {
|
|
|
30
30
|
transaction = new Transaction()
|
|
31
31
|
})
|
|
32
32
|
|
|
33
|
+
async function withoutGlobalFetch<T> (callback: () => Promise<T>): Promise<T> {
|
|
34
|
+
const originalFetchDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'fetch')
|
|
35
|
+
Object.defineProperty(globalThis, 'fetch', {
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: undefined
|
|
39
|
+
})
|
|
40
|
+
try {
|
|
41
|
+
return await callback()
|
|
42
|
+
} finally {
|
|
43
|
+
if (originalFetchDescriptor !== undefined) {
|
|
44
|
+
Object.defineProperty(globalThis, 'fetch', originalFetchDescriptor)
|
|
45
|
+
} else {
|
|
46
|
+
delete (globalThis as { fetch?: unknown }).fetch
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
33
51
|
it('should broadcast successfully using window.fetch', async () => {
|
|
34
52
|
// Mocking window.fetch
|
|
35
53
|
const mockFetch = mockedFetch(successResponse)
|
|
36
54
|
global.window = { fetch: mockFetch } as any
|
|
37
55
|
|
|
38
|
-
const
|
|
39
|
-
|
|
56
|
+
const response = await withoutGlobalFetch(async () => {
|
|
57
|
+
const broadcaster = new WhatsOnChainBroadcaster(network)
|
|
58
|
+
return await broadcaster.broadcast(transaction)
|
|
59
|
+
})
|
|
40
60
|
|
|
41
61
|
expect(mockFetch).toHaveBeenCalled()
|
|
42
62
|
expect(response).toEqual({
|
|
@@ -51,8 +71,10 @@ describe('WhatsOnChainBroadcaster', () => {
|
|
|
51
71
|
mockedHttps(successResponse)
|
|
52
72
|
global.window = {} as any
|
|
53
73
|
|
|
54
|
-
const
|
|
55
|
-
|
|
74
|
+
const response = await withoutGlobalFetch(async () => {
|
|
75
|
+
const broadcaster = new WhatsOnChainBroadcaster(network)
|
|
76
|
+
return await broadcaster.broadcast(transaction)
|
|
77
|
+
})
|
|
56
78
|
|
|
57
79
|
expect(response).toEqual({
|
|
58
80
|
status: 'success',
|
|
@@ -14,16 +14,36 @@ describe('WhatsOnChain ChainTracker', () => {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
async function withoutGlobalFetch<T> (callback: () => Promise<T>): Promise<T> {
|
|
18
|
+
const originalFetchDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'fetch')
|
|
19
|
+
Object.defineProperty(globalThis, 'fetch', {
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: undefined
|
|
23
|
+
})
|
|
24
|
+
try {
|
|
25
|
+
return await callback()
|
|
26
|
+
} finally {
|
|
27
|
+
if (originalFetchDescriptor !== undefined) {
|
|
28
|
+
Object.defineProperty(globalThis, 'fetch', originalFetchDescriptor)
|
|
29
|
+
} else {
|
|
30
|
+
delete (globalThis as { fetch?: unknown }).fetch
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
it('should verify merkleroot successfully using window.fetch', async () => {
|
|
18
36
|
// Mocking window.fetch
|
|
19
37
|
const mockFetch = mockedFetch(successResponse)
|
|
20
38
|
global.window = { fetch: mockFetch } as any
|
|
21
39
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
40
|
+
const response = await withoutGlobalFetch(async () => {
|
|
41
|
+
const chainTracker = new WhatsOnChain(network)
|
|
42
|
+
return await chainTracker.isValidRootForHeight(
|
|
43
|
+
merkleroot,
|
|
44
|
+
height
|
|
45
|
+
)
|
|
46
|
+
})
|
|
27
47
|
|
|
28
48
|
expect(mockFetch).toHaveBeenCalled()
|
|
29
49
|
expect(response).toEqual(true)
|
|
@@ -34,11 +54,13 @@ describe('WhatsOnChain ChainTracker', () => {
|
|
|
34
54
|
mockedHttps(successResponse)
|
|
35
55
|
if (typeof global.window !== 'undefined') global.window = {} as any
|
|
36
56
|
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
const response = await withoutGlobalFetch(async () => {
|
|
58
|
+
const chainTracker = new WhatsOnChain(network)
|
|
59
|
+
return await chainTracker.isValidRootForHeight(
|
|
60
|
+
merkleroot,
|
|
61
|
+
height
|
|
62
|
+
)
|
|
63
|
+
})
|
|
42
64
|
|
|
43
65
|
expect(response).toEqual(true)
|
|
44
66
|
})
|
|
@@ -99,10 +99,13 @@ export function binaryHttpClient(): HttpClient {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
if (typeof window !== 'undefined' && typeof window.fetch === 'function') {
|
|
102
|
-
//
|
|
102
|
+
// Browser tab/page context
|
|
103
103
|
return new BinaryFetchClient(window.fetch.bind(window))
|
|
104
|
+
} else if (typeof globalThis.fetch === 'function') {
|
|
105
|
+
// Service workers, Deno, Node 18+ (any environment with global fetch)
|
|
106
|
+
return new BinaryFetchClient(globalThis.fetch.bind(globalThis))
|
|
104
107
|
} else if (typeof require !== 'undefined') {
|
|
105
|
-
//
|
|
108
|
+
// Older Node.js — use https module
|
|
106
109
|
// eslint-disable-next-line
|
|
107
110
|
try {
|
|
108
111
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -4,8 +4,8 @@ import { FetchHttpClient } from './FetchHttpClient.js'
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns a default HttpClient implementation based on the environment that it is run on.
|
|
7
|
-
* This method will attempt to use `window.fetch` if available (in browser environments)
|
|
8
|
-
*
|
|
7
|
+
* This method will attempt to use `window.fetch` if available (in browser environments),
|
|
8
|
+
* then `globalThis.fetch` (service workers, Deno, Node 18+), then the Node `https` module.
|
|
9
9
|
*/
|
|
10
10
|
export function defaultHttpClient(): HttpClient {
|
|
11
11
|
const noHttpClient: HttpClient = {
|
|
@@ -15,10 +15,13 @@ export function defaultHttpClient(): HttpClient {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
if (typeof window !== 'undefined' && typeof window.fetch === 'function') {
|
|
18
|
-
//
|
|
18
|
+
// Browser tab/page context
|
|
19
19
|
return new FetchHttpClient(window.fetch.bind(window))
|
|
20
|
+
} else if (typeof globalThis.fetch === 'function') {
|
|
21
|
+
// Service workers, Deno, Node 18+ (any environment with global fetch)
|
|
22
|
+
return new FetchHttpClient(globalThis.fetch.bind(globalThis))
|
|
20
23
|
} else if (typeof require !== 'undefined') {
|
|
21
|
-
//
|
|
24
|
+
// Older Node.js — use https module
|
|
22
25
|
// eslint-disable-next-line
|
|
23
26
|
try {
|
|
24
27
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -7,10 +7,17 @@
|
|
|
7
7
|
// allowing us to control whether `https` throws on require.
|
|
8
8
|
|
|
9
9
|
describe('defaultHttpClient — noHttpClient fallback paths', () => {
|
|
10
|
+
let savedFetch: typeof globalThis.fetch | undefined
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
savedFetch = globalThis.fetch
|
|
14
|
+
})
|
|
15
|
+
|
|
10
16
|
afterEach(() => {
|
|
11
17
|
if ('window' in globalThis) {
|
|
12
18
|
delete (globalThis as { window?: unknown }).window
|
|
13
19
|
}
|
|
20
|
+
globalThis.fetch = savedFetch as typeof globalThis.fetch
|
|
14
21
|
jest.resetModules()
|
|
15
22
|
})
|
|
16
23
|
|
|
@@ -25,10 +32,11 @@ describe('defaultHttpClient — noHttpClient fallback paths', () => {
|
|
|
25
32
|
throw new Error('https module not available')
|
|
26
33
|
})
|
|
27
34
|
|
|
28
|
-
// window must be absent so the fetch
|
|
35
|
+
// window and globalThis.fetch must be absent so the fetch branches are skipped
|
|
29
36
|
if ('window' in globalThis) {
|
|
30
37
|
delete (globalThis as { window?: unknown }).window
|
|
31
38
|
}
|
|
39
|
+
delete (globalThis as { fetch?: unknown }).fetch
|
|
32
40
|
|
|
33
41
|
let defaultHttpClient: any
|
|
34
42
|
|
|
@@ -61,6 +69,7 @@ describe('defaultHttpClient — noHttpClient fallback paths', () => {
|
|
|
61
69
|
if ('window' in globalThis) {
|
|
62
70
|
delete (globalThis as { window?: unknown }).window
|
|
63
71
|
}
|
|
72
|
+
delete (globalThis as { fetch?: unknown }).fetch
|
|
64
73
|
|
|
65
74
|
let client: any
|
|
66
75
|
|
|
@@ -111,10 +120,17 @@ describe('defaultHttpClient — noHttpClient fallback paths', () => {
|
|
|
111
120
|
// --------------------------------------------------------------------------
|
|
112
121
|
|
|
113
122
|
describe('binaryHttpClient — noHttpClient fallback paths', () => {
|
|
123
|
+
let savedFetch: typeof globalThis.fetch | undefined
|
|
124
|
+
|
|
125
|
+
beforeEach(() => {
|
|
126
|
+
savedFetch = globalThis.fetch
|
|
127
|
+
})
|
|
128
|
+
|
|
114
129
|
afterEach(() => {
|
|
115
130
|
if ('window' in globalThis) {
|
|
116
131
|
delete (globalThis as { window?: unknown }).window
|
|
117
132
|
}
|
|
133
|
+
globalThis.fetch = savedFetch as typeof globalThis.fetch
|
|
118
134
|
jest.resetModules()
|
|
119
135
|
})
|
|
120
136
|
|
|
@@ -126,6 +142,7 @@ describe('binaryHttpClient — noHttpClient fallback paths', () => {
|
|
|
126
142
|
if ('window' in globalThis) {
|
|
127
143
|
delete (globalThis as { window?: unknown }).window
|
|
128
144
|
}
|
|
145
|
+
delete (globalThis as { fetch?: unknown }).fetch
|
|
129
146
|
|
|
130
147
|
let binaryHttpClient: any
|
|
131
148
|
|
|
@@ -153,6 +170,7 @@ describe('binaryHttpClient — noHttpClient fallback paths', () => {
|
|
|
153
170
|
if ('window' in globalThis) {
|
|
154
171
|
delete (globalThis as { window?: unknown }).window
|
|
155
172
|
}
|
|
173
|
+
delete (globalThis as { fetch?: unknown }).fetch
|
|
156
174
|
|
|
157
175
|
let client: any
|
|
158
176
|
|
|
@@ -2,7 +2,7 @@ import { AtomicBEEF, OutpointString, ReviewActionResult, SendWithResult, TXIDHex
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* When a `createAction` or `signAction` is completed in undelayed mode (`acceptDelayedBroadcast`: false),
|
|
5
|
-
* any
|
|
5
|
+
* any unsuccessful result will return the results by way of this exception to ensure attention is
|
|
6
6
|
* paid to processing errors.
|
|
7
7
|
*/
|
|
8
8
|
export class WERR_REVIEW_ACTIONS extends Error {
|
|
@@ -10,7 +10,7 @@ export class WERR_REVIEW_ACTIONS extends Error {
|
|
|
10
10
|
isError: boolean = true
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* All parameters correspond to their comparable `createAction` or `
|
|
13
|
+
* All parameters correspond to their comparable `createAction` or `signAction` results
|
|
14
14
|
* with the exception of `reviewActionResults`;
|
|
15
15
|
* which contains more details, particularly for double spend results.
|
|
16
16
|
*/
|
|
@@ -305,10 +305,10 @@ export interface SendWithResult {
|
|
|
305
305
|
|
|
306
306
|
/**
|
|
307
307
|
* Indicates status of a new Action following a `createAction` or `signAction` in immediate mode:
|
|
308
|
-
* When `acceptDelayedBroadcast` is
|
|
308
|
+
* When `acceptDelayedBroadcast` is false.
|
|
309
309
|
*
|
|
310
310
|
* 'success': The action has been broadcast and accepted by the bitcoin processing network.
|
|
311
|
-
* '
|
|
311
|
+
* 'doubleSpend': The action has been confirmed to double spend one or more inputs, and by the "first-seen-rule" is the losing transaction.
|
|
312
312
|
* 'invalidTx': The action was rejected by the processing network as an invalid bitcoin transaction.
|
|
313
313
|
* 'serviceError': The broadcast services are currently unable to reach the bitcoin network. The action is now queued for delayed retries.
|
|
314
314
|
*/
|