-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.ts
144 lines (119 loc) · 4.88 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
export const CKB_UNIT = BigInt(10000_0000);
export const MAX_FEE = BigInt(2000_0000);
export const MIN_CAPACITY = BigInt(61) * BigInt(10000_0000);
export const SECP256K1_WITNESS_LOCK_SIZE = 65;
export const BTC_JUMP_CONFIRMATION_BLOCKS = 6;
export const RGBPP_TX_WITNESS_MAX_SIZE = 3000;
export const RGBPP_WITNESS_PLACEHOLDER = '0xFF';
export const RGBPP_TX_ID_PLACEHOLDER = '0000000000000000000000000000000000000000000000000000000000000000';
const TestnetInfo = {
Secp256k1LockDep: {
outPoint: {
txHash: '0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37',
index: '0x0',
},
depType: 'depGroup',
} as CKBComponents.CellDep,
RgbppLockScript: {
codeHash: '0x61ca7a4796a4eb19ca4f0d065cb9b10ddcf002f10f7cbb810c706cb6bb5c3248',
hashType: 'type',
args: '',
} as CKBComponents.Script,
RgbppLockDep: {
outPoint: { txHash: '0xf1de59e973b85791ec32debbba08dff80c63197e895eb95d67fc1e9f6b413e00', index: '0x0' },
depType: 'code',
} as CKBComponents.CellDep,
RgbppLockConfigDep: {
outPoint: { txHash: '0xf1de59e973b85791ec32debbba08dff80c63197e895eb95d67fc1e9f6b413e00', index: '0x1' },
depType: 'code',
} as CKBComponents.CellDep,
BtcTimeLockScript: {
codeHash: '0x00cdf8fab0f8ac638758ebf5ea5e4052b1d71e8a77b9f43139718621f6849326',
hashType: 'type',
args: '',
} as CKBComponents.Script,
BtcTimeLockDep: {
outPoint: { txHash: '0xde0f87878a97500f549418e5d46d2f7704c565a262aa17036c9c1c13ad638529', index: '0x0' },
depType: 'code',
} as CKBComponents.CellDep,
BtcTimeLockConfigDep: {
outPoint: { txHash: '0xde0f87878a97500f549418e5d46d2f7704c565a262aa17036c9c1c13ad638529', index: '0x1' },
depType: 'code',
} as CKBComponents.CellDep,
XUDTTypeScript: {
codeHash: '0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb',
hashType: 'type',
args: '',
} as CKBComponents.Script,
XUDTTypeDep: {
outPoint: {
txHash: '0xbf6fb538763efec2a70a6a3dcb7242787087e1030c4e7d86585bc63a9d337f5f',
index: '0x0',
},
depType: 'code',
} as CKBComponents.CellDep,
};
const MainnetInfo = {
Secp256k1LockDep: {
outPoint: {
txHash: '0x71a7ba8fc96349fea0ed3a5c47992e3b4084b031a42264a018e0072e8172e46c',
index: '0x0',
},
depType: 'depGroup',
} as CKBComponents.CellDep,
RgbppLockScript: {
codeHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
hashType: 'type',
args: '',
} as CKBComponents.Script,
RgbppLockDep: {
outPoint: { txHash: '0x0000000000000000000000000000000000000000000000000000000000000000', index: '0x0' },
depType: 'depGroup',
} as CKBComponents.CellDep,
RgbppLockConfigDep: {
outPoint: { txHash: '0x0000000000000000000000000000000000000000000000000000000000000000', index: '0x1' },
depType: 'depGroup',
} as CKBComponents.CellDep,
BtcTimeLockScript: {
codeHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
hashType: 'type',
args: '',
} as CKBComponents.Script,
BtcTimeLockDep: {
outPoint: { txHash: '0x0000000000000000000000000000000000000000000000000000000000000000', index: '0x0' },
depType: 'depGroup',
} as CKBComponents.CellDep,
BtcTimeLockConfigDep: {
outPoint: { txHash: '0x0000000000000000000000000000000000000000000000000000000000000000', index: '0x1' },
depType: 'depGroup',
} as CKBComponents.CellDep,
XUDTTypeScript: {
codeHash: '0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95',
hashType: 'data1',
args: '',
} as CKBComponents.Script,
XUDTTypeDep: {
outPoint: {
txHash: '0xc07844ce21b38e4b071dd0e1ee3b0e27afd8d7532491327f39b786343f558ab7',
index: '0x0',
},
depType: 'code',
} as CKBComponents.CellDep,
};
export const getSecp256k1CellDep = (isMainnet: boolean) =>
isMainnet ? MainnetInfo.Secp256k1LockDep : TestnetInfo.Secp256k1LockDep;
export const getXudtTypeScript = (isMainnet: boolean) =>
isMainnet ? MainnetInfo.XUDTTypeScript : TestnetInfo.XUDTTypeScript;
export const getXudtDep = (isMainnet: boolean) => (isMainnet ? MainnetInfo.XUDTTypeDep : TestnetInfo.XUDTTypeDep);
export const getRgbppLockScript = (isMainnet: boolean) =>
isMainnet ? MainnetInfo.RgbppLockScript : TestnetInfo.RgbppLockScript;
export const getRgbppLockDep = (isMainnet: boolean) =>
isMainnet ? MainnetInfo.RgbppLockDep : TestnetInfo.RgbppLockDep;
export const getRgbppLockConfigDep = (isMainnet: boolean) =>
isMainnet ? MainnetInfo.RgbppLockConfigDep : TestnetInfo.RgbppLockConfigDep;
export const getBtcTimeLockScript = (isMainnet: boolean) =>
isMainnet ? MainnetInfo.BtcTimeLockScript : TestnetInfo.BtcTimeLockScript;
export const getBtcTimeLockDep = (isMainnet: boolean) =>
isMainnet ? MainnetInfo.BtcTimeLockDep : TestnetInfo.BtcTimeLockDep;
export const getBtcTimeLockConfigDep = (isMainnet: boolean) =>
isMainnet ? MainnetInfo.BtcTimeLockConfigDep : TestnetInfo.BtcTimeLockConfigDep;