) {
55 | return msgpack.decode(buffer);
56 | }
57 |
--------------------------------------------------------------------------------
/src/types/transactions/index.ts:
--------------------------------------------------------------------------------
1 | import PaymentTxn from './payment';
2 | import KeyRegistrationTxn from './keyreg';
3 | import {
4 | AssetCreateTransaction as AssetCreateTxn,
5 | AssetConfigurationTransaction as AssetConfigTxn,
6 | AssetDestroyTransaction as AssetDestroyTxn,
7 | AssetFreezeTransaction as AssetFreezeTxn,
8 | AssetTransferTransaction as AssetTransferTxn,
9 | } from './asset';
10 | import {
11 | ApplicationCreateTransaction as AppCreateTxn,
12 | ApplicationUpdateTransaction as AppUpdateTxn,
13 | ApplicationDeleteTransaction as AppDeleteTxn,
14 | ApplicationOptInTransaction as AppOptInTxn,
15 | ApplicationCloseOutTransaction as AppCloseOutTxn,
16 | ApplicationClearStateTransaction as AppClearStateTxn,
17 | ApplicationNoOpTransaction as AppNoOpTxn,
18 | } from './application';
19 | import StateProofTxn from './stateproof';
20 |
21 | // Utilities
22 | export {
23 | TransactionParams,
24 | TransactionType,
25 | SuggestedParams,
26 | BoxReference,
27 | } from './base';
28 | export {
29 | MustHaveSuggestedParams,
30 | MustHaveSuggestedParamsInline,
31 | } from './builder';
32 | export * from './encoded';
33 |
34 | // Transaction types
35 | export { default as PaymentTxn } from './payment';
36 | export { default as KeyRegistrationTxn } from './keyreg';
37 | export {
38 | AssetCreateTransaction as AssetCreateTxn,
39 | AssetConfigurationTransaction as AssetConfigTxn,
40 | AssetDestroyTransaction as AssetDestroyTxn,
41 | AssetFreezeTransaction as AssetFreezeTxn,
42 | AssetTransferTransaction as AssetTransferTxn,
43 | } from './asset';
44 | export {
45 | ApplicationCreateTransaction as AppCreateTxn,
46 | ApplicationUpdateTransaction as AppUpdateTxn,
47 | ApplicationDeleteTransaction as AppDeleteTxn,
48 | ApplicationOptInTransaction as AppOptInTxn,
49 | ApplicationCloseOutTransaction as AppCloseOutTxn,
50 | ApplicationClearStateTransaction as AppClearStateTxn,
51 | ApplicationNoOpTransaction as AppNoOpTxn,
52 | } from './application';
53 | export { default as StateProofTxn } from './stateproof';
54 |
55 | // All possible transaction types
56 | type AnyTransaction =
57 | | PaymentTxn
58 | | KeyRegistrationTxn
59 | | AssetCreateTxn
60 | | AssetConfigTxn
61 | | AssetDestroyTxn
62 | | AssetFreezeTxn
63 | | AssetTransferTxn
64 | | AppCreateTxn
65 | | AppUpdateTxn
66 | | AppDeleteTxn
67 | | AppOptInTxn
68 | | AppCloseOutTxn
69 | | AppClearStateTxn
70 | | AppNoOpTxn
71 | | StateProofTxn;
72 | export default AnyTransaction;
73 |
--------------------------------------------------------------------------------
/FAQ.md:
--------------------------------------------------------------------------------
1 | # Frequently Asked Questions
2 |
3 | ## Where did the `dist` folder go?
4 |
5 | Starting with version 1.9.0, a minified browser bundle can be obtained from npm CDNs such as [unpkg](https://unpkg.com/) or [jsDelivr](https://www.jsdelivr.com/). The link can be found in the [README.md](README.md).
6 |
7 | In prior versions, the browser bundles were made available in the `dist` directory. In order to access those, look in the `dist` folder on the version's GitHub tag, e.g. https://github.com/algorand/js-algorand-sdk/tree/v1.8.1/dist.
8 |
9 | ## Can I host the browser bundle myself?
10 |
11 | Yes! If you would instead prefer to host the package yourself, a minified browser bundle can be found in the `dist/browser/` folder of the published npm package starting with version 1.9.0.
12 |
13 | ## It says `Error: Can't resolve....` in the sdk
14 |
15 | This kind of errors is usually seen in Webpack 5 or Vite projects. You will need to install additional polyfill packages.
16 |
17 | #### Webpack 5 projects
18 |
19 | Typically, with Webpack 5 you would see:
20 |
21 | ```
22 | Module not found: Error: Can't resolve 'crypto'
23 | ERROR in ./node_modules/algosdk/dist/browser/algosdk.min.js 7471:55-72
24 | ```
25 |
26 | Webpack 5 no longer auto-polyfills some of the node modules used by this sdk. You will have to polyfill them to fix any errors regarding missing modules.
27 |
28 | #### Vite projects
29 |
30 | With Vite, you would see:
31 |
32 | ```
33 | Uncaught ReferenceError: Buffer is not defined
34 | ```
35 |
36 | You will have to install `buffer` as dependency.
37 |
38 | In `index.html`, add the following:
39 |
40 | ```html
41 |
45 | ```
46 |
47 | To utilize the Buffer polyfill in production builds, in `vite.config.js`, add:
48 |
49 | ```js
50 | import inject from '@rollup/plugin-inject';
51 |
52 | export default defineConfig({
53 | ...,
54 | build: {
55 | rollupOptions: {
56 | plugins: [inject({ Buffer: ['buffer', 'Buffer'] })],
57 | },
58 | },
59 | ...
60 | });
61 | ```
62 |
63 | ## How do I generate the SRI hash of `algosdk.min.js`?
64 |
65 | The SRI hash of `algosdk.min.js` is the base64 string after `sha384-` in the `integrity` attribute of the `
5 |
6 |
7 |
8 |
9 |
10 |
11 |
20 |
21 |
30 |
31 |
40 |
41 |
42 |
43 |
51 |
52 |
53 |
54 |
62 |
63 |
71 |
72 |
73 |
74 |
82 |
83 |
84 |
85 |
88 |
91 |
94 |
97 |
100 |
101 | Testnet Dispenser
102 |
103 |
104 |
105 |