@codama/renderers-rust 1.0.6 → 1.0.8
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/dist/index.node.cjs +9 -4
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.mjs +9 -4
- package/dist/index.node.mjs.map +1 -1
- package/dist/templates/accountsPage.njk +53 -0
- package/dist/templates/rootMod.njk +3 -0
- package/dist/templates/sharedPage.njk +25 -85
- package/dist/types/getRenderMapVisitor.d.ts.map +1 -1
- package/dist/types/getTypeManifestVisitor.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1,93 +1,33 @@
|
|
|
1
1
|
{% extends "layout.njk" %}
|
|
2
2
|
{% block main %}
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
type Target = Vec<T>;
|
|
24
|
-
|
|
25
|
-
fn deref(&self) -> &Self::Target {
|
|
26
|
-
&self.0
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
/// Deferences the inner `Vec` type as mutable.
|
|
31
|
-
impl<T> DerefMut for RemainderVec<T>
|
|
32
|
-
where
|
|
33
|
-
T: BorshSerialize + BorshDeserialize,
|
|
34
|
-
{
|
|
35
|
-
fn deref_mut(&mut self) -> &mut Self::Target {
|
|
36
|
-
&mut self.0
|
|
4
|
+
{#
|
|
5
|
+
The following types are used as responses for function that fetch accounts.
|
|
6
|
+
Ideally, these types live in a shared crate that can be used by the client but
|
|
7
|
+
at time of writing, there are some unresolved questions about how to do this.
|
|
8
|
+
|
|
9
|
+
For now, we just define them here. This the following caveat:
|
|
10
|
+
- These types are not compatible between different clients since the type
|
|
11
|
+
exists in each client individually.
|
|
12
|
+
#}
|
|
13
|
+
|
|
14
|
+
{% if accountsToExport.length > 0 %}
|
|
15
|
+
|
|
16
|
+
#[cfg(feature = "fetch")]
|
|
17
|
+
#[derive(Debug, Clone)]
|
|
18
|
+
pub struct DecodedAccount<T> {
|
|
19
|
+
pub address: solana_program::pubkey::Pubkey,
|
|
20
|
+
pub account: solana_sdk::account::Account,
|
|
21
|
+
pub data: T,
|
|
37
22
|
}
|
|
38
|
-
}
|
|
39
23
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
T: BorshSerialize + BorshDeserialize + Debug,
|
|
46
|
-
{
|
|
47
|
-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
48
|
-
f.write_fmt(format_args!("{:?}", self.0))
|
|
24
|
+
#[cfg(feature = "fetch")]
|
|
25
|
+
#[derive(Debug, Clone)]
|
|
26
|
+
pub enum MaybeAccount<T> {
|
|
27
|
+
Exists(DecodedAccount<T>),
|
|
28
|
+
NotFound(solana_program::pubkey::Pubkey),
|
|
49
29
|
}
|
|
50
|
-
}
|
|
51
30
|
|
|
52
|
-
|
|
53
|
-
where
|
|
54
|
-
T: BorshSerialize + BorshDeserialize,
|
|
55
|
-
{
|
|
56
|
-
fn deserialize_reader<R: Read>(reader: &mut R) -> borsh::maybestd::io::Result<Self> {
|
|
57
|
-
let length = std::mem::size_of::<T>();
|
|
58
|
-
// buffer to read the data
|
|
59
|
-
let mut buffer = vec![0u8; length];
|
|
60
|
-
// vec to store the items
|
|
61
|
-
let mut items: Vec<T> = Vec::new();
|
|
31
|
+
{% endif %}
|
|
62
32
|
|
|
63
|
-
|
|
64
|
-
match reader.read(&mut buffer)? {
|
|
65
|
-
0 => break,
|
|
66
|
-
n if n == length => items.push(T::deserialize(&mut buffer.as_slice())?),
|
|
67
|
-
e => {
|
|
68
|
-
return Err(borsh::maybestd::io::Error::new(
|
|
69
|
-
borsh::maybestd::io::ErrorKind::InvalidData,
|
|
70
|
-
format!("unexpected number of bytes (read {e}, expected {length})"),
|
|
71
|
-
))
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
Ok(Self(items))
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
impl<T> BorshSerialize for RemainderVec<T>
|
|
81
|
-
where
|
|
82
|
-
T: BorshSerialize + BorshDeserialize,
|
|
83
|
-
{
|
|
84
|
-
fn serialize<W: Write>(&self, writer: &mut W) -> borsh::maybestd::io::Result<()> {
|
|
85
|
-
// serialize each item without adding a prefix for the length
|
|
86
|
-
for item in self.0.iter() {
|
|
87
|
-
item.serialize(writer)?;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
Ok(())
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
{% endblock %}
|
|
33
|
+
{% endblock %}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRenderMapVisitor.d.ts","sourceRoot":"","sources":["../../src/getRenderMapVisitor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAenD,OAAO,EAAkD,aAAa,EAAU,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9G,MAAM,MAAM,mBAAmB,GAAG;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,mBAAwB,
|
|
1
|
+
{"version":3,"file":"getRenderMapVisitor.d.ts","sourceRoot":"","sources":["../../src/getRenderMapVisitor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAenD,OAAO,EAAkD,aAAa,EAAU,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9G,MAAM,MAAM,mBAAmB,GAAG;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,mBAAwB,0IAiQpE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTypeManifestVisitor.d.ts","sourceRoot":"","sources":["../../src/getTypeManifestVisitor.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAgB,MAAM,SAAS,CAAC;AAEzF,MAAM,MAAM,YAAY,GAAG;IACvB,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC5C,aAAa,EAAE,qBAAqB,CAAC;IACrC,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,
|
|
1
|
+
{"version":3,"file":"getTypeManifestVisitor.d.ts","sourceRoot":"","sources":["../../src/getTypeManifestVisitor.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAgB,MAAM,SAAS,CAAC;AAEzF,MAAM,MAAM,YAAY,GAAG;IACvB,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC5C,aAAa,EAAE,qBAAqB,CAAC;IACrC,iBAAiB,EAAE,yBAAyB,CAAC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,utBAmbA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codama/renderers-rust",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Renders Rust clients for your programs",
|
|
5
5
|
"exports": {
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@solana/codecs-strings": "rc",
|
|
32
32
|
"nunjucks": "^3.2.4",
|
|
33
|
-
"@codama/
|
|
34
|
-
"@codama/
|
|
35
|
-
"@codama/renderers-core": "1.0.
|
|
36
|
-
"@codama/
|
|
33
|
+
"@codama/nodes": "1.2.1",
|
|
34
|
+
"@codama/visitors-core": "1.2.1",
|
|
35
|
+
"@codama/renderers-core": "1.0.3",
|
|
36
|
+
"@codama/errors": "1.2.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/nunjucks": "^3.2.6"
|