@fastnear/borsh-schema 0.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.
- package/dist/cjs/index.js +189 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/esm/index.js +166 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/umd/index.js +187 -0
- package/dist/umd/index.js.map +7 -0
- package/package.json +29 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/* ⋈ 🏃🏻💨 FastNEAR - https://github.com/fastnear */
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
getBorshSchema: () => getBorshSchema
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
|
26
|
+
var getBorshSchema = (() => {
|
|
27
|
+
class BorshSchema {
|
|
28
|
+
Ed25519Signature = {
|
|
29
|
+
struct: {
|
|
30
|
+
data: { array: { type: "u8", len: 64 } }
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
Secp256k1Signature = {
|
|
34
|
+
struct: {
|
|
35
|
+
data: { array: { type: "u8", len: 65 } }
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Signature = {
|
|
39
|
+
enum: [
|
|
40
|
+
{ struct: { ed25519Signature: this.Ed25519Signature } },
|
|
41
|
+
{ struct: { secp256k1Signature: this.Secp256k1Signature } }
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
Ed25519Data = {
|
|
45
|
+
struct: {
|
|
46
|
+
data: { array: { type: "u8", len: 32 } }
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Secp256k1Data = {
|
|
50
|
+
struct: {
|
|
51
|
+
data: { array: { type: "u8", len: 64 } }
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
PublicKey = {
|
|
55
|
+
enum: [
|
|
56
|
+
{ struct: { ed25519Key: this.Ed25519Data } },
|
|
57
|
+
{ struct: { secp256k1Key: this.Secp256k1Data } }
|
|
58
|
+
]
|
|
59
|
+
};
|
|
60
|
+
FunctionCallPermission = {
|
|
61
|
+
struct: {
|
|
62
|
+
allowance: { option: "u128" },
|
|
63
|
+
receiverId: "string",
|
|
64
|
+
methodNames: { array: { type: "string" } }
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
FullAccessPermission = {
|
|
68
|
+
struct: {}
|
|
69
|
+
};
|
|
70
|
+
AccessKeyPermission = {
|
|
71
|
+
enum: [
|
|
72
|
+
{ struct: { functionCall: this.FunctionCallPermission } },
|
|
73
|
+
{ struct: { fullAccess: this.FullAccessPermission } }
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
AccessKey = {
|
|
77
|
+
struct: {
|
|
78
|
+
nonce: "u64",
|
|
79
|
+
permission: this.AccessKeyPermission
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
CreateAccount = {
|
|
83
|
+
struct: {}
|
|
84
|
+
};
|
|
85
|
+
DeployContract = {
|
|
86
|
+
struct: {
|
|
87
|
+
code: { array: { type: "u8" } }
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
FunctionCall = {
|
|
91
|
+
struct: {
|
|
92
|
+
methodName: "string",
|
|
93
|
+
args: { array: { type: "u8" } },
|
|
94
|
+
gas: "u64",
|
|
95
|
+
deposit: "u128"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
Transfer = {
|
|
99
|
+
struct: {
|
|
100
|
+
deposit: "u128"
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
Stake = {
|
|
104
|
+
struct: {
|
|
105
|
+
stake: "u128",
|
|
106
|
+
publicKey: this.PublicKey
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
AddKey = {
|
|
110
|
+
struct: {
|
|
111
|
+
publicKey: this.PublicKey,
|
|
112
|
+
accessKey: this.AccessKey
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
DeleteKey = {
|
|
116
|
+
struct: {
|
|
117
|
+
publicKey: this.PublicKey
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
DeleteAccount = {
|
|
121
|
+
struct: {
|
|
122
|
+
beneficiaryId: "string"
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
ClassicAction = {
|
|
126
|
+
enum: [
|
|
127
|
+
{ struct: { createAccount: this.CreateAccount } },
|
|
128
|
+
{ struct: { deployContract: this.DeployContract } },
|
|
129
|
+
{ struct: { functionCall: this.FunctionCall } },
|
|
130
|
+
{ struct: { transfer: this.Transfer } },
|
|
131
|
+
{ struct: { stake: this.Stake } },
|
|
132
|
+
{ struct: { addKey: this.AddKey } },
|
|
133
|
+
{ struct: { deleteKey: this.DeleteKey } },
|
|
134
|
+
{ struct: { deleteAccount: this.DeleteAccount } }
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
DelegateAction = {
|
|
138
|
+
struct: {
|
|
139
|
+
senderId: "string",
|
|
140
|
+
receiverId: "string",
|
|
141
|
+
actions: { array: { type: this.ClassicAction } },
|
|
142
|
+
nonce: "u64",
|
|
143
|
+
maxBlockHeight: "u64",
|
|
144
|
+
publicKey: this.PublicKey
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
SignedDelegate = {
|
|
148
|
+
struct: {
|
|
149
|
+
delegateAction: this.DelegateAction,
|
|
150
|
+
signature: this.Signature
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
Action = {
|
|
154
|
+
enum: [
|
|
155
|
+
{ struct: { createAccount: this.CreateAccount } },
|
|
156
|
+
{ struct: { deployContract: this.DeployContract } },
|
|
157
|
+
{ struct: { functionCall: this.FunctionCall } },
|
|
158
|
+
{ struct: { transfer: this.Transfer } },
|
|
159
|
+
{ struct: { stake: this.Stake } },
|
|
160
|
+
{ struct: { addKey: this.AddKey } },
|
|
161
|
+
{ struct: { deleteKey: this.DeleteKey } },
|
|
162
|
+
{ struct: { deleteAccount: this.DeleteAccount } },
|
|
163
|
+
{ struct: { signedDelegate: this.SignedDelegate } }
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
Transaction = {
|
|
167
|
+
struct: {
|
|
168
|
+
signerId: "string",
|
|
169
|
+
publicKey: this.PublicKey,
|
|
170
|
+
nonce: "u64",
|
|
171
|
+
receiverId: "string",
|
|
172
|
+
blockHash: { array: { type: "u8", len: 32 } },
|
|
173
|
+
actions: { array: { type: this.Action } }
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
SignedTransaction = {
|
|
177
|
+
struct: {
|
|
178
|
+
transaction: this.Transaction,
|
|
179
|
+
signature: this.Signature
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return new BorshSchema();
|
|
184
|
+
})();
|
|
185
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
186
|
+
0 && (module.exports = {
|
|
187
|
+
getBorshSchema
|
|
188
|
+
});
|
|
189
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export const getBorshSchema = (() => {\n class BorshSchema {\n Ed25519Signature = {\n struct: {\n data: { array: { type: \"u8\", len: 64 } },\n },\n };\n Secp256k1Signature = {\n struct: {\n data: { array: { type: \"u8\", len: 65 } },\n },\n };\n Signature = {\n enum: [\n { struct: { ed25519Signature: this.Ed25519Signature } },\n { struct: { secp256k1Signature: this.Secp256k1Signature } },\n ],\n };\n Ed25519Data = {\n struct: {\n data: { array: { type: \"u8\", len: 32 } },\n },\n };\n Secp256k1Data = {\n struct: {\n data: { array: { type: \"u8\", len: 64 } },\n },\n };\n PublicKey = {\n enum: [\n { struct: { ed25519Key: this.Ed25519Data } },\n { struct: { secp256k1Key: this.Secp256k1Data } },\n ],\n };\n FunctionCallPermission = {\n struct: {\n allowance: { option: \"u128\" },\n receiverId: \"string\",\n methodNames: { array: { type: \"string\" } },\n },\n };\n FullAccessPermission = {\n struct: {},\n };\n AccessKeyPermission = {\n enum: [\n { struct: { functionCall: this.FunctionCallPermission } },\n { struct: { fullAccess: this.FullAccessPermission } },\n ],\n };\n AccessKey = {\n struct: {\n nonce: \"u64\",\n permission: this.AccessKeyPermission,\n },\n };\n CreateAccount = {\n struct: {},\n };\n DeployContract = {\n struct: {\n code: { array: { type: \"u8\" } },\n },\n };\n FunctionCall = {\n struct: {\n methodName: \"string\",\n args: { array: { type: \"u8\" } },\n gas: \"u64\",\n deposit: \"u128\",\n },\n };\n Transfer = {\n struct: {\n deposit: \"u128\",\n },\n };\n Stake = {\n struct: {\n stake: \"u128\",\n publicKey: this.PublicKey,\n },\n };\n AddKey = {\n struct: {\n publicKey: this.PublicKey,\n accessKey: this.AccessKey,\n },\n };\n DeleteKey = {\n struct: {\n publicKey: this.PublicKey,\n },\n };\n DeleteAccount = {\n struct: {\n beneficiaryId: \"string\",\n },\n };\n ClassicAction = {\n enum: [\n { struct: { createAccount: this.CreateAccount } },\n { struct: { deployContract: this.DeployContract } },\n { struct: { functionCall: this.FunctionCall } },\n { struct: { transfer: this.Transfer } },\n { struct: { stake: this.Stake } },\n { struct: { addKey: this.AddKey } },\n { struct: { deleteKey: this.DeleteKey } },\n { struct: { deleteAccount: this.DeleteAccount } },\n ],\n };\n DelegateAction = {\n struct: {\n senderId: \"string\",\n receiverId: \"string\",\n actions: { array: { type: this.ClassicAction } },\n nonce: \"u64\",\n maxBlockHeight: \"u64\",\n publicKey: this.PublicKey,\n },\n };\n SignedDelegate = {\n struct: {\n delegateAction: this.DelegateAction,\n signature: this.Signature,\n },\n };\n Action = {\n enum: [\n { struct: { createAccount: this.CreateAccount } },\n { struct: { deployContract: this.DeployContract } },\n { struct: { functionCall: this.FunctionCall } },\n { struct: { transfer: this.Transfer } },\n { struct: { stake: this.Stake } },\n { struct: { addKey: this.AddKey } },\n { struct: { deleteKey: this.DeleteKey } },\n { struct: { deleteAccount: this.DeleteAccount } },\n { struct: { signedDelegate: this.SignedDelegate } },\n ],\n };\n Transaction = {\n struct: {\n signerId: \"string\",\n publicKey: this.PublicKey,\n nonce: \"u64\",\n receiverId: \"string\",\n blockHash: { array: { type: \"u8\", len: 32 } },\n actions: { array: { type: this.Action } },\n },\n };\n SignedTransaction = {\n struct: {\n transaction: this.Transaction,\n signature: this.Signature,\n },\n };\n }\n return new BorshSchema();\n})();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,kBAAkB,MAAM;AAAA,EACnC,MAAM,YAAY;AAAA,IAChB,mBAAmB;AAAA,MACjB,QAAQ;AAAA,QACN,MAAM,EAAE,OAAO,EAAE,MAAM,MAAM,KAAK,GAAG,EAAE;AAAA,MACzC;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB,QAAQ;AAAA,QACN,MAAM,EAAE,OAAO,EAAE,MAAM,MAAM,KAAK,GAAG,EA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G;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/* ⋈ 🏃🏻💨 FastNEAR - https://github.com/fastnear */
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
var getBorshSchema = (() => {
|
|
5
|
+
class BorshSchema {
|
|
6
|
+
Ed25519Signature = {
|
|
7
|
+
struct: {
|
|
8
|
+
data: { array: { type: "u8", len: 64 } }
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
Secp256k1Signature = {
|
|
12
|
+
struct: {
|
|
13
|
+
data: { array: { type: "u8", len: 65 } }
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
Signature = {
|
|
17
|
+
enum: [
|
|
18
|
+
{ struct: { ed25519Signature: this.Ed25519Signature } },
|
|
19
|
+
{ struct: { secp256k1Signature: this.Secp256k1Signature } }
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
Ed25519Data = {
|
|
23
|
+
struct: {
|
|
24
|
+
data: { array: { type: "u8", len: 32 } }
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
Secp256k1Data = {
|
|
28
|
+
struct: {
|
|
29
|
+
data: { array: { type: "u8", len: 64 } }
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
PublicKey = {
|
|
33
|
+
enum: [
|
|
34
|
+
{ struct: { ed25519Key: this.Ed25519Data } },
|
|
35
|
+
{ struct: { secp256k1Key: this.Secp256k1Data } }
|
|
36
|
+
]
|
|
37
|
+
};
|
|
38
|
+
FunctionCallPermission = {
|
|
39
|
+
struct: {
|
|
40
|
+
allowance: { option: "u128" },
|
|
41
|
+
receiverId: "string",
|
|
42
|
+
methodNames: { array: { type: "string" } }
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
FullAccessPermission = {
|
|
46
|
+
struct: {}
|
|
47
|
+
};
|
|
48
|
+
AccessKeyPermission = {
|
|
49
|
+
enum: [
|
|
50
|
+
{ struct: { functionCall: this.FunctionCallPermission } },
|
|
51
|
+
{ struct: { fullAccess: this.FullAccessPermission } }
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
AccessKey = {
|
|
55
|
+
struct: {
|
|
56
|
+
nonce: "u64",
|
|
57
|
+
permission: this.AccessKeyPermission
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
CreateAccount = {
|
|
61
|
+
struct: {}
|
|
62
|
+
};
|
|
63
|
+
DeployContract = {
|
|
64
|
+
struct: {
|
|
65
|
+
code: { array: { type: "u8" } }
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
FunctionCall = {
|
|
69
|
+
struct: {
|
|
70
|
+
methodName: "string",
|
|
71
|
+
args: { array: { type: "u8" } },
|
|
72
|
+
gas: "u64",
|
|
73
|
+
deposit: "u128"
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
Transfer = {
|
|
77
|
+
struct: {
|
|
78
|
+
deposit: "u128"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
Stake = {
|
|
82
|
+
struct: {
|
|
83
|
+
stake: "u128",
|
|
84
|
+
publicKey: this.PublicKey
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
AddKey = {
|
|
88
|
+
struct: {
|
|
89
|
+
publicKey: this.PublicKey,
|
|
90
|
+
accessKey: this.AccessKey
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
DeleteKey = {
|
|
94
|
+
struct: {
|
|
95
|
+
publicKey: this.PublicKey
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
DeleteAccount = {
|
|
99
|
+
struct: {
|
|
100
|
+
beneficiaryId: "string"
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
ClassicAction = {
|
|
104
|
+
enum: [
|
|
105
|
+
{ struct: { createAccount: this.CreateAccount } },
|
|
106
|
+
{ struct: { deployContract: this.DeployContract } },
|
|
107
|
+
{ struct: { functionCall: this.FunctionCall } },
|
|
108
|
+
{ struct: { transfer: this.Transfer } },
|
|
109
|
+
{ struct: { stake: this.Stake } },
|
|
110
|
+
{ struct: { addKey: this.AddKey } },
|
|
111
|
+
{ struct: { deleteKey: this.DeleteKey } },
|
|
112
|
+
{ struct: { deleteAccount: this.DeleteAccount } }
|
|
113
|
+
]
|
|
114
|
+
};
|
|
115
|
+
DelegateAction = {
|
|
116
|
+
struct: {
|
|
117
|
+
senderId: "string",
|
|
118
|
+
receiverId: "string",
|
|
119
|
+
actions: { array: { type: this.ClassicAction } },
|
|
120
|
+
nonce: "u64",
|
|
121
|
+
maxBlockHeight: "u64",
|
|
122
|
+
publicKey: this.PublicKey
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
SignedDelegate = {
|
|
126
|
+
struct: {
|
|
127
|
+
delegateAction: this.DelegateAction,
|
|
128
|
+
signature: this.Signature
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
Action = {
|
|
132
|
+
enum: [
|
|
133
|
+
{ struct: { createAccount: this.CreateAccount } },
|
|
134
|
+
{ struct: { deployContract: this.DeployContract } },
|
|
135
|
+
{ struct: { functionCall: this.FunctionCall } },
|
|
136
|
+
{ struct: { transfer: this.Transfer } },
|
|
137
|
+
{ struct: { stake: this.Stake } },
|
|
138
|
+
{ struct: { addKey: this.AddKey } },
|
|
139
|
+
{ struct: { deleteKey: this.DeleteKey } },
|
|
140
|
+
{ struct: { deleteAccount: this.DeleteAccount } },
|
|
141
|
+
{ struct: { signedDelegate: this.SignedDelegate } }
|
|
142
|
+
]
|
|
143
|
+
};
|
|
144
|
+
Transaction = {
|
|
145
|
+
struct: {
|
|
146
|
+
signerId: "string",
|
|
147
|
+
publicKey: this.PublicKey,
|
|
148
|
+
nonce: "u64",
|
|
149
|
+
receiverId: "string",
|
|
150
|
+
blockHash: { array: { type: "u8", len: 32 } },
|
|
151
|
+
actions: { array: { type: this.Action } }
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
SignedTransaction = {
|
|
155
|
+
struct: {
|
|
156
|
+
transaction: this.Transaction,
|
|
157
|
+
signature: this.Signature
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
return new BorshSchema();
|
|
162
|
+
})();
|
|
163
|
+
export {
|
|
164
|
+
getBorshSchema
|
|
165
|
+
};
|
|
166
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export const getBorshSchema = (() => {\n class BorshSchema {\n Ed25519Signature = {\n struct: {\n data: { array: { type: \"u8\", len: 64 } },\n },\n };\n Secp256k1Signature = {\n struct: {\n data: { array: { type: \"u8\", len: 65 } },\n },\n };\n Signature = {\n enum: [\n { struct: { ed25519Signature: this.Ed25519Signature } },\n { struct: { secp256k1Signature: this.Secp256k1Signature } },\n ],\n };\n Ed25519Data = {\n struct: {\n data: { array: { type: \"u8\", len: 32 } },\n },\n };\n Secp256k1Data = {\n struct: {\n data: { array: { type: \"u8\", len: 64 } },\n },\n };\n PublicKey = {\n enum: [\n { struct: { ed25519Key: this.Ed25519Data } },\n { struct: { secp256k1Key: this.Secp256k1Data } },\n ],\n };\n FunctionCallPermission = {\n struct: {\n allowance: { option: \"u128\" },\n receiverId: \"string\",\n methodNames: { array: { type: \"string\" } },\n },\n };\n FullAccessPermission = {\n struct: {},\n };\n AccessKeyPermission = {\n enum: [\n { struct: { functionCall: this.FunctionCallPermission } },\n { struct: { fullAccess: this.FullAccessPermission } },\n ],\n };\n AccessKey = {\n struct: {\n nonce: \"u64\",\n permission: this.AccessKeyPermission,\n },\n };\n CreateAccount = {\n struct: {},\n };\n DeployContract = {\n struct: {\n code: { array: { type: \"u8\" } },\n },\n };\n FunctionCall = {\n struct: {\n methodName: \"string\",\n args: { array: { type: \"u8\" } },\n gas: \"u64\",\n deposit: \"u128\",\n },\n };\n Transfer = {\n struct: {\n deposit: \"u128\",\n },\n };\n Stake = {\n struct: {\n stake: \"u128\",\n publicKey: this.PublicKey,\n },\n };\n AddKey = {\n struct: {\n publicKey: this.PublicKey,\n accessKey: this.AccessKey,\n },\n };\n DeleteKey = {\n struct: {\n publicKey: this.PublicKey,\n },\n };\n DeleteAccount = {\n struct: {\n beneficiaryId: \"string\",\n },\n };\n ClassicAction = {\n enum: [\n { struct: { createAccount: this.CreateAccount } },\n { struct: { deployContract: this.DeployContract } },\n { struct: { functionCall: this.FunctionCall } },\n { struct: { transfer: this.Transfer } },\n { struct: { stake: this.Stake } },\n { struct: { addKey: this.AddKey } },\n { struct: { deleteKey: this.DeleteKey } },\n { struct: { deleteAccount: this.DeleteAccount } },\n ],\n };\n DelegateAction = {\n struct: {\n senderId: \"string\",\n receiverId: \"string\",\n actions: { array: { type: this.ClassicAction } },\n nonce: \"u64\",\n maxBlockHeight: \"u64\",\n publicKey: this.PublicKey,\n },\n };\n SignedDelegate = {\n struct: {\n delegateAction: this.DelegateAction,\n signature: this.Signature,\n },\n };\n Action = {\n enum: [\n { struct: { createAccount: this.CreateAccount } },\n { struct: { deployContract: this.DeployContract } },\n { struct: { functionCall: this.FunctionCall } },\n { struct: { transfer: this.Transfer } },\n { struct: { stake: this.Stake } },\n { struct: { addKey: this.AddKey } },\n { struct: { deleteKey: this.DeleteKey } },\n { struct: { deleteAccount: this.DeleteAccount } },\n { struct: { signedDelegate: this.SignedDelegate } },\n ],\n };\n Transaction = {\n struct: {\n signerId: \"string\",\n publicKey: this.PublicKey,\n nonce: \"u64\",\n receiverId: \"string\",\n blockHash: { array: { type: \"u8\", len: 32 } },\n actions: { array: { type: this.Action } },\n },\n };\n SignedTransaction = {\n struct: {\n transaction: this.Transaction,\n signature: this.Signature,\n },\n };\n }\n return new BorshSchema();\n})();\n"],
|
|
5
|
+
"mappings": ";;;AAAO,IAAM,kBAAkB,MAAM;AAAA,EACnC,MAAM,YAAY;AAAA,IAChB,mBAAmB;AAAA,MACjB,QAAQ;AAAA,QACN,MA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AAA,MAC1C;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB,QAAQ;AAAA,QACN,aAAa,KAAK;AAAA,QAClB,WAAW,KAAK;AAAA,MAClB;AAAA,IACF;AAAA,EACF;AACA,SAAO,IAAI,YAAY;AACzB,GAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/* ⋈ 🏃🏻💨 FastNEAR - https://github.com/fastnear */
|
|
2
|
+
var nearBorshSchema = (() => {
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/index.ts
|
|
22
|
+
var src_exports = {};
|
|
23
|
+
__export(src_exports, {
|
|
24
|
+
getBorshSchema: () => getBorshSchema
|
|
25
|
+
});
|
|
26
|
+
var getBorshSchema = (() => {
|
|
27
|
+
class BorshSchema {
|
|
28
|
+
Ed25519Signature = {
|
|
29
|
+
struct: {
|
|
30
|
+
data: { array: { type: "u8", len: 64 } }
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
Secp256k1Signature = {
|
|
34
|
+
struct: {
|
|
35
|
+
data: { array: { type: "u8", len: 65 } }
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Signature = {
|
|
39
|
+
enum: [
|
|
40
|
+
{ struct: { ed25519Signature: this.Ed25519Signature } },
|
|
41
|
+
{ struct: { secp256k1Signature: this.Secp256k1Signature } }
|
|
42
|
+
]
|
|
43
|
+
};
|
|
44
|
+
Ed25519Data = {
|
|
45
|
+
struct: {
|
|
46
|
+
data: { array: { type: "u8", len: 32 } }
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Secp256k1Data = {
|
|
50
|
+
struct: {
|
|
51
|
+
data: { array: { type: "u8", len: 64 } }
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
PublicKey = {
|
|
55
|
+
enum: [
|
|
56
|
+
{ struct: { ed25519Key: this.Ed25519Data } },
|
|
57
|
+
{ struct: { secp256k1Key: this.Secp256k1Data } }
|
|
58
|
+
]
|
|
59
|
+
};
|
|
60
|
+
FunctionCallPermission = {
|
|
61
|
+
struct: {
|
|
62
|
+
allowance: { option: "u128" },
|
|
63
|
+
receiverId: "string",
|
|
64
|
+
methodNames: { array: { type: "string" } }
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
FullAccessPermission = {
|
|
68
|
+
struct: {}
|
|
69
|
+
};
|
|
70
|
+
AccessKeyPermission = {
|
|
71
|
+
enum: [
|
|
72
|
+
{ struct: { functionCall: this.FunctionCallPermission } },
|
|
73
|
+
{ struct: { fullAccess: this.FullAccessPermission } }
|
|
74
|
+
]
|
|
75
|
+
};
|
|
76
|
+
AccessKey = {
|
|
77
|
+
struct: {
|
|
78
|
+
nonce: "u64",
|
|
79
|
+
permission: this.AccessKeyPermission
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
CreateAccount = {
|
|
83
|
+
struct: {}
|
|
84
|
+
};
|
|
85
|
+
DeployContract = {
|
|
86
|
+
struct: {
|
|
87
|
+
code: { array: { type: "u8" } }
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
FunctionCall = {
|
|
91
|
+
struct: {
|
|
92
|
+
methodName: "string",
|
|
93
|
+
args: { array: { type: "u8" } },
|
|
94
|
+
gas: "u64",
|
|
95
|
+
deposit: "u128"
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
Transfer = {
|
|
99
|
+
struct: {
|
|
100
|
+
deposit: "u128"
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
Stake = {
|
|
104
|
+
struct: {
|
|
105
|
+
stake: "u128",
|
|
106
|
+
publicKey: this.PublicKey
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
AddKey = {
|
|
110
|
+
struct: {
|
|
111
|
+
publicKey: this.PublicKey,
|
|
112
|
+
accessKey: this.AccessKey
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
DeleteKey = {
|
|
116
|
+
struct: {
|
|
117
|
+
publicKey: this.PublicKey
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
DeleteAccount = {
|
|
121
|
+
struct: {
|
|
122
|
+
beneficiaryId: "string"
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
ClassicAction = {
|
|
126
|
+
enum: [
|
|
127
|
+
{ struct: { createAccount: this.CreateAccount } },
|
|
128
|
+
{ struct: { deployContract: this.DeployContract } },
|
|
129
|
+
{ struct: { functionCall: this.FunctionCall } },
|
|
130
|
+
{ struct: { transfer: this.Transfer } },
|
|
131
|
+
{ struct: { stake: this.Stake } },
|
|
132
|
+
{ struct: { addKey: this.AddKey } },
|
|
133
|
+
{ struct: { deleteKey: this.DeleteKey } },
|
|
134
|
+
{ struct: { deleteAccount: this.DeleteAccount } }
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
DelegateAction = {
|
|
138
|
+
struct: {
|
|
139
|
+
senderId: "string",
|
|
140
|
+
receiverId: "string",
|
|
141
|
+
actions: { array: { type: this.ClassicAction } },
|
|
142
|
+
nonce: "u64",
|
|
143
|
+
maxBlockHeight: "u64",
|
|
144
|
+
publicKey: this.PublicKey
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
SignedDelegate = {
|
|
148
|
+
struct: {
|
|
149
|
+
delegateAction: this.DelegateAction,
|
|
150
|
+
signature: this.Signature
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
Action = {
|
|
154
|
+
enum: [
|
|
155
|
+
{ struct: { createAccount: this.CreateAccount } },
|
|
156
|
+
{ struct: { deployContract: this.DeployContract } },
|
|
157
|
+
{ struct: { functionCall: this.FunctionCall } },
|
|
158
|
+
{ struct: { transfer: this.Transfer } },
|
|
159
|
+
{ struct: { stake: this.Stake } },
|
|
160
|
+
{ struct: { addKey: this.AddKey } },
|
|
161
|
+
{ struct: { deleteKey: this.DeleteKey } },
|
|
162
|
+
{ struct: { deleteAccount: this.DeleteAccount } },
|
|
163
|
+
{ struct: { signedDelegate: this.SignedDelegate } }
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
Transaction = {
|
|
167
|
+
struct: {
|
|
168
|
+
signerId: "string",
|
|
169
|
+
publicKey: this.PublicKey,
|
|
170
|
+
nonce: "u64",
|
|
171
|
+
receiverId: "string",
|
|
172
|
+
blockHash: { array: { type: "u8", len: 32 } },
|
|
173
|
+
actions: { array: { type: this.Action } }
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
SignedTransaction = {
|
|
177
|
+
struct: {
|
|
178
|
+
transaction: this.Transaction,
|
|
179
|
+
signature: this.Signature
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
return new BorshSchema();
|
|
184
|
+
})();
|
|
185
|
+
return __toCommonJS(src_exports);
|
|
186
|
+
})();
|
|
187
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export const getBorshSchema = (() => {\n class BorshSchema {\n Ed25519Signature = {\n struct: {\n data: { array: { type: \"u8\", len: 64 } },\n },\n };\n Secp256k1Signature = {\n struct: {\n data: { array: { type: \"u8\", len: 65 } },\n },\n };\n Signature = {\n enum: [\n { struct: { ed25519Signature: this.Ed25519Signature } },\n { struct: { secp256k1Signature: this.Secp256k1Signature } },\n ],\n };\n Ed25519Data = {\n struct: {\n data: { array: { type: \"u8\", len: 32 } },\n },\n };\n Secp256k1Data = {\n struct: {\n data: { array: { type: \"u8\", len: 64 } },\n },\n };\n PublicKey = {\n enum: [\n { struct: { ed25519Key: this.Ed25519Data } },\n { struct: { secp256k1Key: this.Secp256k1Data } },\n ],\n };\n FunctionCallPermission = {\n struct: {\n allowance: { option: \"u128\" },\n receiverId: \"string\",\n methodNames: { array: { type: \"string\" } },\n },\n };\n FullAccessPermission = {\n struct: {},\n };\n AccessKeyPermission = {\n enum: [\n { struct: { functionCall: this.FunctionCallPermission } },\n { struct: { fullAccess: this.FullAccessPermission } },\n ],\n };\n AccessKey = {\n struct: {\n nonce: \"u64\",\n permission: this.AccessKeyPermission,\n },\n };\n CreateAccount = {\n struct: {},\n };\n DeployContract = {\n struct: {\n code: { array: { type: \"u8\" } },\n },\n };\n FunctionCall = {\n struct: {\n methodName: \"string\",\n args: { array: { type: \"u8\" } },\n gas: \"u64\",\n deposit: \"u128\",\n },\n };\n Transfer = {\n struct: {\n deposit: \"u128\",\n },\n };\n Stake = {\n struct: {\n stake: \"u128\",\n publicKey: this.PublicKey,\n },\n };\n AddKey = {\n struct: {\n publicKey: this.PublicKey,\n accessKey: this.AccessKey,\n },\n };\n DeleteKey = {\n struct: {\n publicKey: this.PublicKey,\n },\n };\n DeleteAccount = {\n struct: {\n beneficiaryId: \"string\",\n },\n };\n ClassicAction = {\n enum: [\n { struct: { createAccount: this.CreateAccount } },\n { struct: { deployContract: this.DeployContract } },\n { struct: { functionCall: this.FunctionCall } },\n { struct: { transfer: this.Transfer } },\n { struct: { stake: this.Stake } },\n { struct: { addKey: this.AddKey } },\n { struct: { deleteKey: this.DeleteKey } },\n { struct: { deleteAccount: this.DeleteAccount } },\n ],\n };\n DelegateAction = {\n struct: {\n senderId: \"string\",\n receiverId: \"string\",\n actions: { array: { type: this.ClassicAction } },\n nonce: \"u64\",\n maxBlockHeight: \"u64\",\n publicKey: this.PublicKey,\n },\n };\n SignedDelegate = {\n struct: {\n delegateAction: this.DelegateAction,\n signature: this.Signature,\n },\n };\n Action = {\n enum: [\n { struct: { createAccount: this.CreateAccount } },\n { struct: { deployContract: this.DeployContract } },\n { struct: { functionCall: this.FunctionCall } },\n { struct: { transfer: this.Transfer } },\n { struct: { stake: this.Stake } },\n { struct: { addKey: this.AddKey } },\n { struct: { deleteKey: this.DeleteKey } },\n { struct: { deleteAccount: this.DeleteAccount } },\n { struct: { signedDelegate: this.SignedDelegate } },\n ],\n };\n Transaction = {\n struct: {\n signerId: \"string\",\n publicKey: this.PublicKey,\n nonce: \"u64\",\n receiverId: \"string\",\n blockHash: { array: { type: \"u8\", len: 32 } },\n actions: { array: { type: this.Action } },\n },\n };\n SignedTransaction = {\n struct: {\n transaction: this.Transaction,\n signature: this.Signature,\n },\n };\n }\n return new BorshSchema();\n})();\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,kBAAkB,MAAM;AAAA,IACnC,MAAM,YAAY;AAAA,MAChB,mBAAmB;AAAA,QACjB,QAAQ;AAAA,UACN,MAAM,EAAE,OAAO,EAAE,MAAM,MAAM,KAAK,GAAG,EAAE;AAAA,QACzC;AAAA,MACF;AAAA,MACA,qBAAqB;AAAA,QACnB,QAAQ;AAAA,UACN,MAAM,EAAE,OAAO,EAAE,MAAM,MAAM,KAAK,GAAG,EAAE;AAAA,QACzC;AAAA,MACF;AAAA,MACA,YAAY;AAAA,QACV,MAAM;AAAA,UACJ,EAAE,QAAQ,EAAE,kBAAkB,KAAK,iBA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"name": "@fastnear/borsh-schema",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Single export of NEAR Protocol's borsh schema for common applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "node esbuild.config.mjs",
|
|
8
|
+
"publish": "yarn npm publish",
|
|
9
|
+
"clean": "yarn rimraf dist node_modules"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"near-protocol",
|
|
13
|
+
"blockchain",
|
|
14
|
+
"fastnear"
|
|
15
|
+
],
|
|
16
|
+
"author": "FastNEAR",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"require": "./dist/cjs/index.js",
|
|
23
|
+
"import": "./dist/esm/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"rimraf": "*"
|
|
28
|
+
}
|
|
29
|
+
}
|