react-native-rgb 0.2.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/LICENSE +20 -0
- package/README.md +165 -0
- package/Rgb.podspec +23 -0
- package/android/build.gradle +80 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/rgb/AppConstants.kt +57 -0
- package/android/src/main/java/com/rgb/RgbModule.kt +1959 -0
- package/android/src/main/java/com/rgb/RgbPackage.kt +33 -0
- package/android/src/main/java/com/rgb/WalletStore.kt +49 -0
- package/ios/AppConstants.swift +71 -0
- package/ios/Rgb.h +5 -0
- package/ios/Rgb.mm +1740 -0
- package/ios/Rgb.swift +1916 -0
- package/ios/RgbLib.swift +7615 -0
- package/ios/WalletStore.swift +61 -0
- package/lib/module/Interfaces.js +65 -0
- package/lib/module/Interfaces.js.map +1 -0
- package/lib/module/NativeRgb.js +5 -0
- package/lib/module/NativeRgb.js.map +1 -0
- package/lib/module/RgbError.js +65 -0
- package/lib/module/RgbError.js.map +1 -0
- package/lib/module/Wallet.js +854 -0
- package/lib/module/Wallet.js.map +1 -0
- package/lib/module/index.js +39 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Interfaces.d.ts +390 -0
- package/lib/typescript/src/Interfaces.d.ts.map +1 -0
- package/lib/typescript/src/NativeRgb.d.ts +417 -0
- package/lib/typescript/src/NativeRgb.d.ts.map +1 -0
- package/lib/typescript/src/RgbError.d.ts +28 -0
- package/lib/typescript/src/RgbError.d.ts.map +1 -0
- package/lib/typescript/src/Wallet.d.ts +648 -0
- package/lib/typescript/src/Wallet.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +28 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +174 -0
- package/src/Interfaces.ts +376 -0
- package/src/NativeRgb.ts +630 -0
- package/src/RgbError.ts +84 -0
- package/src/Wallet.ts +1118 -0
- package/src/index.tsx +46 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as Interfaces from './Interfaces';
|
|
2
|
+
import { Wallet } from './Wallet';
|
|
3
|
+
export * from './Interfaces';
|
|
4
|
+
export * from './Wallet';
|
|
5
|
+
export * from './RgbError';
|
|
6
|
+
export { Interfaces, Wallet };
|
|
7
|
+
/**
|
|
8
|
+
* Generates new keys for a wallet.
|
|
9
|
+
* @param bitcoinNetwork - The Bitcoin network to use (MAINNET, TESTNET, TESTNET4, REGTEST, SIGNET)
|
|
10
|
+
* @returns Promise resolving to Keys containing mnemonic, xpub, accountXpubVanilla, accountXpubColored, and masterFingerprint
|
|
11
|
+
* @throws {RgbError} Throws RgbError with a code from {@link RgbLibErrors} if:
|
|
12
|
+
* - Invalid Bitcoin network
|
|
13
|
+
* - Key generation fails
|
|
14
|
+
*/
|
|
15
|
+
export declare function generateKeys(bitcoinNetwork: Interfaces.BitcoinNetwork): Promise<Interfaces.Keys>;
|
|
16
|
+
/**
|
|
17
|
+
* Restores a wallet from a mnemonic.
|
|
18
|
+
* @param bitcoinNetwork - The Bitcoin network to use (MAINNET, TESTNET, TESTNET4, REGTEST, SIGNET)
|
|
19
|
+
* @param mnemonic - The mnemonic to restore the wallet from
|
|
20
|
+
* @returns Promise resolving to Keys containing mnemonic, xpub, accountXpubVanilla, accountXpubColored, and masterFingerprint
|
|
21
|
+
* @throws {RgbError} Throws RgbError with a code from {@link RgbLibErrors} if:
|
|
22
|
+
* - Invalid Bitcoin network
|
|
23
|
+
* - Invalid mnemonic
|
|
24
|
+
* - Key restoration fails
|
|
25
|
+
*/
|
|
26
|
+
export declare function restoreKeys(bitcoinNetwork: Interfaces.BitcoinNetwork, mnemonic: string): Promise<Interfaces.Keys>;
|
|
27
|
+
export declare function decodeInvoice(invoice: string): Promise<Interfaces.InvoiceData>;
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AAE9B;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,cAAc,EAAE,UAAU,CAAC,cAAc,GACxC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAE1B;AAED;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,cAAc,EAAE,UAAU,CAAC,cAAc,EACzC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAE1B;AAED,wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAEjC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-rgb",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "React Native library for Bitcoin RGB Protocol",
|
|
5
|
+
"main": "./lib/module/index.js",
|
|
6
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"source": "./src/index.tsx",
|
|
10
|
+
"types": "./lib/typescript/src/index.d.ts",
|
|
11
|
+
"default": "./lib/module/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"src",
|
|
17
|
+
"lib",
|
|
18
|
+
"android",
|
|
19
|
+
"ios",
|
|
20
|
+
"cpp",
|
|
21
|
+
"*.podspec",
|
|
22
|
+
"react-native.config.js",
|
|
23
|
+
"!ios/build",
|
|
24
|
+
"!ios/rgb_libFFI.xcframework",
|
|
25
|
+
"!android/build",
|
|
26
|
+
"!android/gradle",
|
|
27
|
+
"!android/gradlew",
|
|
28
|
+
"!android/gradlew.bat",
|
|
29
|
+
"!android/local.properties",
|
|
30
|
+
"!**/__tests__",
|
|
31
|
+
"!**/__fixtures__",
|
|
32
|
+
"!**/__mocks__",
|
|
33
|
+
"!**/.*"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"example": "yarn workspace react-native-rgb-example",
|
|
37
|
+
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
38
|
+
"prepare": "bob build",
|
|
39
|
+
"postinstall": "node scripts/download-rgb-lib-ios.js",
|
|
40
|
+
"typecheck": "tsc",
|
|
41
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
42
|
+
"test": "jest",
|
|
43
|
+
"release": "release-it --only-version --ci --no-increment",
|
|
44
|
+
"codegen": "mkdir -p android/build/generated/source/codegen && node node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js android/build/generated/source/codegen/schema.json src/NativeRgb.ts && node node_modules/@react-native/codegen/lib/cli/generators/generate-all.js android/build/generated/source/codegen/schema.json RgbSpec android/build/generated/source/codegen com.rgb",
|
|
45
|
+
"prettier": "prettier --write \"**/*.{js,ts,tsx}\"",
|
|
46
|
+
"build:watch": "tsc -w"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"react-native",
|
|
50
|
+
"ios",
|
|
51
|
+
"android"
|
|
52
|
+
],
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/Orbis-1/react-native-rgb.git"
|
|
56
|
+
},
|
|
57
|
+
"author": "Orbis1 <shashank@bithyve.com> (https://orbis1.io/)",
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"bugs": {
|
|
60
|
+
"url": "https://www.github.com/Orbis-1/react-native-rgb/issues"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://www.github.com/Orbis-1/react-native-rgb#readme",
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"registry": "https://registry.npmjs.org/"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@commitlint/config-conventional": "^19.8.1",
|
|
68
|
+
"@eslint/compat": "^1.3.2",
|
|
69
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
70
|
+
"@eslint/js": "^9.35.0",
|
|
71
|
+
"@react-native/babel-preset": "0.83.0",
|
|
72
|
+
"@react-native/eslint-config": "0.83.0",
|
|
73
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
74
|
+
"@types/jest": "^29.5.14",
|
|
75
|
+
"@types/react": "^19.2.0",
|
|
76
|
+
"commitlint": "^19.8.1",
|
|
77
|
+
"del-cli": "^6.0.0",
|
|
78
|
+
"eslint": "^9.35.0",
|
|
79
|
+
"eslint-config-prettier": "^10.1.8",
|
|
80
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
81
|
+
"jest": "^29.7.0",
|
|
82
|
+
"lefthook": "^2.0.3",
|
|
83
|
+
"prettier": "^2.8.8",
|
|
84
|
+
"react": "19.2.0",
|
|
85
|
+
"react-native": "0.83.0",
|
|
86
|
+
"react-native-builder-bob": "^0.40.17",
|
|
87
|
+
"release-it": "^19.0.4",
|
|
88
|
+
"turbo": "^2.5.6",
|
|
89
|
+
"typescript": "^5.9.2"
|
|
90
|
+
},
|
|
91
|
+
"peerDependencies": {
|
|
92
|
+
"react": "*",
|
|
93
|
+
"react-native": "*"
|
|
94
|
+
},
|
|
95
|
+
"workspaces": [
|
|
96
|
+
"example"
|
|
97
|
+
],
|
|
98
|
+
"packageManager": "yarn@4.11.0",
|
|
99
|
+
"react-native-builder-bob": {
|
|
100
|
+
"source": "src",
|
|
101
|
+
"output": "lib",
|
|
102
|
+
"targets": [
|
|
103
|
+
[
|
|
104
|
+
"module",
|
|
105
|
+
{
|
|
106
|
+
"esm": true
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
"typescript",
|
|
111
|
+
{
|
|
112
|
+
"project": "tsconfig.build.json"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
]
|
|
116
|
+
},
|
|
117
|
+
"codegenConfig": {
|
|
118
|
+
"name": "RgbSpec",
|
|
119
|
+
"type": "modules",
|
|
120
|
+
"jsSrcsDir": "src",
|
|
121
|
+
"android": {
|
|
122
|
+
"javaPackageName": "com.rgb"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"prettier": {
|
|
126
|
+
"quoteProps": "consistent",
|
|
127
|
+
"singleQuote": true,
|
|
128
|
+
"tabWidth": 2,
|
|
129
|
+
"trailingComma": "es5",
|
|
130
|
+
"useTabs": false
|
|
131
|
+
},
|
|
132
|
+
"jest": {
|
|
133
|
+
"preset": "react-native",
|
|
134
|
+
"modulePathIgnorePatterns": [
|
|
135
|
+
"<rootDir>/example/node_modules",
|
|
136
|
+
"<rootDir>/lib/"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"commitlint": {
|
|
140
|
+
"extends": [
|
|
141
|
+
"@commitlint/config-conventional"
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
"release-it": {
|
|
145
|
+
"git": {
|
|
146
|
+
"commitMessage": "chore: release ${version}",
|
|
147
|
+
"tagName": "v${version}"
|
|
148
|
+
},
|
|
149
|
+
"npm": {
|
|
150
|
+
"publish": true
|
|
151
|
+
},
|
|
152
|
+
"github": {
|
|
153
|
+
"release": true
|
|
154
|
+
},
|
|
155
|
+
"plugins": {
|
|
156
|
+
"@release-it/conventional-changelog": {
|
|
157
|
+
"preset": {
|
|
158
|
+
"name": "angular"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"create-react-native-library": {
|
|
164
|
+
"type": "turbo-module",
|
|
165
|
+
"languages": "kotlin-objc",
|
|
166
|
+
"tools": [
|
|
167
|
+
"eslint",
|
|
168
|
+
"jest",
|
|
169
|
+
"lefthook",
|
|
170
|
+
"release-it"
|
|
171
|
+
],
|
|
172
|
+
"version": "0.56.0"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
export type BitcoinNetwork =
|
|
2
|
+
| 'MAINNET'
|
|
3
|
+
| 'TESTNET'
|
|
4
|
+
| 'TESTNET4'
|
|
5
|
+
| 'REGTEST'
|
|
6
|
+
| 'SIGNET';
|
|
7
|
+
|
|
8
|
+
export const BitcoinNetwork = {
|
|
9
|
+
MAINNET: 'MAINNET' as const,
|
|
10
|
+
TESTNET: 'TESTNET' as const,
|
|
11
|
+
TESTNET4: 'TESTNET4' as const,
|
|
12
|
+
REGTEST: 'REGTEST' as const,
|
|
13
|
+
SIGNET: 'SIGNET' as const,
|
|
14
|
+
} as const;
|
|
15
|
+
|
|
16
|
+
export type Keys = {
|
|
17
|
+
mnemonic: string;
|
|
18
|
+
xpub: string;
|
|
19
|
+
accountXpubVanilla: string;
|
|
20
|
+
accountXpubColored: string;
|
|
21
|
+
masterFingerprint: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type Balance = {
|
|
25
|
+
settled: number;
|
|
26
|
+
future: number;
|
|
27
|
+
spendable: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type BtcBalance = {
|
|
31
|
+
vanilla: Balance;
|
|
32
|
+
colored: Balance;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type AssetSchema = 'NIA' | 'UDA' | 'CFA' | 'IFA';
|
|
36
|
+
|
|
37
|
+
export const AssetSchema = {
|
|
38
|
+
NIA: 'NIA' as const,
|
|
39
|
+
UDA: 'UDA' as const,
|
|
40
|
+
CFA: 'CFA' as const,
|
|
41
|
+
IFA: 'IFA' as const,
|
|
42
|
+
} as const;
|
|
43
|
+
|
|
44
|
+
export type AssignmentType =
|
|
45
|
+
| 'FUNGIBLE'
|
|
46
|
+
| 'NON_FUNGIBLE'
|
|
47
|
+
| 'INFLATION_RIGHT'
|
|
48
|
+
| 'REPLACE_RIGHT'
|
|
49
|
+
| 'ANY';
|
|
50
|
+
|
|
51
|
+
export type Assignment = {
|
|
52
|
+
type: AssignmentType;
|
|
53
|
+
amount?: number;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type RefreshTransferStatus =
|
|
57
|
+
| 'WAITING_COUNTERPARTY'
|
|
58
|
+
| 'WAITING_CONFIRMATIONS';
|
|
59
|
+
|
|
60
|
+
export type RefreshFilter = {
|
|
61
|
+
status: RefreshTransferStatus;
|
|
62
|
+
incoming: boolean;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type WitnessData = {
|
|
66
|
+
amountSat: number;
|
|
67
|
+
blinding?: number;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export type Recipient = {
|
|
71
|
+
recipientId: string;
|
|
72
|
+
witnessData?: WitnessData;
|
|
73
|
+
assignment: Assignment;
|
|
74
|
+
transportEndpoints: string[];
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export type Media = {
|
|
78
|
+
filePath: string;
|
|
79
|
+
mime: string;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type AssetCfa = {
|
|
83
|
+
assetId: string;
|
|
84
|
+
name: string;
|
|
85
|
+
details?: string;
|
|
86
|
+
precision: number;
|
|
87
|
+
issuedSupply: number;
|
|
88
|
+
timestamp: number;
|
|
89
|
+
addedAt: number;
|
|
90
|
+
balance: Balance;
|
|
91
|
+
media?: Media;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export type AssetIfa = {
|
|
95
|
+
assetId: string;
|
|
96
|
+
ticker: string;
|
|
97
|
+
name: string;
|
|
98
|
+
details?: string;
|
|
99
|
+
precision: number;
|
|
100
|
+
initialSupply: number;
|
|
101
|
+
maxSupply: number;
|
|
102
|
+
knownCirculatingSupply: number;
|
|
103
|
+
timestamp: number;
|
|
104
|
+
addedAt: number;
|
|
105
|
+
balance: Balance;
|
|
106
|
+
media?: Media;
|
|
107
|
+
rejectListUrl?: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
export type AssetNia = {
|
|
111
|
+
assetId: string;
|
|
112
|
+
ticker: string;
|
|
113
|
+
name: string;
|
|
114
|
+
precision: number;
|
|
115
|
+
amounts: number;
|
|
116
|
+
timestamp: number;
|
|
117
|
+
addedAt: number;
|
|
118
|
+
balance: Balance;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export type AssetUda = {
|
|
122
|
+
assetId: string;
|
|
123
|
+
ticker: string;
|
|
124
|
+
name: string;
|
|
125
|
+
details?: string;
|
|
126
|
+
precision: number;
|
|
127
|
+
timestamp: number;
|
|
128
|
+
addedAt: number;
|
|
129
|
+
balance: Balance;
|
|
130
|
+
media?: Media;
|
|
131
|
+
attachments: Array<{
|
|
132
|
+
filePath: string;
|
|
133
|
+
mime: string;
|
|
134
|
+
}>;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type Assets = {
|
|
138
|
+
nia: AssetNia[];
|
|
139
|
+
uda: AssetUda[];
|
|
140
|
+
cfa: AssetCfa[];
|
|
141
|
+
ifa: AssetIfa[];
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export type OperationResult = {
|
|
145
|
+
txid: string;
|
|
146
|
+
batchTransferIdx: number;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export type ReceiveData = {
|
|
150
|
+
invoice: string;
|
|
151
|
+
recipientId: string;
|
|
152
|
+
expirationTimestamp: number | null;
|
|
153
|
+
batchTransferIdx: number;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export type InvoiceData = {
|
|
157
|
+
invoice: string;
|
|
158
|
+
recipientId: string;
|
|
159
|
+
assetSchema: AssetSchema | null;
|
|
160
|
+
assetId: string | null;
|
|
161
|
+
assignment: Assignment;
|
|
162
|
+
assignmentName: string | null;
|
|
163
|
+
network: BitcoinNetwork;
|
|
164
|
+
expirationTimestamp: number | null;
|
|
165
|
+
transportEndpoints: string[];
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export type Transaction = {
|
|
169
|
+
transactionType: 'RGB_SEND' | 'DRAIN' | 'CREATE_UTXOS' | 'USER';
|
|
170
|
+
txid: string;
|
|
171
|
+
received: number;
|
|
172
|
+
sent: number;
|
|
173
|
+
fee: number;
|
|
174
|
+
confirmationTime?: number;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type Transfer = {
|
|
178
|
+
transferIdx: number;
|
|
179
|
+
batchTransferIdx: number;
|
|
180
|
+
createdAt: number;
|
|
181
|
+
updatedAt: number;
|
|
182
|
+
kind: 'ISSUANCE' | 'RECEIVE_BLIND' | 'RECEIVE_WITNESS' | 'SEND' | 'INFLATION';
|
|
183
|
+
status:
|
|
184
|
+
| 'WAITING_COUNTERPARTY'
|
|
185
|
+
| 'WAITING_CONFIRMATIONS'
|
|
186
|
+
| 'SETTLED'
|
|
187
|
+
| 'FAILED';
|
|
188
|
+
txid?: string;
|
|
189
|
+
recipientId?: string;
|
|
190
|
+
receiveUtxo?: number;
|
|
191
|
+
changeUtxo?: number;
|
|
192
|
+
expiration?: number;
|
|
193
|
+
transportEndpoints: string;
|
|
194
|
+
invoiceString?: string;
|
|
195
|
+
consignmentPath?: string;
|
|
196
|
+
assignments: number;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export type Unspent = {
|
|
200
|
+
utxo: string;
|
|
201
|
+
vout: number;
|
|
202
|
+
amount: number;
|
|
203
|
+
colorable: string;
|
|
204
|
+
rgbAllocations: number;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export type RefreshedTransfer = {
|
|
208
|
+
updatedStatus?:
|
|
209
|
+
| 'WAITING_COUNTERPARTY'
|
|
210
|
+
| 'WAITING_CONFIRMATIONS'
|
|
211
|
+
| 'SETTLED'
|
|
212
|
+
| 'FAILED';
|
|
213
|
+
failure?: string;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export type WalletData = {
|
|
217
|
+
dataDir: string;
|
|
218
|
+
bitcoinNetwork: string;
|
|
219
|
+
databaseType: string;
|
|
220
|
+
maxAllocationsPerUtxo: number;
|
|
221
|
+
accountXpubVanilla: string;
|
|
222
|
+
accountXpubColored: string;
|
|
223
|
+
mnemonic?: string;
|
|
224
|
+
masterFingerprint: string;
|
|
225
|
+
vanillaKeychain?: number;
|
|
226
|
+
supportedSchemas: string[];
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export type AssetMetadata = {
|
|
230
|
+
assetId: string;
|
|
231
|
+
name: string;
|
|
232
|
+
ticker?: string;
|
|
233
|
+
details?: string;
|
|
234
|
+
precision?: number;
|
|
235
|
+
issuedSupply?: number;
|
|
236
|
+
timestamp?: number;
|
|
237
|
+
amounts?: number[];
|
|
238
|
+
assetNia?: AssetNia;
|
|
239
|
+
assetUda?: AssetUda;
|
|
240
|
+
assetCfa?: AssetCfa;
|
|
241
|
+
assetIfa?: AssetIfa;
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Error types that can be returned by RGB library methods.
|
|
246
|
+
* These correspond to the RgbLibError
|
|
247
|
+
* Errors with associated values are represented as objects with the error name and associated data.
|
|
248
|
+
*/
|
|
249
|
+
export type RgbLibErrors =
|
|
250
|
+
| 'AllocationsAlreadyAvailable'
|
|
251
|
+
| { type: 'AssetNotFound'; assetId: string }
|
|
252
|
+
| { type: 'BatchTransferNotFound'; idx: number }
|
|
253
|
+
| 'BitcoinNetworkMismatch'
|
|
254
|
+
| 'CannotChangeOnline'
|
|
255
|
+
| 'CannotDeleteBatchTransfer'
|
|
256
|
+
| 'CannotEstimateFees'
|
|
257
|
+
| 'CannotFailBatchTransfer'
|
|
258
|
+
| 'CannotFinalizePsbt'
|
|
259
|
+
| 'CannotUseIfaOnMainnet'
|
|
260
|
+
| { type: 'EmptyFile'; filePath: string }
|
|
261
|
+
| { type: 'FailedBdkSync'; details: string }
|
|
262
|
+
| { type: 'FailedBroadcast'; details: string }
|
|
263
|
+
| { type: 'FailedIssuance'; details: string }
|
|
264
|
+
| { type: 'FileAlreadyExists'; path: string }
|
|
265
|
+
| 'FingerprintMismatch'
|
|
266
|
+
| { type: 'Io'; details: string }
|
|
267
|
+
| { type: 'Inconsistency'; details: string }
|
|
268
|
+
| { type: 'Indexer'; details: string }
|
|
269
|
+
| 'InexistentDataDir'
|
|
270
|
+
| 'InsufficientAllocationSlots'
|
|
271
|
+
| { type: 'InsufficientAssignments'; assetId: string; available: unknown }
|
|
272
|
+
| { type: 'InsufficientBitcoins'; needed: number; available: number }
|
|
273
|
+
| { type: 'Internal'; details: string }
|
|
274
|
+
| { type: 'InvalidAddress'; details: string }
|
|
275
|
+
| 'InvalidAmountZero'
|
|
276
|
+
| { type: 'InvalidAssetId'; assetId: string }
|
|
277
|
+
| 'InvalidAssignment'
|
|
278
|
+
| { type: 'InvalidAttachments'; details: string }
|
|
279
|
+
| 'InvalidBitcoinKeys'
|
|
280
|
+
| { type: 'InvalidBitcoinNetwork'; network: string }
|
|
281
|
+
| { type: 'InvalidColoringInfo'; details: string }
|
|
282
|
+
| 'InvalidConsignment'
|
|
283
|
+
| { type: 'InvalidDetails'; details: string }
|
|
284
|
+
| { type: 'InvalidElectrum'; details: string }
|
|
285
|
+
| 'InvalidEstimationBlocks'
|
|
286
|
+
| { type: 'InvalidFeeRate'; details: string }
|
|
287
|
+
| { type: 'InvalidFilePath'; filePath: string }
|
|
288
|
+
| 'InvalidFingerprint'
|
|
289
|
+
| { type: 'InvalidIndexer'; details: string }
|
|
290
|
+
| { type: 'InvalidInvoice'; details: string }
|
|
291
|
+
| { type: 'InvalidMnemonic'; details: string }
|
|
292
|
+
| { type: 'InvalidName'; details: string }
|
|
293
|
+
| { type: 'InvalidPrecision'; details: string }
|
|
294
|
+
| { type: 'InvalidProxyProtocol'; version: string }
|
|
295
|
+
| { type: 'InvalidPsbt'; details: string }
|
|
296
|
+
| { type: 'InvalidPubkey'; details: string }
|
|
297
|
+
| { type: 'InvalidRecipientData'; details: string }
|
|
298
|
+
| 'InvalidRecipientId'
|
|
299
|
+
| 'InvalidRecipientNetwork'
|
|
300
|
+
| { type: 'InvalidRejectListUrl'; details: string }
|
|
301
|
+
| { type: 'InvalidTicker'; details: string }
|
|
302
|
+
| { type: 'InvalidTransportEndpoint'; details: string }
|
|
303
|
+
| { type: 'InvalidTransportEndpoints'; details: string }
|
|
304
|
+
| 'InvalidTxid'
|
|
305
|
+
| 'InvalidVanillaKeychain'
|
|
306
|
+
| { type: 'MaxFeeExceeded'; txid: string }
|
|
307
|
+
| { type: 'MinFeeNotMet'; txid: string }
|
|
308
|
+
| { type: 'Network'; details: string }
|
|
309
|
+
| 'NoConsignment'
|
|
310
|
+
| 'NoInflationAmounts'
|
|
311
|
+
| 'NoIssuanceAmounts'
|
|
312
|
+
| 'NoSupportedSchemas'
|
|
313
|
+
| 'NoValidTransportEndpoint'
|
|
314
|
+
| 'Offline'
|
|
315
|
+
| 'OnlineNeeded'
|
|
316
|
+
| 'OutputBelowDustLimit'
|
|
317
|
+
| { type: 'Proxy'; details: string }
|
|
318
|
+
| 'RecipientIdAlreadyUsed'
|
|
319
|
+
| 'RecipientIdDuplicated'
|
|
320
|
+
| { type: 'RejectListService'; details: string }
|
|
321
|
+
| { type: 'RestClientBuild'; details: string }
|
|
322
|
+
| 'TooHighInflationAmounts'
|
|
323
|
+
| 'TooHighIssuanceAmounts'
|
|
324
|
+
| { type: 'UnknownRgbSchema'; schemaId: string }
|
|
325
|
+
| { type: 'UnknownTransfer'; txid: string }
|
|
326
|
+
| { type: 'UnsupportedBackupVersion'; version: string }
|
|
327
|
+
| { type: 'UnsupportedInflation'; assetSchema: string }
|
|
328
|
+
| { type: 'UnsupportedLayer1'; layer1: string }
|
|
329
|
+
| { type: 'UnsupportedSchema'; assetSchema: string }
|
|
330
|
+
| 'UnsupportedTransportType'
|
|
331
|
+
| { type: 'WalletDirAlreadyExists'; path: string }
|
|
332
|
+
| 'WatchOnly'
|
|
333
|
+
| 'WrongPassword';
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Constants for all RGB library errors.
|
|
337
|
+
* Use these for error code comparison and type safety.
|
|
338
|
+
*/
|
|
339
|
+
export const RgbLibErrors = {
|
|
340
|
+
AllocationsAlreadyAvailable: 'AllocationsAlreadyAvailable' as const,
|
|
341
|
+
BitcoinNetworkMismatch: 'BitcoinNetworkMismatch' as const,
|
|
342
|
+
CannotChangeOnline: 'CannotChangeOnline' as const,
|
|
343
|
+
CannotDeleteBatchTransfer: 'CannotDeleteBatchTransfer' as const,
|
|
344
|
+
CannotEstimateFees: 'CannotEstimateFees' as const,
|
|
345
|
+
CannotFailBatchTransfer: 'CannotFailBatchTransfer' as const,
|
|
346
|
+
CannotFinalizePsbt: 'CannotFinalizePsbt' as const,
|
|
347
|
+
CannotUseIfaOnMainnet: 'CannotUseIfaOnMainnet' as const,
|
|
348
|
+
FingerprintMismatch: 'FingerprintMismatch' as const,
|
|
349
|
+
InexistentDataDir: 'InexistentDataDir' as const,
|
|
350
|
+
InsufficientAllocationSlots: 'InsufficientAllocationSlots' as const,
|
|
351
|
+
InvalidAmountZero: 'InvalidAmountZero' as const,
|
|
352
|
+
InvalidAssignment: 'InvalidAssignment' as const,
|
|
353
|
+
InvalidBitcoinKeys: 'InvalidBitcoinKeys' as const,
|
|
354
|
+
InvalidConsignment: 'InvalidConsignment' as const,
|
|
355
|
+
InvalidEstimationBlocks: 'InvalidEstimationBlocks' as const,
|
|
356
|
+
InvalidFingerprint: 'InvalidFingerprint' as const,
|
|
357
|
+
InvalidRecipientId: 'InvalidRecipientId' as const,
|
|
358
|
+
InvalidRecipientNetwork: 'InvalidRecipientNetwork' as const,
|
|
359
|
+
InvalidTxid: 'InvalidTxid' as const,
|
|
360
|
+
InvalidVanillaKeychain: 'InvalidVanillaKeychain' as const,
|
|
361
|
+
NoConsignment: 'NoConsignment' as const,
|
|
362
|
+
NoInflationAmounts: 'NoInflationAmounts' as const,
|
|
363
|
+
NoIssuanceAmounts: 'NoIssuanceAmounts' as const,
|
|
364
|
+
NoSupportedSchemas: 'NoSupportedSchemas' as const,
|
|
365
|
+
NoValidTransportEndpoint: 'NoValidTransportEndpoint' as const,
|
|
366
|
+
Offline: 'Offline' as const,
|
|
367
|
+
OnlineNeeded: 'OnlineNeeded' as const,
|
|
368
|
+
OutputBelowDustLimit: 'OutputBelowDustLimit' as const,
|
|
369
|
+
RecipientIdAlreadyUsed: 'RecipientIdAlreadyUsed' as const,
|
|
370
|
+
RecipientIdDuplicated: 'RecipientIdDuplicated' as const,
|
|
371
|
+
TooHighInflationAmounts: 'TooHighInflationAmounts' as const,
|
|
372
|
+
TooHighIssuanceAmounts: 'TooHighIssuanceAmounts' as const,
|
|
373
|
+
UnsupportedTransportType: 'UnsupportedTransportType' as const,
|
|
374
|
+
WatchOnly: 'WatchOnly' as const,
|
|
375
|
+
WrongPassword: 'WrongPassword' as const,
|
|
376
|
+
} as const;
|