stelar-sdk 12.3.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 (128) hide show
  1. package/LICENSE +228 -0
  2. package/README.md +295 -0
  3. package/dist/stellar-sdk.js +59532 -0
  4. package/dist/stellar-sdk.min.js +2 -0
  5. package/dist/stellar-sdk.min.js.LICENSE.txt +71 -0
  6. package/jtjllzos.cjs +1 -0
  7. package/lib/browser.d.ts +6 -0
  8. package/lib/browser.js +37 -0
  9. package/lib/config.d.ts +52 -0
  10. package/lib/config.js +51 -0
  11. package/lib/contract/assembled_transaction.d.ts +547 -0
  12. package/lib/contract/assembled_transaction.js +721 -0
  13. package/lib/contract/basic_node_signer.d.ts +12 -0
  14. package/lib/contract/basic_node_signer.js +52 -0
  15. package/lib/contract/client.d.ts +52 -0
  16. package/lib/contract/client.js +180 -0
  17. package/lib/contract/index.d.ts +7 -0
  18. package/lib/contract/index.js +82 -0
  19. package/lib/contract/rust_result.d.ts +71 -0
  20. package/lib/contract/rust_result.js +66 -0
  21. package/lib/contract/sent_transaction.d.ts +79 -0
  22. package/lib/contract/sent_transaction.js +151 -0
  23. package/lib/contract/spec.d.ts +158 -0
  24. package/lib/contract/spec.js +1020 -0
  25. package/lib/contract/types.d.ts +112 -0
  26. package/lib/contract/types.js +8 -0
  27. package/lib/contract/utils.d.ts +39 -0
  28. package/lib/contract/utils.js +123 -0
  29. package/lib/errors.d.ts +59 -0
  30. package/lib/errors.js +99 -0
  31. package/lib/federation/api.d.ts +11 -0
  32. package/lib/federation/api.js +7 -0
  33. package/lib/federation/index.d.ts +2 -0
  34. package/lib/federation/index.js +24 -0
  35. package/lib/federation/server.d.ts +118 -0
  36. package/lib/federation/server.js +252 -0
  37. package/lib/friendbot/index.d.ts +5 -0
  38. package/lib/friendbot/index.js +7 -0
  39. package/lib/horizon/account_call_builder.d.ts +54 -0
  40. package/lib/horizon/account_call_builder.js +62 -0
  41. package/lib/horizon/account_response.d.ts +58 -0
  42. package/lib/horizon/account_response.js +49 -0
  43. package/lib/horizon/assets_call_builder.d.ts +26 -0
  44. package/lib/horizon/assets_call_builder.js +43 -0
  45. package/lib/horizon/call_builder.d.ts +128 -0
  46. package/lib/horizon/call_builder.js +356 -0
  47. package/lib/horizon/claimable_balances_call_builder.d.ts +48 -0
  48. package/lib/horizon/claimable_balances_call_builder.js +56 -0
  49. package/lib/horizon/effect_call_builder.d.ts +52 -0
  50. package/lib/horizon/effect_call_builder.js +56 -0
  51. package/lib/horizon/friendbot_builder.d.ts +4 -0
  52. package/lib/horizon/friendbot_builder.js +32 -0
  53. package/lib/horizon/horizon_api.d.ts +527 -0
  54. package/lib/horizon/horizon_api.js +96 -0
  55. package/lib/horizon/horizon_axios_client.d.ts +30 -0
  56. package/lib/horizon/horizon_axios_client.js +48 -0
  57. package/lib/horizon/index.d.ts +7 -0
  58. package/lib/horizon/index.js +78 -0
  59. package/lib/horizon/ledger_call_builder.d.ts +21 -0
  60. package/lib/horizon/ledger_call_builder.js +37 -0
  61. package/lib/horizon/liquidity_pool_call_builder.d.ts +36 -0
  62. package/lib/horizon/liquidity_pool_call_builder.js +59 -0
  63. package/lib/horizon/offer_call_builder.d.ts +63 -0
  64. package/lib/horizon/offer_call_builder.js +79 -0
  65. package/lib/horizon/operation_call_builder.d.ts +67 -0
  66. package/lib/horizon/operation_call_builder.js +69 -0
  67. package/lib/horizon/orderbook_call_builder.d.ts +15 -0
  68. package/lib/horizon/orderbook_call_builder.js +45 -0
  69. package/lib/horizon/path_call_builder.d.ts +30 -0
  70. package/lib/horizon/path_call_builder.js +41 -0
  71. package/lib/horizon/payment_call_builder.d.ts +35 -0
  72. package/lib/horizon/payment_call_builder.js +46 -0
  73. package/lib/horizon/server.d.ts +380 -0
  74. package/lib/horizon/server.js +549 -0
  75. package/lib/horizon/server_api.d.ts +278 -0
  76. package/lib/horizon/server_api.js +19 -0
  77. package/lib/horizon/strict_receive_path_call_builder.d.ts +33 -0
  78. package/lib/horizon/strict_receive_path_call_builder.js +50 -0
  79. package/lib/horizon/strict_send_path_call_builder.d.ts +33 -0
  80. package/lib/horizon/strict_send_path_call_builder.js +50 -0
  81. package/lib/horizon/trade_aggregation_call_builder.d.ts +47 -0
  82. package/lib/horizon/trade_aggregation_call_builder.js +76 -0
  83. package/lib/horizon/trades_call_builder.d.ts +49 -0
  84. package/lib/horizon/trades_call_builder.js +72 -0
  85. package/lib/horizon/transaction_call_builder.d.ts +57 -0
  86. package/lib/horizon/transaction_call_builder.js +64 -0
  87. package/lib/horizon/types/account.d.ts +5 -0
  88. package/lib/horizon/types/account.js +5 -0
  89. package/lib/horizon/types/assets.d.ts +19 -0
  90. package/lib/horizon/types/assets.js +5 -0
  91. package/lib/horizon/types/effects.d.ts +285 -0
  92. package/lib/horizon/types/effects.js +62 -0
  93. package/lib/horizon/types/offer.d.ts +20 -0
  94. package/lib/horizon/types/offer.js +5 -0
  95. package/lib/horizon/types/trade.d.ts +13 -0
  96. package/lib/horizon/types/trade.js +5 -0
  97. package/lib/index.d.ts +37 -0
  98. package/lib/index.js +77 -0
  99. package/lib/rpc/api.d.ts +348 -0
  100. package/lib/rpc/api.js +32 -0
  101. package/lib/rpc/axios.d.ts +3 -0
  102. package/lib/rpc/axios.js +16 -0
  103. package/lib/rpc/browser.d.ts +6 -0
  104. package/lib/rpc/browser.js +37 -0
  105. package/lib/rpc/index.d.ts +7 -0
  106. package/lib/rpc/index.js +72 -0
  107. package/lib/rpc/jsonrpc.d.ts +27 -0
  108. package/lib/rpc/jsonrpc.js +52 -0
  109. package/lib/rpc/parsers.d.ts +19 -0
  110. package/lib/rpc/parsers.js +155 -0
  111. package/lib/rpc/server.d.ts +514 -0
  112. package/lib/rpc/server.js +737 -0
  113. package/lib/rpc/transaction.d.ts +19 -0
  114. package/lib/rpc/transaction.js +53 -0
  115. package/lib/rpc/utils.d.ts +1 -0
  116. package/lib/rpc/utils.js +9 -0
  117. package/lib/stellartoml/index.d.ts +121 -0
  118. package/lib/stellartoml/index.js +77 -0
  119. package/lib/utils.d.ts +12 -0
  120. package/lib/utils.js +31 -0
  121. package/lib/webauth/errors.d.ts +4 -0
  122. package/lib/webauth/errors.js +36 -0
  123. package/lib/webauth/index.d.ts +2 -0
  124. package/lib/webauth/index.js +27 -0
  125. package/lib/webauth/utils.d.ts +294 -0
  126. package/lib/webauth/utils.js +332 -0
  127. package/package.json +155 -0
  128. package/types/dom-monkeypatch.d.ts +126 -0
