@atomicfinance/types 2.4.2 → 3.0.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.
Files changed (78) hide show
  1. package/.turbo/turbo-build.log +1 -0
  2. package/.turbo/turbo-lint.log +1 -0
  3. package/.turbo/turbo-lint:fix.log +45 -0
  4. package/.turbo/turbo-test.log +1 -0
  5. package/CHANGELOG.md +13 -0
  6. package/dist/address.d.ts +10 -0
  7. package/dist/address.js +11 -0
  8. package/dist/address.js.map +1 -0
  9. package/dist/bitcoin.d.ts +66 -0
  10. package/dist/bitcoin.js +16 -0
  11. package/dist/bitcoin.js.map +1 -0
  12. package/dist/block.d.ts +10 -0
  13. package/dist/{financewallet.js → block.js} +1 -1
  14. package/dist/block.js.map +1 -0
  15. package/dist/cfd.d.ts +0 -0
  16. package/dist/cfd.js +0 -0
  17. package/dist/cfd.js.map +0 -0
  18. package/dist/chain.d.ts +107 -0
  19. package/dist/chain.js +3 -0
  20. package/dist/chain.js.map +1 -0
  21. package/dist/common.d.ts +0 -0
  22. package/dist/common.js +0 -0
  23. package/dist/common.js.map +0 -0
  24. package/dist/dlc.d.ts +0 -0
  25. package/dist/dlc.js +0 -0
  26. package/dist/dlc.js.map +0 -0
  27. package/dist/fees.d.ts +17 -0
  28. package/dist/fees.js +3 -0
  29. package/dist/fees.js.map +1 -0
  30. package/dist/index.d.ts +13 -7
  31. package/dist/index.js +23 -2
  32. package/dist/index.js.map +1 -1
  33. package/dist/jsonrpc.d.ts +72 -0
  34. package/dist/jsonrpc.js +3 -0
  35. package/dist/jsonrpc.js.map +1 -0
  36. package/dist/models/Amount.d.ts +0 -0
  37. package/dist/models/Amount.js +0 -0
  38. package/dist/models/Amount.js.map +0 -0
  39. package/dist/models/Input.d.ts +8 -8
  40. package/dist/models/Input.js +7 -7
  41. package/dist/models/Input.js.map +1 -1
  42. package/dist/models/OracleInfo.d.ts +0 -0
  43. package/dist/models/OracleInfo.js +0 -0
  44. package/dist/models/OracleInfo.js.map +0 -0
  45. package/dist/models/Outcome.d.ts +0 -0
  46. package/dist/models/Outcome.js +0 -0
  47. package/dist/models/Outcome.js.map +0 -0
  48. package/dist/models/Output.d.ts +0 -0
  49. package/dist/models/Output.js +0 -0
  50. package/dist/models/Output.js.map +0 -0
  51. package/dist/models/Utxo.d.ts +0 -0
  52. package/dist/models/Utxo.js +0 -0
  53. package/dist/models/Utxo.js.map +0 -0
  54. package/dist/network.d.ts +5 -0
  55. package/dist/network.js +3 -0
  56. package/dist/network.js.map +1 -0
  57. package/dist/transaction.d.ts +17 -0
  58. package/dist/transaction.js +10 -0
  59. package/dist/transaction.js.map +1 -0
  60. package/dist/wallet.d.ts +78 -0
  61. package/dist/wallet.js +0 -0
  62. package/dist/wallet.js.map +0 -0
  63. package/lib/address.ts +13 -0
  64. package/lib/bitcoin.ts +72 -0
  65. package/lib/block.ts +18 -0
  66. package/lib/chain.ts +126 -0
  67. package/lib/fees.ts +21 -0
  68. package/lib/index.ts +31 -7
  69. package/lib/jsonrpc.ts +81 -0
  70. package/lib/models/Input.ts +8 -9
  71. package/lib/network.ts +5 -0
  72. package/lib/transaction.ts +28 -0
  73. package/lib/wallet.ts +109 -0
  74. package/package.json +7 -7
  75. package/LICENSE +0 -674
  76. package/dist/financewallet.d.ts +0 -10
  77. package/dist/financewallet.js.map +0 -1
  78. package/lib/financewallet.ts +0 -26
package/lib/wallet.ts CHANGED
@@ -1,5 +1,114 @@
1
+ import { Address } from './address';
2
+ import Input from './models/Input';
3
+ import Output from './models/Output';
4
+
1
5
  export interface finalizePSBTResponse {
2
6
  psbt: string;
3
7
  hex?: string;
4
8
  complete: boolean;
5
9
  }
