@akita-protocol/algomd-rn 1.0.0-alpha.0 → 1.0.0-alpha.10
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/README.md +1 -1
- package/package.json +7 -7
- package/src/adapters/txn-graph.ts +2 -1
- package/src/components/StakingPool.tsx +19 -17
- package/src/fonts/Allo_300Light.ttf +0 -0
- package/src/fonts/Allo_400Regular.ttf +0 -0
- package/src/fonts/Allo_500Medium.ttf +0 -0
- package/src/fonts/Allo_600SemiBold.ttf +0 -0
- package/src/fonts/Allo_700Bold.ttf +0 -0
- package/src/fonts/OFL.txt +93 -93
- package/src/fonts/README.md +17 -0
- package/src/fonts/app.css +5 -5
- package/src/hooks/useAlgomdData.ts +5 -4
- package/src/hooks/useAlgorandClient.ts +12 -10
- package/src/index.ts +1 -1
- package/src/presentation/ContractMenu.tsx +68 -29
- package/src/presentation/StakingPoolDisplay.tsx +489 -97
- package/src/presentation/icons.tsx +108 -1
- package/src/presentation/pluginColors.ts +1 -0
- package/src/presentation/runtime.tsx +43 -0
- package/src/presentation/textTheme.ts +5 -5
- package/src/refs/AccountRef.tsx +24 -10
- package/src/refs/GuildActions.tsx +925 -0
- package/src/refs/GuildProposalRef.tsx +312 -0
- package/src/refs/SubscriptionRef.tsx +6 -13
- package/src/refs/index.tsx +4 -0
- package/src/refs/primitives.tsx +51 -19
- package/src/fonts/SpaceGrotesk_300Light.ttf +0 -0
- package/src/fonts/SpaceGrotesk_400Regular.ttf +0 -0
- package/src/fonts/SpaceGrotesk_500Medium.ttf +0 -0
- package/src/fonts/SpaceGrotesk_600SemiBold.ttf +0 -0
- package/src/fonts/SpaceGrotesk_700Bold.ttf +0 -0
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ The main app currently links `@akita-protocol/algomd-rn` to `../algomd-rn`. Metr
|
|
|
52
52
|
|
|
53
53
|
Page links, locked/unlocked content, placeholders, snapshots, loading, and inline identities have additional controls and stories under **References / App embeds**. The older `showApps`, `showContext`, and `showFee` props are deprecated because those extra sections are absent from the app layout.
|
|
54
54
|
|
|
55
|
-
Browser previews bundle the app's
|
|
55
|
+
Browser previews bundle the app's Allo fonts. Native hosts must register the five `allo*` families shown in `examples/native/.rnstorybook/preview.tsx`; the main app already does this.
|
|
56
56
|
|
|
57
57
|
## Coverage and keeping the platforms aligned
|
|
58
58
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akita-protocol/algomd-rn",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"main": "src/index.ts",
|
|
5
5
|
"types": "src/index.ts",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@akita-protocol/sdk": ">=1.
|
|
14
|
+
"@akita-protocol/sdk": ">=1.5.0-canary.0",
|
|
15
15
|
"@akita-protocol/txn-graph-rn": ">=0.2.1",
|
|
16
|
-
"@algorandfoundation/algokit-utils": "
|
|
16
|
+
"@algorandfoundation/algokit-utils": "^9.2.2",
|
|
17
17
|
"@gorhom/bottom-sheet": ">=5.0.0",
|
|
18
18
|
"@shopify/flash-list": ">=2.0.0",
|
|
19
19
|
"@tanstack/react-query": ">=5",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@akita-protocol/sdk": "1.
|
|
43
|
-
"@algorandfoundation/algokit-utils": "
|
|
42
|
+
"@akita-protocol/sdk": "1.5.0-canary.0",
|
|
43
|
+
"@algorandfoundation/algokit-utils": "^9.2.2",
|
|
44
44
|
"@gorhom/bottom-sheet": "^5.2.14",
|
|
45
45
|
"@playwright/test": "^1.63.0",
|
|
46
46
|
"@storybook/addon-a11y": "10.6.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@types/pixelmatch": "^7.1.0",
|
|
53
53
|
"@types/pngjs": "^6.0.5",
|
|
54
54
|
"@types/react": "^19.1.0",
|
|
55
|
-
"algosdk": "^3.
|
|
55
|
+
"algosdk": "^3.7.0",
|
|
56
56
|
"autoprefixer": "^10.5.6",
|
|
57
57
|
"buffer": "^6.0.3",
|
|
58
58
|
"esbuild": "^0.25.12",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"vite": "^6.4.3"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@akita-protocol/algomd-core": "1.0.0-alpha.
|
|
82
|
+
"@akita-protocol/algomd-core": "1.0.0-alpha.10"
|
|
83
83
|
},
|
|
84
84
|
"exports": {
|
|
85
85
|
".": "./src/index.ts",
|
|
@@ -56,8 +56,9 @@ async function fetchASAForGraph(
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
try {
|
|
59
|
-
const info = await algorand.client.algod.
|
|
59
|
+
const info = await algorand.client.algod.getAssetByID(BigInt(assetId)).do();
|
|
60
60
|
const p = info.params;
|
|
61
|
+
if (!p) throw new Error(`Asset ${assetId} has no params`);
|
|
61
62
|
return {
|
|
62
63
|
id: Number(assetId),
|
|
63
64
|
name: p.name ?? `Asset #${assetId}`,
|
|
@@ -2,6 +2,7 @@ import { isCompactReference, type ReferenceVariantProps } from "../presentation/
|
|
|
2
2
|
import { CompactPill } from "../presentation/References";
|
|
3
3
|
import { StakingPoolDisplay as StakingPoolPresentation } from "../presentation/StakingPoolDisplay";
|
|
4
4
|
import { OnChainActionButton } from "../presentation/OnChainActionCard";
|
|
5
|
+
import { isCollectibleAsset } from "../presentation/gates";
|
|
5
6
|
import React from "react";
|
|
6
7
|
import type {
|
|
7
8
|
ComponentSize,
|
|
@@ -76,7 +77,21 @@ export function StakingPoolComponent({
|
|
|
76
77
|
pool.maxEntriesRaw,
|
|
77
78
|
);
|
|
78
79
|
const canEnter = signupsAvailable && !entryTargetClosed;
|
|
79
|
-
const
|
|
80
|
+
const rewards = pool.rewards.map((item, index) => ({
|
|
81
|
+
assetId: String(item.asset.id),
|
|
82
|
+
name: item.asset.name,
|
|
83
|
+
unitName: item.asset.unitName,
|
|
84
|
+
decimals: item.asset.decimals,
|
|
85
|
+
rateRaw: item.rateRaw,
|
|
86
|
+
distribution: item.distribution,
|
|
87
|
+
intervalSecondsRaw: item.intervalRaw,
|
|
88
|
+
expirationSecondsRaw: item.expirationRaw,
|
|
89
|
+
winnerCountRaw: item.winnerCountRaw,
|
|
90
|
+
budgetRaw: item.budgetRaw,
|
|
91
|
+
// The `imageUrl` prop stands in for the first reward's art.
|
|
92
|
+
imageUrl: (index === 0 ? imageUrl : undefined) ?? item.asset.imageUrl,
|
|
93
|
+
collectible: isCollectibleAsset(item.asset),
|
|
94
|
+
}));
|
|
80
95
|
return (
|
|
81
96
|
<SizeContainer size={size} className={className}>
|
|
82
97
|
<StakingPoolPresentation
|
|
@@ -103,24 +118,11 @@ export function StakingPoolComponent({
|
|
|
103
118
|
gateId: pool.gateAppId,
|
|
104
119
|
unrestricted: pool.unrestricted,
|
|
105
120
|
rewardCount: pool.rewards.length,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
assetId: String(reward.asset.id),
|
|
109
|
-
name: reward.asset.name,
|
|
110
|
-
unitName: reward.asset.unitName,
|
|
111
|
-
decimals: reward.asset.decimals,
|
|
112
|
-
rateRaw: reward.rateRaw,
|
|
113
|
-
distribution: reward.distribution,
|
|
114
|
-
intervalSecondsRaw: reward.intervalRaw,
|
|
115
|
-
expirationSecondsRaw: reward.expirationRaw,
|
|
116
|
-
winnerCountRaw: reward.winnerCountRaw,
|
|
117
|
-
budgetRaw: reward.budgetRaw,
|
|
118
|
-
imageUrl: imageUrl ?? reward.asset.imageUrl,
|
|
119
|
-
}
|
|
120
|
-
: undefined,
|
|
121
|
+
rewards,
|
|
122
|
+
primaryReward: rewards[0],
|
|
121
123
|
}}
|
|
122
124
|
action={
|
|
123
|
-
// When the pool can't be joined, the card's time
|
|
125
|
+
// When the pool can't be joined, the card's status and time say why.
|
|
124
126
|
showEnterButton && onEnter && canEnter ? (
|
|
125
127
|
<OnChainActionButton
|
|
126
128
|
label="Join pool"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/fonts/OFL.txt
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
Copyright
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
This
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-----------------------------------------------------------
|
|
9
|
-
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
-
-----------------------------------------------------------
|
|
11
|
-
|
|
12
|
-
PREAMBLE
|
|
13
|
-
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
-
development of collaborative font projects, to support the font creation
|
|
15
|
-
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
-
open framework in which fonts may be shared and improved in partnership
|
|
17
|
-
with others.
|
|
18
|
-
|
|
19
|
-
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
-
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
-
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
-
redistributed and/or sold with any software provided that any reserved
|
|
23
|
-
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
-
however, cannot be released under any other type of license. The
|
|
25
|
-
requirement for fonts to remain under this license does not apply
|
|
26
|
-
to any document created using the fonts or their derivatives.
|
|
27
|
-
|
|
28
|
-
DEFINITIONS
|
|
29
|
-
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
-
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
-
include source files, build scripts and documentation.
|
|
32
|
-
|
|
33
|
-
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
-
copyright statement(s).
|
|
35
|
-
|
|
36
|
-
"Original Version" refers to the collection of Font Software components as
|
|
37
|
-
distributed by the Copyright Holder(s).
|
|
38
|
-
|
|
39
|
-
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
-
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
-
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
-
new environment.
|
|
43
|
-
|
|
44
|
-
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
-
writer or other person who contributed to the Font Software.
|
|
46
|
-
|
|
47
|
-
PERMISSION
|
|
48
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
-
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
-
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
-
Software, subject to the following conditions:
|
|
52
|
-
|
|
53
|
-
1) Neither the Font Software nor any of its individual components,
|
|
54
|
-
in Original or Modified Versions, may be sold by itself.
|
|
55
|
-
|
|
56
|
-
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
-
redistributed and/or sold with any software, provided that each copy
|
|
58
|
-
contains the above copyright notice and this license. These can be
|
|
59
|
-
included either as stand-alone text files, human-readable headers or
|
|
60
|
-
in the appropriate machine-readable metadata fields within text or
|
|
61
|
-
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
-
|
|
63
|
-
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
-
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
-
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
-
presented to the users.
|
|
67
|
-
|
|
68
|
-
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
-
Software shall not be used to promote, endorse or advertise any
|
|
70
|
-
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
-
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
-
permission.
|
|
73
|
-
|
|
74
|
-
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
-
must be distributed entirely under this license, and must not be
|
|
76
|
-
distributed under any other license. The requirement for fonts to
|
|
77
|
-
remain under this license does not apply to any document created
|
|
78
|
-
using the Font Software.
|
|
79
|
-
|
|
80
|
-
TERMINATION
|
|
81
|
-
This license becomes null and void if any of the above conditions are
|
|
82
|
-
not met.
|
|
83
|
-
|
|
84
|
-
DISCLAIMER
|
|
85
|
-
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
-
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
-
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
-
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
-
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
-
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
-
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
1
|
+
Copyright 2026 Josh Puckett (https://joshpuckett.me)
|
|
2
|
+
Copyright (c) 2016 The Inter Project Authors (https://github.com/rsms/inter)
|
|
3
|
+
|
|
4
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
5
|
+
This license is copied below, and is also available with a FAQ at:
|
|
6
|
+
http://scripts.sil.org/OFL
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION AND CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Fonts
|
|
2
|
+
|
|
3
|
+
Allo 1.0 by Josh Puckett (https://allo.joshpuckett.me), SIL Open Font License 1.1 (see `OFL.txt`).
|
|
4
|
+
|
|
5
|
+
The five static TTFs are instances of `AlloVariable` from the `allo-font@1.0.0` npm package at
|
|
6
|
+
optical size 14 and roundness 50, the font's defaults, for weights 300, 400, 500, 600 and 700.
|
|
7
|
+
React Native can't set variation axes, so the library ships static files. To rebuild them:
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from fontTools.ttLib import TTFont
|
|
11
|
+
from fontTools.varLib.instancer import instantiateVariableFont
|
|
12
|
+
font = instantiateVariableFont(TTFont("AlloVariable.woff2"), {"opsz": 14, "wght": 400, "ROND": 50}, updateFontNames=True)
|
|
13
|
+
font.flavor = None
|
|
14
|
+
font.save("Allo_400Regular.ttf")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Hosts register them under the families `alloLight`, `alloRegular`, `alloMedium`, `alloSemiBold` and `alloBold`.
|
package/src/fonts/app.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@font-face { font-family: '
|
|
2
|
-
@font-face { font-family: '
|
|
3
|
-
@font-face { font-family: '
|
|
4
|
-
@font-face { font-family: '
|
|
5
|
-
@font-face { font-family: '
|
|
1
|
+
@font-face { font-family: 'alloLight'; src: url('./Allo_300Light.ttf') format('truetype'); font-style: normal; font-weight: 400; font-display: block; }
|
|
2
|
+
@font-face { font-family: 'alloRegular'; src: url('./Allo_400Regular.ttf') format('truetype'); font-style: normal; font-weight: 400; font-display: block; }
|
|
3
|
+
@font-face { font-family: 'alloMedium'; src: url('./Allo_500Medium.ttf') format('truetype'); font-style: normal; font-weight: 400; font-display: block; }
|
|
4
|
+
@font-face { font-family: 'alloSemiBold'; src: url('./Allo_600SemiBold.ttf') format('truetype'); font-style: normal; font-weight: 400; font-display: block; }
|
|
5
|
+
@font-face { font-family: 'alloBold'; src: url('./Allo_700Bold.ttf') format('truetype'); font-style: normal; font-weight: 400; font-display: block; }
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
type DecodedStakingPoolReward,
|
|
39
39
|
} from "../utils/stakingPool";
|
|
40
40
|
import type { AlgorandClient } from "@algorandfoundation/algokit-utils";
|
|
41
|
-
import { getApplicationAddress } from "
|
|
41
|
+
import { getApplicationAddress } from "algosdk";
|
|
42
42
|
import type {
|
|
43
43
|
AlgorandAccount,
|
|
44
44
|
ASA as ASAType,
|
|
@@ -124,8 +124,9 @@ async function fetchASADetails(
|
|
|
124
124
|
// Asset precision is transaction-critical. Let the owning query surface a
|
|
125
125
|
// lookup error instead of fabricating a zero-decimal ASA that could turn a
|
|
126
126
|
// human amount into the wrong number of base units.
|
|
127
|
-
const info = await algorand.client.algod.
|
|
127
|
+
const info = await algorand.client.algod.getAssetByID(BigInt(assetId)).do();
|
|
128
128
|
const params = info.params;
|
|
129
|
+
if (!params) throw new Error(`Asset ${assetId} has no params`);
|
|
129
130
|
return {
|
|
130
131
|
id: Number(assetId),
|
|
131
132
|
name: params.name ?? `Asset #${assetId}`,
|
|
@@ -287,7 +288,7 @@ async function fetchPrizeBoxBundle(
|
|
|
287
288
|
const fallback: PrizeBoxBundle = { appId, address, holdings: [] };
|
|
288
289
|
|
|
289
290
|
try {
|
|
290
|
-
const info = await algorand.client.algod.accountInformation(address);
|
|
291
|
+
const info = await algorand.client.algod.accountInformation(address).do();
|
|
291
292
|
const assetBalances = (info.assets ?? []).filter(
|
|
292
293
|
(holding: { amount: bigint }) => holding.amount > BigInt(0),
|
|
293
294
|
);
|
|
@@ -358,7 +359,7 @@ export function useAccountData(address: string | undefined) {
|
|
|
358
359
|
queryKey: ["algomd", config.network, "account", address],
|
|
359
360
|
queryFn: async (): Promise<AlgorandAccount> => {
|
|
360
361
|
if (!address) throw new Error("No address provided");
|
|
361
|
-
const info = await algorand.client.algod.accountInformation(address);
|
|
362
|
+
const info = await algorand.client.algod.accountInformation(address).do();
|
|
362
363
|
const assets: ASAType[] = (info.assets ?? []).map(
|
|
363
364
|
(a: { assetId: bigint; amount: bigint }) => ({
|
|
364
365
|
id: Number(a.assetId),
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { useMemo } from 'react'
|
|
2
2
|
import { AlgorandClient } from '@algorandfoundation/algokit-utils'
|
|
3
|
-
import { AlgodClient } from '@algorandfoundation/algokit-utils/algod-client'
|
|
4
3
|
import algosdk from 'algosdk'
|
|
5
|
-
import { makeEmptyTransactionSigner } from '@algorandfoundation/algokit-utils/transact'
|
|
6
4
|
import { useAlgomd } from '../provider/context'
|
|
7
5
|
import { NETWORK_DEFAULTS } from '../provider/networks'
|
|
8
6
|
|
|
@@ -21,17 +19,12 @@ export function useAlgorandClient(): AlgorandClient {
|
|
|
21
19
|
const token = config.algodToken ?? defaults.algodToken ?? ''
|
|
22
20
|
|
|
23
21
|
const client = AlgorandClient.fromClients({
|
|
24
|
-
algod: new
|
|
25
|
-
baseUrl: server,
|
|
26
|
-
port,
|
|
27
|
-
token,
|
|
28
|
-
headers: config.headers,
|
|
29
|
-
}),
|
|
22
|
+
algod: new algosdk.Algodv2(token, server, port, config.headers),
|
|
30
23
|
})
|
|
31
24
|
|
|
32
25
|
// Register an empty signer so explicitly simulated read methods can run
|
|
33
26
|
// without a real signer. This is safe — algomd-rn is a display library.
|
|
34
|
-
client.setDefaultSigner(makeEmptyTransactionSigner())
|
|
27
|
+
client.setDefaultSigner(algosdk.makeEmptyTransactionSigner())
|
|
35
28
|
|
|
36
29
|
return client
|
|
37
30
|
}, [config.network, config.algodServer, config.algodPort, config.algodToken, config.headers])
|
|
@@ -49,6 +42,15 @@ export function useIndexerClient(): algosdk.Indexer | null {
|
|
|
49
42
|
const server = config.indexerServer ?? defaults.indexerServer
|
|
50
43
|
if (!server) return null
|
|
51
44
|
const token = config.indexerToken ?? defaults.indexerToken ?? ''
|
|
52
|
-
return new algosdk.Indexer(token, server,
|
|
45
|
+
return new algosdk.Indexer(token, server, urlPort(server), config.headers)
|
|
53
46
|
}, [config.network, config.indexerServer, config.indexerToken, config.headers])
|
|
54
47
|
}
|
|
48
|
+
|
|
49
|
+
/** The URL's explicit port, or "" for the scheme default, so algosdk keeps the configured port. */
|
|
50
|
+
function urlPort(url: string): string {
|
|
51
|
+
try {
|
|
52
|
+
return new URL(url).port
|
|
53
|
+
} catch {
|
|
54
|
+
return ''
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -135,7 +135,7 @@ export {
|
|
|
135
135
|
|
|
136
136
|
export { AppPresentationProvider } from "./presentation/runtime";
|
|
137
137
|
export { AssetSubjectProvider } from "./presentation/subject";
|
|
138
|
-
export type { AppPresentation, AppIdentity } from "./presentation/runtime";
|
|
138
|
+
export type { AppPresentation, AppIdentity, GuildVoteBlock, GuildVoteChoice } from "./presentation/runtime";
|
|
139
139
|
|
|
140
140
|
export * from "./presentation";
|
|
141
141
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
EllipsisVerticalIcon,
|
|
10
10
|
ArrowTopRightOnSquareIcon,
|
|
11
11
|
Square2StackIcon,
|
|
12
|
+
OutlineDocumentTextIcon,
|
|
12
13
|
} from "./icons";
|
|
13
14
|
import * as Clipboard from "expo-clipboard";
|
|
14
15
|
import * as Haptics from "expo-haptics";
|
|
@@ -60,6 +61,39 @@ const LABELS: Record<EntityType, string> = {
|
|
|
60
61
|
tx: "Transaction",
|
|
61
62
|
};
|
|
62
63
|
|
|
64
|
+
/** The AlgoMD tag Copy Embed copies and Quote starts a post with, or undefined when there is none. */
|
|
65
|
+
export function buildEmbed({
|
|
66
|
+
appId,
|
|
67
|
+
type = "application",
|
|
68
|
+
embedType,
|
|
69
|
+
embedProp,
|
|
70
|
+
embedValue,
|
|
71
|
+
}: Pick<ContractMenuProps, "appId" | "type" | "embedType" | "embedProp" | "embedValue">): string | undefined {
|
|
72
|
+
const componentName =
|
|
73
|
+
embedType ??
|
|
74
|
+
(type === "asset"
|
|
75
|
+
? "ASA"
|
|
76
|
+
: type === "account"
|
|
77
|
+
? "Account"
|
|
78
|
+
: type === "tx"
|
|
79
|
+
? "Transaction"
|
|
80
|
+
: undefined);
|
|
81
|
+
if (!componentName) return undefined;
|
|
82
|
+
|
|
83
|
+
const idProp =
|
|
84
|
+
embedProp ??
|
|
85
|
+
(componentName === "NFDProfile"
|
|
86
|
+
? "name"
|
|
87
|
+
: componentName === "DualStakePool"
|
|
88
|
+
? "appId"
|
|
89
|
+
: type === "account"
|
|
90
|
+
? "address"
|
|
91
|
+
: "id");
|
|
92
|
+
const value = embedValue ?? appId;
|
|
93
|
+
const compactProp = componentName === "Account" ? " compact" : "";
|
|
94
|
+
return `<${componentName} ${idProp}="${String(value)}"${compactProp} />`;
|
|
95
|
+
}
|
|
96
|
+
|
|
63
97
|
export function ContractMenu({
|
|
64
98
|
appId,
|
|
65
99
|
type = "application",
|
|
@@ -94,40 +128,25 @@ export function ContractMenu({
|
|
|
94
128
|
sheetRef.current?.dismiss();
|
|
95
129
|
}, [appId]);
|
|
96
130
|
|
|
131
|
+
const embed = buildEmbed({ appId, type, embedType, embedProp, embedValue });
|
|
132
|
+
|
|
97
133
|
const handleCopyEmbed = useCallback(() => {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
(type === "asset"
|
|
101
|
-
? "ASA"
|
|
102
|
-
: type === "account"
|
|
103
|
-
? "Account"
|
|
104
|
-
: type === "tx"
|
|
105
|
-
? "Transaction"
|
|
106
|
-
: undefined);
|
|
107
|
-
if (!componentName) return;
|
|
108
|
-
|
|
109
|
-
const idProp =
|
|
110
|
-
embedProp ??
|
|
111
|
-
(componentName === "NFDProfile"
|
|
112
|
-
? "name"
|
|
113
|
-
: componentName === "DualStakePool"
|
|
114
|
-
? "appId"
|
|
115
|
-
: type === "account"
|
|
116
|
-
? "address"
|
|
117
|
-
: "id");
|
|
118
|
-
const value = embedValue ?? appId;
|
|
119
|
-
|
|
120
|
-
const compactProp = componentName === "Account" ? " compact" : "";
|
|
121
|
-
Clipboard.setStringAsync(
|
|
122
|
-
`<${componentName} ${idProp}="${String(value)}"${compactProp} />`,
|
|
123
|
-
);
|
|
134
|
+
if (!embed) return;
|
|
135
|
+
Clipboard.setStringAsync(embed);
|
|
124
136
|
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
|
|
125
137
|
sheetRef.current?.dismiss();
|
|
126
|
-
}, [
|
|
138
|
+
}, [embed]);
|
|
139
|
+
|
|
140
|
+
const { onQuoteEmbed } = presentation;
|
|
141
|
+
const handleQuote = useCallback(() => {
|
|
142
|
+
if (!embed || !onQuoteEmbed) return;
|
|
143
|
+
Haptics.selectionAsync();
|
|
144
|
+
sheetRef.current?.dismiss();
|
|
145
|
+
onQuoteEmbed(embed);
|
|
146
|
+
}, [embed, onQuoteEmbed]);
|
|
127
147
|
|
|
128
148
|
const label = LABELS[type];
|
|
129
|
-
const canCopyEmbed =
|
|
130
|
-
!!embedType || type === "asset" || type === "account" || type === "tx";
|
|
149
|
+
const canCopyEmbed = !!embed;
|
|
131
150
|
|
|
132
151
|
return (
|
|
133
152
|
<>
|
|
@@ -234,6 +253,26 @@ export function ContractMenu({
|
|
|
234
253
|
</View>
|
|
235
254
|
</SquishyPressable>
|
|
236
255
|
)}
|
|
256
|
+
|
|
257
|
+
{canCopyEmbed && onQuoteEmbed && (
|
|
258
|
+
<SquishyPressable onPress={handleQuote} pressedScale={0.98}>
|
|
259
|
+
<View
|
|
260
|
+
style={{
|
|
261
|
+
flexDirection: "row",
|
|
262
|
+
alignItems: "center",
|
|
263
|
+
gap: 12,
|
|
264
|
+
paddingVertical: 14,
|
|
265
|
+
paddingHorizontal: 8,
|
|
266
|
+
borderRadius: 12,
|
|
267
|
+
}}
|
|
268
|
+
>
|
|
269
|
+
<OutlineDocumentTextIcon size={18} color={theme.colors.text} />
|
|
270
|
+
<Text size="sm" weight="medium">
|
|
271
|
+
Quote
|
|
272
|
+
</Text>
|
|
273
|
+
</View>
|
|
274
|
+
</SquishyPressable>
|
|
275
|
+
)}
|
|
237
276
|
</BottomSheetView>
|
|
238
277
|
</AppPresentationProvider>
|
|
239
278
|
</PortalProvider>
|