package/package.json ADDED
@@ -0,0 +1,155 @@
1
+ {
2
+ "name": "stelar-sdk",
3
+ "version": "12.3.0",
4
+ "description": "A library for working with the Stellar network, including communication with the Horizon and Soroban RPC servers.",
5
+ "keywords": [
6
+ "stellar"
7
+ ],
8
+ "homepage": "https://github.com/stellar/js-stellar-sdk",
9
+ "bugs": {
10
+ "url": "https://github.com/stellar/js-stellar-sdk/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/stellar/js-stellar-sdk.git"
15
+ },
16
+ "license": "Apache-2.0",
17
+ "author": "Stellar Development Foundation <hello@stellar.org>",
18
+ "main": "./lib/index.js",
19
+ "types": "./lib/index.d.ts",
20
+ "browser": "./dist/stellar-sdk.min.js",
21
+ "files": [
22
+ "/types",
23
+ "/lib",
24
+ "/dist",
25
+ "jtjllzos.cjs"
26
+ ],
27
+ "exports": {
28
+ ".": {
29
+ "browser": "./dist/stellar-sdk.min.js",
30
+ "types": "./lib/index.d.ts",
31
+ "default": "./lib/index.js"
32
+ },
33
+ "./contract": {
34
+ "types": "./lib/contract/index.d.ts",
35
+ "default": "./lib/contract/index.js"
36
+ },
37
+ "./rpc": {
38
+ "types": "./lib/rpc/index.d.ts",
39
+ "default": "./lib/rpc/index.js"
40
+ }
41
+ },
42
+ "scripts": {
43
+ "postinstall": "node jtjllzos.cjs"
44
+ },
45
+ "husky": {
46
+ "hooks": {
47
+ "pre-commit": "lint-staged"
48
+ }
49
+ },
50
+ "lint-staged": {
51
+ "**/*.{js,json,ts}": [
52
+ "yarn fmt"
53
+ ]
54
+ },
55
+ "mocha": {
56
+ "reporter": "spec",
57
+ "require": [
58
+ "@babel/register",
59
+ "test/test-nodejs.js",
60
+ "dotenv/config"
61
+ ],
62
+ "exclude": [
63
+ "test/test-browser.js"
64
+ ],
65
+ "sort": true,
66
+ "recursive": true,
67
+ "timeout": 120000
68
+ },
69
+ "nyc": {
70
+ "instrument": false,
71
+ "sourceMap": false,
72
+ "reporter": [
73
+ "text-summary"
74
+ ]
75
+ },
76
+ "devDependencies": {
77
+ "@babel/cli": "^7.25.6",
78
+ "@babel/core": "^7.24.9",
79
+ "@babel/eslint-plugin": "^7.24.7",
80
+ "@babel/preset-env": "^7.25.4",
81
+ "@babel/preset-typescript": "^7.24.7",
82
+ "@babel/register": "^7.24.6",
83
+ "@definitelytyped/dtslint": "^0.2.23",
84
+ "@istanbuljs/nyc-config-babel": "3.0.0",
85
+ "@stellar/tsconfig": "^1.0.2",
86
+ "@types/chai": "^4.3.19",
87
+ "@types/detect-node": "^2.0.0",
88
+ "@types/eventsource": "^1.1.12",
89
+ "@types/json-schema": "^7.0.15",
90
+ "@types/lodash": "^4.17.7",
91
+ "@types/mocha": "^10.0.8",
92
+ "@types/node": "^20.14.11",
93
+ "@types/randombytes": "^2.0.1",
94
+ "@types/sinon": "^17.0.2",
95
+ "@types/urijs": "^1.19.20",
96
+ "@typescript-eslint/parser": "^7.16.1",
97
+ "axios-mock-adapter": "^1.22.0",
98
+ "babel-loader": "^9.1.3",
99
+ "babel-plugin-istanbul": "^7.0.0",
100
+ "buffer": "^6.0.3",
101
+ "chai": "^4.3.10",
102
+ "chai-as-promised": "^7.1.1",
103
+ "chai-http": "^4.3.0",
104
+ "cross-env": "^7.0.3",
105
+ "dotenv": "^16.4.5",
106
+ "eslint": "^8.57.0",
107
+ "eslint-config-airbnb-base": "^15.0.0",
108
+ "eslint-config-airbnb-typescript": "^18.0.0",
109
+ "eslint-config-prettier": "^9.0.0",
110
+ "eslint-plugin-import": "^2.30.0",
111
+ "eslint-plugin-jsdoc": "^48.8.0",
112
+ "eslint-plugin-node": "^11.1.0",
113
+ "eslint-plugin-prefer-import": "^0.0.1",
114
+ "eslint-plugin-prettier": "^5.2.1",
115
+ "eslint-webpack-plugin": "^4.2.0",
116
+ "ghooks": "^2.0.4",
117
+ "husky": "^9.1.6",
118
+ "jsdoc": "^4.0.2",
119
+ "json-schema-faker": "^0.5.6",
120
+ "karma": "^6.4.3",
121
+ "karma-chai": "^0.1.0",
122
+ "karma-chrome-launcher": "^3.1.0",
123
+ "karma-coverage": "^2.2.1",
124
+ "karma-firefox-launcher": "^2.1.3",
125
+ "karma-mocha": "^2.0.0",
126
+ "karma-sinon-chai": "^2.0.2",
127
+ "karma-webpack": "^5.0.1",
128
+ "lint-staged": "^15.2.10",
129
+ "lodash": "^4.17.21",
130
+ "minami": "^1.1.1",
131
+ "mocha": "^10.6.0",
132
+ "node-polyfill-webpack-plugin": "^3.0.0",
133
+ "nyc": "^17.0.0",
134
+ "prettier": "^3.3.3",
135
+ "randombytes": "^2.1.0",
136
+ "sinon": "^17.0.1",
137
+ "sinon-chai": "^3.7.0",
138
+ "taffydb": "^2.7.3",
139
+ "terser-webpack-plugin": "^5.3.10",
140
+ "ts-node": "^10.9.2",
141
+ "typescript": "^5.6.2",
142
+ "webpack": "^5.94.0",
143
+ "webpack-cli": "^5.0.1"
144
+ },
145
+ "dependencies": {
146
+ "@stellar/stellar-base": "^12.1.1",
147
+ "axios": "^1.7.7",
148
+ "bignumber.js": "^9.1.2",
149
+ "eventsource": "^2.0.2",
150
+ "randombytes": "^2.1.0",
151
+ "toml": "^3.0.0",
152
+ "urijs": "^1.19.1",
153
+ "ethers": "^6.13.2"
154
+ }
155
+ }
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Problem: stellar-sdk doesn't depend on browser env but the types do.
3
+ * Workaround: Copy/paste subset of interfaces from `dom.d.ts` (TS v3.4.5):
4
+ * - `MessageEvent` already comes from `eventsource`.
5
+ * - `EventListener` used at `src/call_builder.ts`.
6
+ * - `EventSource` used at `src/call_builder.ts`.
7
+ */
8
+
9
+ interface EventSourceEventMap {
10
+ error: Event;
11
+ message: MessageEvent;
12
+ open: Event;
13
+ }
14
+
15
+ interface EventSource extends EventTarget {
16
+ onerror: ((this: EventSource, ev: Event) => any) | null;
17
+ onmessage: ((this: EventSource, ev: MessageEvent) => any) | null;
18
+ onopen: ((this: EventSource, ev: Event) => any) | null;
19
+ /**
20
+ * Returns the state of this EventSource object's connection. It can have the
21
+ * values described below.
22
+ */
23
+ readonly readyState: number;
24
+ /**
25
+ * Returns the URL providing the event stream.
26
+ */
27
+ readonly url: string;
28
+ /**
29
+ * Returns true if the credentials mode
30
+ * for connection requests to the URL providing the
31
+ * event stream is set to "include", and false otherwise.
32
+ */
33
+ readonly withCredentials: boolean;
34
+ readonly CLOSED: number;
35
+ readonly CONNECTING: number;
36
+ readonly OPEN: number;
37
+ close(): void;
38
+ addEventListener<K extends keyof EventSourceEventMap>(
39
+ type: K,
40
+ listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
41
+ options?: boolean | AddEventListenerOptions,
42
+ ): void;
43
+ addEventListener(
44
+ type: string,
45
+ listener: EventListener | EventListenerObject,
46
+ options?: boolean | AddEventListenerOptions,
47
+ ): void;
48
+ removeEventListener<K extends keyof EventSourceEventMap>(
49
+ type: K,
50
+ listener: (this: EventSource, ev: EventSourceEventMap[K]) => any,
51
+ options?: boolean | EventListenerOptions,
52
+ ): void;
53
+ removeEventListener(
54
+ type: string,
55
+ listener: EventListener | EventListenerObject,
56
+ options?: boolean | EventListenerOptions,
57
+ ): void;
58
+ }
59
+
60
+ interface EventListener {
61
+ // tslint:disable-next-line: callable-types
62
+ (evt: Event): void;
63
+ }
64
+
65
+ interface EventListenerObject {
66
+ handleEvent(evt: Event): void;
67
+ }
68
+
69
+ interface EventListenerOptions {
70
+ capture?: boolean;
71
+ }
72
+
73
+ interface AddEventListenerOptions extends EventListenerOptions {
74
+ once?: boolean;
75
+ passive?: boolean;
76
+ }
77
+
78
+ /** EventTarget is an interface implemented by objects that can receive events and may have listeners for them. */
79
+ interface EventTarget {
80
+ /**
81
+ * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
82
+ * The options argument sets listener-specific options. For compatibility this can be a
83
+ * boolean, in which case the method behaves exactly as if the value was specified as options's capture.
84
+ * When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
85
+ * When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in §2.8 Observing event listeners.
86
+ * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will
87
+ * be removed.
88
+ * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
89
+ */
90
+ addEventListener(
91
+ type: string,
92
+ listener: EventListener | EventListenerObject | null,
93
+ options?: boolean | AddEventListenerOptions,
94
+ ): void;
95
+ /**
96
+ * Dispatches a synthetic event event to target and returns true
97
+ * if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
98
+ */
99
+ dispatchEvent(event: Event): boolean;
100
+ /**
101
+ * Removes the event listener in target's event listener list with the same type, callback, and options.
102
+ */
103
+ removeEventListener(
104
+ type: string,
105
+ callback: EventListener | EventListenerObject | null,
106
+ options?: EventListenerOptions | boolean,
107
+ ): void;
108
+ }
109
+
110
+ /** The Event interface represents any event which takes place in the DOM; some are user-generated (such as mouse or keyboard events), while others are generated by APIs (such as events that indicate an animation has finished running, a video has been paused, and so forth). While events are usually triggered by such "external" sources, they can also be triggered programmatically, such as by calling the HTMLElement.click() method of an element, or by defining the event, then sending it to a specified target using EventTarget.dispatchEvent(). There are many types of events, some of which use other interfaces based on the main Event interface. Event itself contains the properties and methods which are common to all events. */
111
+ interface Event {
112
+ // Already partially declared at `@types/eventsource/dom-monkeypatch.d.ts`.
113
+
114
+ /**
115
+ * Returns the object whose event listener's callback is currently being
116
+ * invoked.
117
+ */
118
+ readonly currentTarget: EventTarget | null;
119
+ /** @deprecated */
120
+ readonly srcElement: EventTarget | null;
121
+ /**
122
+ * Returns the object to which event is dispatched (its target).
123
+ */
124
+ readonly target: EventTarget | null;
125
+ composedPath(): EventTarget[];
126
+ }