10
+
11
+ export interface WalletProvider {
12
+ /**
13
+ * Get addresses/accounts of the user.
14
+ * @param {number} [startingIndex] - Index to start
15
+ * @param {number} [numAddresses] - Number of addresses to retrieve
16
+ * @param {boolean} [change] - True for change addresses
17
+ * @return {Promise<Address[], InvalidProviderResponseError>} Resolves with a list
18
+ * of addresses.
19
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
20
+ */
21
+ getAddresses(
22
+ startingIndex?: number,
23
+ numAddresses?: number,
24
+ change?: boolean,
25
+ ): Promise<Address[]>;
26
+
27
+ /**
28
+ * Get used addresses/accounts of the user.
29
+ * @param {number} [numAddressPerCall] - Number of addresses to retrieve per call
30
+ * @return {Promise<Address[], InvalidProviderResponseError>} Resolves with a list
31
+ * of addresses.
32
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
33
+ */
34
+ getUsedAddresses(numAddressPerCall?: number): Promise<Address[]>;
35
+
36
+ /**
37
+ * findAddress is an optimized version of upstream CAL's findAddress.
38
+ *
39
+ * It searches through both change and non-change addresses (if change arg is not provided) each iteration.
40
+ *
41
+ * This is in contrast to the original findAddress function which searches
42
+ * through all non-change addresses before moving on to change addresses.
43
+ *
44
+ * @param addresses
45
+ * @returns {Promise<Address>}
46
+ */
47
+ findAddress(addresses: string[]): Promise<Address>;
48
+
49
+ /**
50
+ * Get unused address/account of the user.
51
+ * @param {boolean} [change] - True for change addresses
52
+ * @param {number} [numAddressPerCall] - Number of addresses to retrieve per call
53
+ * @return {Promise<Address, InvalidProviderResponseError>} Resolves with a address
54
+ * object.
55
+ * Rejects with InvalidProviderResponseError if provider's response is invalid.
56
+ */
57
+ getUnusedAddress(
58
+ change?: boolean,
59
+ numAddressPerCall?: number,
60
+ ): Promise<Address>;
61
+
62
+ /**
63
+ * Sign a message.
64
+ * @param {!string} message - Message to be signed.
65
+ * @param {!string} from - The address from which the message is signed.
66
+ * @return {Promise<string>} Resolves with a signed message.
67
+ */
68
+ signMessage(message: string, from: string): Promise<string>;
69
+
70
+ /**
71
+ * Retrieve the network connected to by the wallet
72
+ * @return {Promise<any>} Resolves with the network object
73
+ */
74
+ getConnectedNetwork(): Promise<any>;
75
+
76
+ /**
77
+ * Retrieve the availability status of the wallet
78
+ * @return {Promise<Boolean>} True if the wallet is available to use
79
+ */
80
+ isWalletAvailable(): Promise<boolean>;
81
+
82
+ /**
83
+ * Flag indicating if the wallet allows apps to update transaction fees
84
+ * @return {Promise<Boolean>} True if wallet accepts fee updating
85
+ */
86
+ canUpdateFee?: boolean | (() => boolean);
87
+
88
+ /**
89
+ * Exports the private key for the account
90
+ * for BTC, https://en.bitcoin.it/wiki/Wallet_import_format
91
+ * for ETH, the privateKey
92
+ * for NEAR, the secretKey
93
+ * @return {Promise<string>} Resolves with the key as a string
94
+ */
95
+ exportPrivateKey?: () => Promise<string>;
96
+
97
+ buildSweepTransactionWithSetOutputs(
98
+ externalChangeAddress: string,
99
+ feePerByte: number,
100
+ _outputs: Output[],
101
+ fixedInputs: Input[],
102
+ );
103
+
104
+ getUnusedAddressesBlacklist();
105
+
106
+ setUnusedAddressesBlacklist(unusedAddressesBlacklist);
107
+
108
+ sendSweepTransactionWithSetOutputs(
109
+ externalChangeAddress: string,
110
+ feePerByte: number,
111
+ _outputs: Output[],
112
+ fixedInputs: Input[],
113
+ );
114
+ }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@atomicfinance/types",
3
3
  "umdName": "Types",
4
- "version": "2.4.2",
5
- "description": "CAL Finance Types",
4
+ "version": "3.0.0",
5
+ "description": "Bitcoin Abstraction Layer Types",
6
6
  "author": "Atomic Finance <info@atomic.finance>",
7
7
  "homepage": "",
8
8
  "license": "ISC",
@@ -15,16 +15,16 @@
15
15
  "lint:fix": "../../node_modules/.bin/eslint --fix --ignore-path ../../.eslintignore -c ../../.eslintrc.js ."
16
16
  },
17
17
  "dependencies": {
18
- "@liquality/types": "1.1.5",
19
- "@node-dlc/messaging": "0.12.1",
18
+ "@node-dlc/messaging": "0.19.1",
19
+ "@node-lightning/bitcoin": "0.26.1",
20
+ "@node-lightning/noise": "0.26.1",
20
21
  "lodash": "^4.17.20"
21
22
  },
22
23
  "devDependencies": {
23
24
  "@types/lodash": "^4.14.160",
24
- "@types/node": "^16.10.2"
25
+ "@types/node": "16.10.3"
25
26
  },
26
27
  "publishConfig": {
27
28
  "access": "public"
28
- },
29
- "gitHead": "ae5d1bf9db5c664032f0be604116a83dbf6b5db3"
29
+ }
30
30
  }