Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd committed Oct 16, 2023
1 parent 47ad6a6 commit 5601651
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/assert.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Buff, Bytes } from '@cmdcode/buff'
import { Network } from './types/index.js'
import { Network } from '@scrow/tapscript'

export function ok (
value : unknown,
Expand Down Expand Up @@ -46,7 +46,7 @@ export function valid_pubkey (pubkey : unknown) {

export function valid_address (
address : string,
network : Network = 'bitcoin'
network : Network
) {
const base58 = /^[123mn][a-km-zA-HJ-NP-Z1-9]{25,34}$/
const bech32 = /^(bc|tb|bcrt)1([ac-hj-np-z02-9]{39,59})$/
Expand All @@ -60,7 +60,7 @@ export function valid_address (
}

if (
(network === 'bitcoin' && !address.startsWith('bc')) ||
(network === 'main' && !address.startsWith('bc')) ||
(network === 'testnet' && !address.startsWith('tb')) ||
(network === 'regtest' && !address.startsWith('bcrt'))
) {
Expand Down
2 changes: 1 addition & 1 deletion src/schema/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const hex = z.string()
.refine(e => e.length % 2 === 0)

const label = z.string().regex(/^[0-9a-zA-Z_-]{2,64}$/)
const network = z.enum([ 'bitcoin', 'testnet', 'regtest' ])
const network = z.enum([ 'main', 'regtest', 'signet', 'testnet' ])
const payment = z.tuple([ num, address ])
const paypath = z.tuple([ label, num, address ])

Expand Down
2 changes: 0 additions & 2 deletions src/types/base.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export type Literal = string | number | boolean | null
export type Network = 'bitcoin' | 'testnet' | 'regtest'

3 changes: 2 additions & 1 deletion src/types/proposal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Literal, Network } from './base.js'
import { Network } from '@scrow/tapscript'
import { Literal } from './base.js'

export type Payment = [
value : number,
Expand Down

0 comments on commit 5601651

Please sign in to comment.