@thalalabs/surf 1.9.6 → 1.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @thalalabs/surf
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4cfacb1: upgrade aptos ts-sdk
8
+
9
+ ## 1.9.7
10
+
11
+ ### Patch Changes
12
+
13
+ - ec01e73: upgrade aptos packages
14
+
3
15
  ## 1.9.6
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -232,6 +232,10 @@ Compared to [Viem](https://viem.sh/), Surf is still in its infancy. Any contribu
232
232
  - [ ] Accept `Uint8Array` and `string` for `vector<u8>` input. Currently users can pass these values to `createEntryPayload`, and Surf will correctly encode it. But the type system will complain. So users need to use `as any` to pass `Uint8Array` or `string` for `vector<u8>`. The type system only accept `number[]` for `vector<u8>` now.
233
233
  - [ ] Add the functionality available in AptosClient to Surf, such as `estimateGasPrice`.
234
234
 
235
+ ## Showcase
236
+
237
+ ![demo image](./images/surf-hero.gif)
238
+
235
239
  ## License
236
240
 
237
241
  Released under [MIT](/LICENSE) by [@ThalaLabs](https://github.com/ThalaLabs).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thalalabs/surf",
3
- "version": "1.9.6",
3
+ "version": "1.10.0",
4
4
  "description": "TypeScript Interfaces & React Hooks for interacting with Aptos Smart Contracts with type safety.",
5
5
  "main": "./build/cjs/index.js",
6
6
  "module": "./build/esm/index.js",
@@ -43,14 +43,14 @@
43
43
  }
44
44
  },
45
45
  "devDependencies": {
46
- "@aptos-labs/ts-sdk": "^2.0.0",
47
- "@aptos-labs/wallet-adapter-react": "^6.0.2",
46
+ "@aptos-labs/ts-sdk": "^6.0.0",
47
+ "@aptos-labs/wallet-adapter-react": "^8.2.1",
48
48
  "@changesets/cli": "^2.26.1",
49
49
  "@types/jest": "~29.5",
50
50
  "@types/node": "~18",
51
51
  "@types/react": "^18.2.8",
52
52
  "@typescript-eslint/eslint-plugin": "~5.62",
53
- "@initia/react-wallet-widget": "^1.5.9",
53
+ "@initia/react-wallet-widget": "^1.9.8",
54
54
  "@typescript-eslint/parser": "~5.62",
55
55
  "eslint": "~8.57",
56
56
  "eslint-config-prettier": "~9.1",
@@ -67,10 +67,10 @@
67
67
  "typescript": "~5.1"
68
68
  },
69
69
  "peerDependencies": {
70
- "@aptos-labs/ts-sdk": "^2.0.0",
71
- "@aptos-labs/wallet-adapter-react": "^6.0.2",
70
+ "@aptos-labs/ts-sdk": "^6.0.0",
71
+ "@aptos-labs/wallet-adapter-react": "^8.2.1",
72
72
  "react": "^18.2.0",
73
- "@initia/react-wallet-widget": "^1.5.9"
73
+ "@initia/react-wallet-widget": "^1.9.8"
74
74
  },
75
75
  "peerDependenciesMeta": {
76
76
  "@aptos-labs/wallet-adapter-react": {
@@ -19,29 +19,41 @@ describe('get account resource', () => {
19
19
  // Teardown (cleanup) after assertions
20
20
  afterAll(() => {});
21
21
 
22
- it('get CoinStore', async () => {
23
- const result = await client.useABI(COIN_ABI).resource.CoinStore({
22
+ it('get CoinInfo', async () => {
23
+ const result = await client.useABI(COIN_ABI).resource.CoinInfo({
24
24
  typeArguments: ['0x1::aptos_coin::AptosCoin'],
25
25
  account: '0x1',
26
26
  });
27
27
 
28
- expect(result.frozen).toBeFalsy();
29
- expect(result.coin.value).toBeDefined();
30
- expect(result.deposit_events).toBeDefined();
31
- expect(result.withdraw_events).toBeDefined();
32
-
33
- // can inference nested struct
34
- expect(result.deposit_events.guid.id.creation_num.startsWith).toBeDefined();
35
-
36
- // @ts-expect-error field not exist
37
- expect(result.deposit_events.guid.id.abc).toBeUndefined();
38
-
39
- // @ts-expect-error field not exist
40
- expect(result.abc).toBeUndefined();
28
+ expect(result).toMatchInlineSnapshot(`
29
+ {
30
+ "decimals": 8,
31
+ "name": "Aptos Coin",
32
+ "supply": {
33
+ "vec": [
34
+ {
35
+ "aggregator": {
36
+ "vec": [
37
+ {
38
+ "handle": "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca",
39
+ "key": "0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935",
40
+ "limit": "340282366920938463463374607431768211455",
41
+ },
42
+ ],
43
+ },
44
+ "integer": {
45
+ "vec": [],
46
+ },
47
+ },
48
+ ],
49
+ },
50
+ "symbol": "APT",
51
+ }
52
+ `);
41
53
  }, 60000);
42
54
 
43
- it('get CoinStore with ledger version', async () => {
44
- const result = await client.useABI(COIN_ABI).resource.CoinStore({
55
+ it('get CoinInfo with ledger version', async () => {
56
+ const result = await client.useABI(COIN_ABI).resource.CoinInfo({
45
57
  typeArguments: ['0x1::aptos_coin::AptosCoin'],
46
58
  account: '0x1',
47
59
  ledgerVersion: '562606728',
@@ -49,28 +61,27 @@ describe('get account resource', () => {
49
61
 
50
62
  expect(result).toMatchInlineSnapshot(`
51
63
  {
52
- "coin": {
53
- "value": "50000358",
54
- },
55
- "deposit_events": {
56
- "counter": "61",
57
- "guid": {
58
- "id": {
59
- "addr": "0x1",
60
- "creation_num": "12",
61
- },
62
- },
63
- },
64
- "frozen": false,
65
- "withdraw_events": {
66
- "counter": "0",
67
- "guid": {
68
- "id": {
69
- "addr": "0x1",
70
- "creation_num": "13",
64
+ "decimals": 8,
65
+ "name": "Aptos Coin",
66
+ "supply": {
67
+ "vec": [
68
+ {
69
+ "aggregator": {
70
+ "vec": [
71
+ {
72
+ "handle": "0x1b854694ae746cdbd8d44186ca4929b2b337df21d1c74633be19b2710552fdca",
73
+ "key": "0x619dc29a0aac8fa146714058e8dd6d2d0f3bdf5f6331907bf91f3acd81e6935",
74
+ "limit": "340282366920938463463374607431768211455",
75
+ },
76
+ ],
77
+ },
78
+ "integer": {
79
+ "vec": [],
80
+ },
71
81
  },
72
- },
82
+ ],
73
83
  },
84
+ "symbol": "APT",
74
85
  }
75
86
  `);
76
87
  }, 60000);