@xandeum/web3.js 1.3.5 → 1.3.6
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/armageddon.js +15 -4
- package/dist/assignCoowner.js +16 -5
- package/dist/bigbang.js +5 -0
- package/dist/copyPath.js +16 -5
- package/dist/createDirectory.js +16 -5
- package/dist/createFile.js +16 -5
- package/dist/move.js +16 -5
- package/dist/peek.js +18 -7
- package/dist/poke.js +18 -7
- package/dist/removeDirectory.js +16 -5
- package/dist/removeFile.js +16 -5
- package/dist/renamePath.js +16 -5
- package/package.json +1 -1
- package/src/armageddon.ts +19 -4
- package/src/assignCoowner.ts +21 -5
- package/src/bigbang.ts +6 -3
- package/src/copyPath.ts +20 -5
- package/src/createDirectory.ts +21 -5
- package/src/createFile.ts +21 -5
- package/src/move.ts +20 -5
- package/src/peek.ts +23 -7
- package/src/poke.ts +23 -7
- package/src/removeDirectory.ts +20 -5
- package/src/removeFile.ts +20 -5
- package/src/renamePath.ts +20 -5
package/dist/armageddon.js
CHANGED
|
@@ -54,12 +54,18 @@ var helpers_js_1 = require("./helpers.js");
|
|
|
54
54
|
*/
|
|
55
55
|
function armageddon(fsid, wallet) {
|
|
56
56
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
|
-
var instructionData, feeDistributorPda, instruction, tx;
|
|
57
|
+
var innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
58
58
|
return __generator(this, function (_a) {
|
|
59
|
+
innerData = Buffer.concat([
|
|
60
|
+
Buffer.from([1]),
|
|
61
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8))
|
|
62
|
+
]);
|
|
63
|
+
innerLen = Buffer.alloc(4);
|
|
64
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
59
65
|
instructionData = Buffer.concat([
|
|
60
|
-
Buffer.from(
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
Buffer.from([0]),
|
|
67
|
+
innerLen,
|
|
68
|
+
innerData
|
|
63
69
|
]);
|
|
64
70
|
feeDistributorPda = (0, helpers_js_1.getFeeDistributorPda)();
|
|
65
71
|
instruction = new web3_js_1.TransactionInstruction({
|
|
@@ -73,6 +79,11 @@ function armageddon(fsid, wallet) {
|
|
|
73
79
|
pubkey: feeDistributorPda.pda,
|
|
74
80
|
isSigner: false,
|
|
75
81
|
isWritable: true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
85
|
+
isSigner: false,
|
|
86
|
+
isWritable: false
|
|
76
87
|
}
|
|
77
88
|
],
|
|
78
89
|
programId: new web3_js_1.PublicKey(const_js_1.programId),
|
package/dist/assignCoowner.js
CHANGED
|
@@ -56,15 +56,21 @@ var helpers_js_1 = require("./helpers.js");
|
|
|
56
56
|
*/
|
|
57
57
|
function assignCoowner(fsid, path, coowner, wallet) {
|
|
58
58
|
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var rest, instructionData, feeDistributorPda, instruction, tx;
|
|
59
|
+
var rest, innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
60
60
|
return __generator(this, function (_a) {
|
|
61
61
|
rest = Buffer.from("".concat(path, "\0").concat(coowner.toString()), 'utf-8');
|
|
62
|
-
|
|
63
|
-
Buffer.from(
|
|
64
|
-
Buffer.from(
|
|
65
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(fsid).toArray('le', 8))),
|
|
62
|
+
innerData = Buffer.concat([
|
|
63
|
+
Buffer.from([14]),
|
|
64
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
66
65
|
rest
|
|
67
66
|
]);
|
|
67
|
+
innerLen = Buffer.alloc(4);
|
|
68
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
69
|
+
instructionData = Buffer.concat([
|
|
70
|
+
Buffer.from([0]),
|
|
71
|
+
innerLen,
|
|
72
|
+
innerData
|
|
73
|
+
]);
|
|
68
74
|
feeDistributorPda = (0, helpers_js_1.getFeeDistributorPda)();
|
|
69
75
|
instruction = new web3_js_1.TransactionInstruction({
|
|
70
76
|
keys: [
|
|
@@ -77,6 +83,11 @@ function assignCoowner(fsid, path, coowner, wallet) {
|
|
|
77
83
|
pubkey: feeDistributorPda.pda,
|
|
78
84
|
isSigner: false,
|
|
79
85
|
isWritable: true
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
89
|
+
isSigner: false,
|
|
90
|
+
isWritable: false
|
|
80
91
|
}
|
|
81
92
|
],
|
|
82
93
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/bigbang.js
CHANGED
|
@@ -78,6 +78,11 @@ function bigbang(replica_count, wallet) {
|
|
|
78
78
|
pubkey: feeDistributorPda.pda,
|
|
79
79
|
isSigner: false,
|
|
80
80
|
isWritable: true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
84
|
+
isSigner: false,
|
|
85
|
+
isWritable: false
|
|
81
86
|
}
|
|
82
87
|
],
|
|
83
88
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/copyPath.js
CHANGED
|
@@ -58,18 +58,24 @@ var helpers_js_1 = require("./helpers.js");
|
|
|
58
58
|
*/
|
|
59
59
|
function copyPath(fsid, srcPath, destPath, wallet) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var rest, instructionData, feeDistributorPda, instruction, tx;
|
|
61
|
+
var rest, innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
62
62
|
return __generator(this, function (_a) {
|
|
63
63
|
// Validate path: only letters, numbers, and /
|
|
64
64
|
(0, sanitizePath_1.sanitizePath)(srcPath);
|
|
65
65
|
(0, sanitizePath_1.sanitizePath)(destPath);
|
|
66
66
|
rest = Buffer.from("".concat(srcPath, "\0").concat(destPath), 'utf-8');
|
|
67
|
-
|
|
68
|
-
Buffer.from(
|
|
69
|
-
Buffer.from(
|
|
70
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(fsid).toArray('le', 8))),
|
|
67
|
+
innerData = Buffer.concat([
|
|
68
|
+
Buffer.from([9]),
|
|
69
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
71
70
|
rest
|
|
72
71
|
]);
|
|
72
|
+
innerLen = Buffer.alloc(4);
|
|
73
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
74
|
+
instructionData = Buffer.concat([
|
|
75
|
+
Buffer.from([0]),
|
|
76
|
+
innerLen,
|
|
77
|
+
innerData
|
|
78
|
+
]);
|
|
73
79
|
feeDistributorPda = (0, helpers_js_1.getFeeDistributorPda)();
|
|
74
80
|
instruction = new web3_js_1.TransactionInstruction({
|
|
75
81
|
keys: [
|
|
@@ -82,6 +88,11 @@ function copyPath(fsid, srcPath, destPath, wallet) {
|
|
|
82
88
|
pubkey: feeDistributorPda.pda,
|
|
83
89
|
isSigner: false,
|
|
84
90
|
isWritable: true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
94
|
+
isSigner: false,
|
|
95
|
+
isWritable: false
|
|
85
96
|
}
|
|
86
97
|
],
|
|
87
98
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/createDirectory.js
CHANGED
|
@@ -57,17 +57,23 @@ var helpers_js_1 = require("./helpers.js");
|
|
|
57
57
|
*/
|
|
58
58
|
function createDirectory(fsid, path, name, wallet) {
|
|
59
59
|
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
-
var combinedPath, rest, instructionData, feeDistributorPda, instruction, tx;
|
|
60
|
+
var combinedPath, rest, innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
62
|
combinedPath = path.endsWith('/') ? "".concat(path).concat(name) : "".concat(path, "/").concat(name);
|
|
63
63
|
(0, sanitizePath_1.sanitizePath)(combinedPath);
|
|
64
64
|
rest = Buffer.from("".concat(path, "\0").concat(name), 'utf-8');
|
|
65
|
-
|
|
66
|
-
Buffer.from(
|
|
67
|
-
Buffer.from(
|
|
68
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(fsid).toArray('le', 8))),
|
|
65
|
+
innerData = Buffer.concat([
|
|
66
|
+
Buffer.from([6]),
|
|
67
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
69
68
|
rest
|
|
70
69
|
]);
|
|
70
|
+
innerLen = Buffer.alloc(4);
|
|
71
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
72
|
+
instructionData = Buffer.concat([
|
|
73
|
+
Buffer.from([0]),
|
|
74
|
+
innerLen,
|
|
75
|
+
innerData
|
|
76
|
+
]);
|
|
71
77
|
feeDistributorPda = (0, helpers_js_1.getFeeDistributorPda)();
|
|
72
78
|
instruction = new web3_js_1.TransactionInstruction({
|
|
73
79
|
keys: [
|
|
@@ -80,6 +86,11 @@ function createDirectory(fsid, path, name, wallet) {
|
|
|
80
86
|
pubkey: feeDistributorPda.pda,
|
|
81
87
|
isSigner: false,
|
|
82
88
|
isWritable: true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
92
|
+
isSigner: false,
|
|
93
|
+
isWritable: false
|
|
83
94
|
}
|
|
84
95
|
],
|
|
85
96
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/createFile.js
CHANGED
|
@@ -58,17 +58,23 @@ var helpers_js_1 = require("./helpers.js");
|
|
|
58
58
|
*/
|
|
59
59
|
function createFile(fsid, path, name, wallet) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var combinedPath, rest, instructionData, feeDistributorPda, instruction, tx;
|
|
61
|
+
var combinedPath, rest, innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
62
62
|
return __generator(this, function (_a) {
|
|
63
63
|
combinedPath = path.endsWith('/') ? "".concat(path).concat(name) : "".concat(path, "/").concat(name);
|
|
64
64
|
(0, sanitizePath_1.sanitizePath)(combinedPath);
|
|
65
65
|
rest = Buffer.from("".concat(path, "\0").concat(name), 'utf-8');
|
|
66
|
-
|
|
67
|
-
Buffer.from(
|
|
68
|
-
Buffer.from(
|
|
69
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(fsid).toArray('le', 8))),
|
|
66
|
+
innerData = Buffer.concat([
|
|
67
|
+
Buffer.from([2]),
|
|
68
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
70
69
|
rest
|
|
71
70
|
]);
|
|
71
|
+
innerLen = Buffer.alloc(4);
|
|
72
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
73
|
+
instructionData = Buffer.concat([
|
|
74
|
+
Buffer.from([0]),
|
|
75
|
+
innerLen,
|
|
76
|
+
innerData
|
|
77
|
+
]);
|
|
72
78
|
feeDistributorPda = (0, helpers_js_1.getFeeDistributorPda)();
|
|
73
79
|
instruction = new web3_js_1.TransactionInstruction({
|
|
74
80
|
keys: [
|
|
@@ -81,6 +87,11 @@ function createFile(fsid, path, name, wallet) {
|
|
|
81
87
|
pubkey: feeDistributorPda.pda,
|
|
82
88
|
isSigner: false,
|
|
83
89
|
isWritable: true
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
93
|
+
isSigner: false,
|
|
94
|
+
isWritable: false
|
|
84
95
|
}
|
|
85
96
|
],
|
|
86
97
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/move.js
CHANGED
|
@@ -59,19 +59,25 @@ var helpers_1 = require("./helpers");
|
|
|
59
59
|
*/
|
|
60
60
|
function move(fsid, srcPath, destPath, name, wallet) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var rest, instructionData, feeDistributorPda, instruction, tx;
|
|
62
|
+
var rest, innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
63
63
|
return __generator(this, function (_a) {
|
|
64
64
|
// Validate path: only letters, numbers, and /
|
|
65
65
|
(0, sanitizePath_1.sanitizePath)(srcPath);
|
|
66
66
|
(0, sanitizePath_1.sanitizePath)(destPath);
|
|
67
67
|
(0, sanitizePath_1.sanitizePath)(name);
|
|
68
68
|
rest = Buffer.from("".concat(srcPath, "\0").concat(destPath, "\0").concat(name), 'utf-8');
|
|
69
|
-
|
|
70
|
-
Buffer.from(
|
|
71
|
-
Buffer.from(
|
|
72
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(fsid).toArray('le', 8))),
|
|
69
|
+
innerData = Buffer.concat([
|
|
70
|
+
Buffer.from([13]),
|
|
71
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
73
72
|
rest
|
|
74
73
|
]);
|
|
74
|
+
innerLen = Buffer.alloc(4);
|
|
75
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
76
|
+
instructionData = Buffer.concat([
|
|
77
|
+
Buffer.from([0]),
|
|
78
|
+
innerLen,
|
|
79
|
+
innerData
|
|
80
|
+
]);
|
|
75
81
|
feeDistributorPda = (0, helpers_1.getFeeDistributorPda)();
|
|
76
82
|
instruction = new web3_js_1.TransactionInstruction({
|
|
77
83
|
keys: [
|
|
@@ -84,6 +90,11 @@ function move(fsid, srcPath, destPath, name, wallet) {
|
|
|
84
90
|
pubkey: feeDistributorPda.pda,
|
|
85
91
|
isSigner: false,
|
|
86
92
|
isWritable: true
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
96
|
+
isSigner: false,
|
|
97
|
+
isWritable: false
|
|
87
98
|
}
|
|
88
99
|
],
|
|
89
100
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/peek.js
CHANGED
|
@@ -60,18 +60,24 @@ var helpers_1 = require("./helpers");
|
|
|
60
60
|
*/
|
|
61
61
|
function peek(fsid, path, startPosition, endPosition, wallet) {
|
|
62
62
|
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var rest, instructionData, feeDistributorPda, instruction, tx;
|
|
63
|
+
var rest, innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
64
64
|
return __generator(this, function (_a) {
|
|
65
65
|
(0, sanitizePath_1.sanitizePath)(path);
|
|
66
66
|
rest = Buffer.from("".concat(path), 'utf-8');
|
|
67
|
-
|
|
68
|
-
Buffer.from(
|
|
69
|
-
Buffer.from(
|
|
70
|
-
Buffer.from(
|
|
71
|
-
Buffer.from(
|
|
72
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(endPosition).toArray('le', 8))),
|
|
67
|
+
innerData = Buffer.concat([
|
|
68
|
+
Buffer.from([3]),
|
|
69
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
70
|
+
Buffer.from(new bn_js_1.default(startPosition).toArray('le', 8)),
|
|
71
|
+
Buffer.from(new bn_js_1.default(endPosition).toArray('le', 8)),
|
|
73
72
|
rest
|
|
74
73
|
]);
|
|
74
|
+
innerLen = Buffer.alloc(4);
|
|
75
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
76
|
+
instructionData = Buffer.concat([
|
|
77
|
+
Buffer.from([0]),
|
|
78
|
+
innerLen,
|
|
79
|
+
innerData
|
|
80
|
+
]);
|
|
75
81
|
feeDistributorPda = (0, helpers_1.getFeeDistributorPda)();
|
|
76
82
|
instruction = new web3_js_1.TransactionInstruction({
|
|
77
83
|
keys: [
|
|
@@ -84,6 +90,11 @@ function peek(fsid, path, startPosition, endPosition, wallet) {
|
|
|
84
90
|
pubkey: feeDistributorPda.pda,
|
|
85
91
|
isSigner: false,
|
|
86
92
|
isWritable: true
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
96
|
+
isSigner: false,
|
|
97
|
+
isWritable: false
|
|
87
98
|
}
|
|
88
99
|
],
|
|
89
100
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/poke.js
CHANGED
|
@@ -59,19 +59,25 @@ var helpers_1 = require("./helpers");
|
|
|
59
59
|
*/
|
|
60
60
|
function poke(fsid, path, position, wallet, dataKey) {
|
|
61
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
-
var pathBuffer, pathLengthBuffer, instructionData, feeDistributorPda, instruction, tx;
|
|
62
|
+
var pathBuffer, pathLengthBuffer, innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
63
63
|
return __generator(this, function (_a) {
|
|
64
64
|
(0, sanitizePath_1.sanitizePath)(path);
|
|
65
65
|
pathBuffer = Buffer.from(path, 'utf-8');
|
|
66
|
-
pathLengthBuffer = Buffer.from(
|
|
67
|
-
|
|
68
|
-
Buffer.from(
|
|
69
|
-
Buffer.from(
|
|
70
|
-
Buffer.from(
|
|
71
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(position).toArray('le', 8))),
|
|
66
|
+
pathLengthBuffer = Buffer.from(new bn_js_1.default(pathBuffer.length).toArray('le', 8));
|
|
67
|
+
innerData = Buffer.concat([
|
|
68
|
+
Buffer.from([4]),
|
|
69
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
70
|
+
Buffer.from(new bn_js_1.default(position).toArray('le', 8)),
|
|
72
71
|
pathLengthBuffer,
|
|
73
72
|
pathBuffer
|
|
74
73
|
]);
|
|
74
|
+
innerLen = Buffer.alloc(4);
|
|
75
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
76
|
+
instructionData = Buffer.concat([
|
|
77
|
+
Buffer.from([0]),
|
|
78
|
+
innerLen,
|
|
79
|
+
innerData
|
|
80
|
+
]);
|
|
75
81
|
feeDistributorPda = (0, helpers_1.getFeeDistributorPda)();
|
|
76
82
|
instruction = new web3_js_1.TransactionInstruction({
|
|
77
83
|
keys: [
|
|
@@ -89,6 +95,11 @@ function poke(fsid, path, position, wallet, dataKey) {
|
|
|
89
95
|
pubkey: feeDistributorPda.pda,
|
|
90
96
|
isSigner: false,
|
|
91
97
|
isWritable: true
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
101
|
+
isSigner: false,
|
|
102
|
+
isWritable: false
|
|
92
103
|
}
|
|
93
104
|
],
|
|
94
105
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/removeDirectory.js
CHANGED
|
@@ -57,15 +57,21 @@ var helpers_1 = require("./helpers");
|
|
|
57
57
|
*/
|
|
58
58
|
function removeDirectory(fsid, path, wallet) {
|
|
59
59
|
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
-
var instructionData, feeDistributorPda, instruction, tx;
|
|
60
|
+
var innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
62
|
(0, sanitizePath_1.sanitizePath)(path);
|
|
63
|
-
|
|
64
|
-
Buffer.from(
|
|
65
|
-
Buffer.from(
|
|
66
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(fsid).toArray('le', 8))),
|
|
63
|
+
innerData = Buffer.concat([
|
|
64
|
+
Buffer.from([7]),
|
|
65
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
67
66
|
Buffer.from("".concat(path), 'utf-8')
|
|
68
67
|
]);
|
|
68
|
+
innerLen = Buffer.alloc(4);
|
|
69
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
70
|
+
instructionData = Buffer.concat([
|
|
71
|
+
Buffer.from([0]),
|
|
72
|
+
innerLen,
|
|
73
|
+
innerData
|
|
74
|
+
]);
|
|
69
75
|
feeDistributorPda = (0, helpers_1.getFeeDistributorPda)();
|
|
70
76
|
instruction = new web3_js_1.TransactionInstruction({
|
|
71
77
|
keys: [
|
|
@@ -78,6 +84,11 @@ function removeDirectory(fsid, path, wallet) {
|
|
|
78
84
|
pubkey: feeDistributorPda.pda,
|
|
79
85
|
isSigner: false,
|
|
80
86
|
isWritable: true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
90
|
+
isSigner: false,
|
|
91
|
+
isWritable: false
|
|
81
92
|
}
|
|
82
93
|
],
|
|
83
94
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/removeFile.js
CHANGED
|
@@ -57,15 +57,21 @@ var helpers_1 = require("./helpers");
|
|
|
57
57
|
*/
|
|
58
58
|
function removeFile(fsid, path, wallet) {
|
|
59
59
|
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
-
var instructionData, feeDistributorPda, instruction, tx;
|
|
60
|
+
var innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
62
|
(0, sanitizePath_1.sanitizePath)(path);
|
|
63
|
-
|
|
64
|
-
Buffer.from(
|
|
65
|
-
Buffer.from(
|
|
66
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(fsid).toArray('le', 8))),
|
|
63
|
+
innerData = Buffer.concat([
|
|
64
|
+
Buffer.from([5]),
|
|
65
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
67
66
|
Buffer.from("".concat(path), 'utf-8')
|
|
68
67
|
]);
|
|
68
|
+
innerLen = Buffer.alloc(4);
|
|
69
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
70
|
+
instructionData = Buffer.concat([
|
|
71
|
+
Buffer.from([0]),
|
|
72
|
+
innerLen,
|
|
73
|
+
innerData
|
|
74
|
+
]);
|
|
69
75
|
feeDistributorPda = (0, helpers_1.getFeeDistributorPda)();
|
|
70
76
|
instruction = new web3_js_1.TransactionInstruction({
|
|
71
77
|
keys: [
|
|
@@ -78,6 +84,11 @@ function removeFile(fsid, path, wallet) {
|
|
|
78
84
|
pubkey: feeDistributorPda.pda,
|
|
79
85
|
isSigner: false,
|
|
80
86
|
isWritable: true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
90
|
+
isSigner: false,
|
|
91
|
+
isWritable: false
|
|
81
92
|
}
|
|
82
93
|
],
|
|
83
94
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/dist/renamePath.js
CHANGED
|
@@ -58,17 +58,23 @@ var helpers_1 = require("./helpers");
|
|
|
58
58
|
*/
|
|
59
59
|
function renamePath(fsid, oldPath, name, wallet) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function () {
|
|
61
|
-
var rest, instructionData, feeDistributorPda, instruction, tx;
|
|
61
|
+
var rest, innerData, innerLen, instructionData, feeDistributorPda, instruction, tx;
|
|
62
62
|
return __generator(this, function (_a) {
|
|
63
63
|
(0, sanitizePath_1.sanitizePath)(oldPath);
|
|
64
64
|
(0, sanitizePath_1.sanitizePath)(name);
|
|
65
65
|
rest = Buffer.from("".concat(oldPath, "\0").concat(name), 'utf-8');
|
|
66
|
-
|
|
67
|
-
Buffer.from(
|
|
68
|
-
Buffer.from(
|
|
69
|
-
Buffer.from(Uint8Array.of.apply(Uint8Array, new bn_js_1.default(fsid).toArray('le', 8))),
|
|
66
|
+
innerData = Buffer.concat([
|
|
67
|
+
Buffer.from([8]),
|
|
68
|
+
Buffer.from(new bn_js_1.default(fsid).toArray('le', 8)),
|
|
70
69
|
rest
|
|
71
70
|
]);
|
|
71
|
+
innerLen = Buffer.alloc(4);
|
|
72
|
+
innerLen.writeUInt32LE(innerData.length);
|
|
73
|
+
instructionData = Buffer.concat([
|
|
74
|
+
Buffer.from([0]),
|
|
75
|
+
innerLen,
|
|
76
|
+
innerData
|
|
77
|
+
]);
|
|
72
78
|
feeDistributorPda = (0, helpers_1.getFeeDistributorPda)();
|
|
73
79
|
instruction = new web3_js_1.TransactionInstruction({
|
|
74
80
|
keys: [
|
|
@@ -81,6 +87,11 @@ function renamePath(fsid, oldPath, name, wallet) {
|
|
|
81
87
|
pubkey: feeDistributorPda.pda,
|
|
82
88
|
isSigner: false,
|
|
83
89
|
isWritable: true
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
pubkey: web3_js_1.SystemProgram.programId,
|
|
93
|
+
isSigner: false,
|
|
94
|
+
isWritable: false
|
|
84
95
|
}
|
|
85
96
|
],
|
|
86
97
|
programId: new web3_js_1.PublicKey(const_1.programId),
|
package/package.json
CHANGED
package/src/armageddon.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const.js'
|
|
4
4
|
import { getFeeDistributorPda } from './helpers.js'
|
|
@@ -15,10 +15,20 @@ export async function armageddon (
|
|
|
15
15
|
fsid: string,
|
|
16
16
|
wallet: PublicKey
|
|
17
17
|
): Promise<Transaction> {
|
|
18
|
+
// inner_data: [1u8 (operation), fsid as u64 LE]
|
|
19
|
+
const innerData = Buffer.concat([
|
|
20
|
+
Buffer.from([1]),
|
|
21
|
+
Buffer.from(new BN(fsid).toArray('le', 8))
|
|
22
|
+
])
|
|
23
|
+
|
|
24
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
25
|
+
const innerLen = Buffer.alloc(4)
|
|
26
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
27
|
+
|
|
18
28
|
const instructionData = Buffer.concat([
|
|
19
|
-
Buffer.from(
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
Buffer.from([0]),
|
|
30
|
+
innerLen,
|
|
31
|
+
innerData
|
|
22
32
|
])
|
|
23
33
|
let feeDistributorPda = getFeeDistributorPda()
|
|
24
34
|
|
|
@@ -33,6 +43,11 @@ export async function armageddon (
|
|
|
33
43
|
pubkey: feeDistributorPda.pda,
|
|
34
44
|
isSigner: false,
|
|
35
45
|
isWritable: true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
pubkey: SystemProgram.programId,
|
|
49
|
+
isSigner: false,
|
|
50
|
+
isWritable: false
|
|
36
51
|
}
|
|
37
52
|
],
|
|
38
53
|
programId: new PublicKey(programId),
|
package/src/assignCoowner.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import { programId } from './const'
|
|
3
3
|
import BN from 'bn.js'
|
|
4
4
|
import { getFeeDistributorPda } from './helpers.js'
|
|
@@ -20,12 +20,23 @@ export async function assignCoowner (
|
|
|
20
20
|
wallet: PublicKey
|
|
21
21
|
): Promise<Transaction> {
|
|
22
22
|
const rest = Buffer.from(`${path}\0${coowner.toString()}`, 'utf-8')
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Buffer.from(
|
|
23
|
+
|
|
24
|
+
// inner_data: [14u8 (operation), fsid as u64 LE, path\0coowner]
|
|
25
|
+
const innerData = Buffer.concat([
|
|
26
|
+
Buffer.from([14]),
|
|
27
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
27
28
|
rest
|
|
28
29
|
])
|
|
30
|
+
|
|
31
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
32
|
+
const innerLen = Buffer.alloc(4)
|
|
33
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
34
|
+
|
|
35
|
+
const instructionData = Buffer.concat([
|
|
36
|
+
Buffer.from([0]),
|
|
37
|
+
innerLen,
|
|
38
|
+
innerData
|
|
39
|
+
])
|
|
29
40
|
let feeDistributorPda = getFeeDistributorPda()
|
|
30
41
|
const instruction = new TransactionInstruction({
|
|
31
42
|
keys: [
|
|
@@ -38,6 +49,11 @@ export async function assignCoowner (
|
|
|
38
49
|
pubkey: feeDistributorPda.pda,
|
|
39
50
|
isSigner: false,
|
|
40
51
|
isWritable: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
pubkey: SystemProgram.programId,
|
|
55
|
+
isSigner: false,
|
|
56
|
+
isWritable: false
|
|
41
57
|
}
|
|
42
58
|
],
|
|
43
59
|
programId: new PublicKey(programId),
|
package/src/bigbang.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { getFeeDistributorPda } from './helpers'
|
|
@@ -11,13 +11,11 @@ import { getFeeDistributorPda } from './helpers'
|
|
|
11
11
|
* @returns A Promise that resolves to a Solana `Transaction` object containing the bigbang instruction.
|
|
12
12
|
*/
|
|
13
13
|
export async function bigbang(replica_count:string,wallet: PublicKey): Promise<Transaction> {
|
|
14
|
-
// inner_data: [0u8 (operation), replica as u64 LE (8 bytes)]
|
|
15
14
|
const innerData = Buffer.concat([
|
|
16
15
|
Buffer.from([0]),
|
|
17
16
|
Buffer.from(new BN(replica_count).toArray('le', 8))
|
|
18
17
|
])
|
|
19
18
|
|
|
20
|
-
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
21
19
|
const innerLen = Buffer.alloc(4)
|
|
22
20
|
innerLen.writeUInt32LE(innerData.length)
|
|
23
21
|
|
|
@@ -39,6 +37,11 @@ export async function bigbang(replica_count:string,wallet: PublicKey): Promise<T
|
|
|
39
37
|
pubkey: feeDistributorPda.pda,
|
|
40
38
|
isSigner: false,
|
|
41
39
|
isWritable: true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
pubkey: SystemProgram.programId,
|
|
43
|
+
isSigner: false,
|
|
44
|
+
isWritable: false
|
|
42
45
|
}
|
|
43
46
|
],
|
|
44
47
|
programId: new PublicKey(programId),
|
package/src/copyPath.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -29,12 +29,22 @@ export async function copyPath (
|
|
|
29
29
|
|
|
30
30
|
const rest = Buffer.from(`${srcPath}\0${destPath}`, 'utf-8')
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Buffer.from(
|
|
35
|
-
Buffer.from(
|
|
32
|
+
// inner_data: [9u8 (operation), fsid as u64 LE, paths]
|
|
33
|
+
const innerData = Buffer.concat([
|
|
34
|
+
Buffer.from([9]),
|
|
35
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
36
36
|
rest
|
|
37
37
|
])
|
|
38
|
+
|
|
39
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
40
|
+
const innerLen = Buffer.alloc(4)
|
|
41
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
42
|
+
|
|
43
|
+
const instructionData = Buffer.concat([
|
|
44
|
+
Buffer.from([0]),
|
|
45
|
+
innerLen,
|
|
46
|
+
innerData
|
|
47
|
+
])
|
|
38
48
|
let feeDistributorPda = getFeeDistributorPda()
|
|
39
49
|
const instruction = new TransactionInstruction({
|
|
40
50
|
keys: [
|
|
@@ -47,6 +57,11 @@ export async function copyPath (
|
|
|
47
57
|
pubkey: feeDistributorPda.pda,
|
|
48
58
|
isSigner: false,
|
|
49
59
|
isWritable: true
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
pubkey: SystemProgram.programId,
|
|
63
|
+
isSigner: false,
|
|
64
|
+
isWritable: false
|
|
50
65
|
}
|
|
51
66
|
],
|
|
52
67
|
programId: new PublicKey(programId),
|
package/src/createDirectory.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -25,12 +25,23 @@ export async function createDirectory (
|
|
|
25
25
|
const combinedPath = path.endsWith('/') ? `${path}${name}` : `${path}/${name}`
|
|
26
26
|
sanitizePath(combinedPath)
|
|
27
27
|
const rest = Buffer.from(`${path}\0${name}`, 'utf-8')
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Buffer.from(
|
|
28
|
+
|
|
29
|
+
// inner_data: [6u8 (operation), fsid as u64 LE, paths]
|
|
30
|
+
const innerData = Buffer.concat([
|
|
31
|
+
Buffer.from([6]),
|
|
32
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
32
33
|
rest
|
|
33
34
|
])
|
|
35
|
+
|
|
36
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
37
|
+
const innerLen = Buffer.alloc(4)
|
|
38
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
39
|
+
|
|
40
|
+
const instructionData = Buffer.concat([
|
|
41
|
+
Buffer.from([0]),
|
|
42
|
+
innerLen,
|
|
43
|
+
innerData
|
|
44
|
+
])
|
|
34
45
|
let feeDistributorPda = getFeeDistributorPda()
|
|
35
46
|
const instruction = new TransactionInstruction({
|
|
36
47
|
keys: [
|
|
@@ -43,6 +54,11 @@ export async function createDirectory (
|
|
|
43
54
|
pubkey: feeDistributorPda.pda,
|
|
44
55
|
isSigner: false,
|
|
45
56
|
isWritable: true
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
pubkey: SystemProgram.programId,
|
|
60
|
+
isSigner: false,
|
|
61
|
+
isWritable: false
|
|
46
62
|
}
|
|
47
63
|
],
|
|
48
64
|
programId: new PublicKey(programId),
|
package/src/createFile.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -24,12 +24,23 @@ export async function createFile (
|
|
|
24
24
|
sanitizePath(combinedPath);
|
|
25
25
|
|
|
26
26
|
const rest = Buffer.from(`${path}\0${name}`, 'utf-8')
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
Buffer.from(
|
|
27
|
+
|
|
28
|
+
// inner_data: [2u8 (operation), fsid as u64 LE, paths]
|
|
29
|
+
const innerData = Buffer.concat([
|
|
30
|
+
Buffer.from([2]),
|
|
31
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
31
32
|
rest
|
|
32
33
|
])
|
|
34
|
+
|
|
35
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
36
|
+
const innerLen = Buffer.alloc(4)
|
|
37
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
38
|
+
|
|
39
|
+
const instructionData = Buffer.concat([
|
|
40
|
+
Buffer.from([0]),
|
|
41
|
+
innerLen,
|
|
42
|
+
innerData
|
|
43
|
+
])
|
|
33
44
|
let feeDistributorPda = getFeeDistributorPda()
|
|
34
45
|
const instruction = new TransactionInstruction({
|
|
35
46
|
keys: [
|
|
@@ -42,6 +53,11 @@ export async function createFile (
|
|
|
42
53
|
pubkey: feeDistributorPda.pda,
|
|
43
54
|
isSigner: false,
|
|
44
55
|
isWritable: true
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
pubkey: SystemProgram.programId,
|
|
59
|
+
isSigner: false,
|
|
60
|
+
isWritable: false
|
|
45
61
|
}
|
|
46
62
|
],
|
|
47
63
|
programId: new PublicKey(programId),
|
package/src/move.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -33,12 +33,22 @@ export async function move (
|
|
|
33
33
|
|
|
34
34
|
const rest = Buffer.from(`${srcPath}\0${destPath}\0${name}`, 'utf-8')
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
Buffer.from(
|
|
39
|
-
Buffer.from(
|
|
36
|
+
// inner_data: [13u8 (operation), fsid as u64 LE, paths]
|
|
37
|
+
const innerData = Buffer.concat([
|
|
38
|
+
Buffer.from([13]),
|
|
39
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
40
40
|
rest
|
|
41
41
|
])
|
|
42
|
+
|
|
43
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
44
|
+
const innerLen = Buffer.alloc(4)
|
|
45
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
46
|
+
|
|
47
|
+
const instructionData = Buffer.concat([
|
|
48
|
+
Buffer.from([0]),
|
|
49
|
+
innerLen,
|
|
50
|
+
innerData
|
|
51
|
+
])
|
|
42
52
|
let feeDistributorPda = getFeeDistributorPda()
|
|
43
53
|
const instruction = new TransactionInstruction({
|
|
44
54
|
keys: [
|
|
@@ -51,6 +61,11 @@ export async function move (
|
|
|
51
61
|
pubkey: feeDistributorPda.pda,
|
|
52
62
|
isSigner: false,
|
|
53
63
|
isWritable: true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
pubkey: SystemProgram.programId,
|
|
67
|
+
isSigner: false,
|
|
68
|
+
isWritable: false
|
|
54
69
|
}
|
|
55
70
|
],
|
|
56
71
|
programId: new PublicKey(programId),
|
package/src/peek.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -28,14 +28,25 @@ export async function peek (
|
|
|
28
28
|
sanitizePath(path)
|
|
29
29
|
|
|
30
30
|
const rest = Buffer.from(`${path}`, 'utf-8')
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Buffer.from(
|
|
35
|
-
Buffer.from(
|
|
36
|
-
Buffer.from(
|
|
31
|
+
|
|
32
|
+
// inner_data: [3u8 (operation), fsid as u64 LE, startPosition as u64 LE, endPosition as u64 LE, path]
|
|
33
|
+
const innerData = Buffer.concat([
|
|
34
|
+
Buffer.from([3]),
|
|
35
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
36
|
+
Buffer.from(new BN(startPosition).toArray('le', 8)),
|
|
37
|
+
Buffer.from(new BN(endPosition).toArray('le', 8)),
|
|
37
38
|
rest
|
|
38
39
|
])
|
|
40
|
+
|
|
41
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
42
|
+
const innerLen = Buffer.alloc(4)
|
|
43
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
44
|
+
|
|
45
|
+
const instructionData = Buffer.concat([
|
|
46
|
+
Buffer.from([0]),
|
|
47
|
+
innerLen,
|
|
48
|
+
innerData
|
|
49
|
+
])
|
|
39
50
|
let feeDistributorPda = getFeeDistributorPda()
|
|
40
51
|
const instruction = new TransactionInstruction({
|
|
41
52
|
keys: [
|
|
@@ -48,6 +59,11 @@ export async function peek (
|
|
|
48
59
|
pubkey: feeDistributorPda.pda,
|
|
49
60
|
isSigner: false,
|
|
50
61
|
isWritable: true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
pubkey: SystemProgram.programId,
|
|
65
|
+
isSigner: false,
|
|
66
|
+
isWritable: false
|
|
51
67
|
}
|
|
52
68
|
],
|
|
53
69
|
programId: new PublicKey(programId),
|
package/src/poke.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -29,15 +29,26 @@ export async function poke (
|
|
|
29
29
|
// Encode the path as UTF-8
|
|
30
30
|
const pathBuffer = Buffer.from(path, 'utf-8')
|
|
31
31
|
// Encode the path length as an 8-byte little-endian unsigned integer
|
|
32
|
-
const pathLengthBuffer = Buffer.from(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
Buffer.from(
|
|
37
|
-
Buffer.from(
|
|
32
|
+
const pathLengthBuffer = Buffer.from(new BN(pathBuffer.length).toArray('le', 8))
|
|
33
|
+
|
|
34
|
+
// inner_data: [4u8 (operation), fsid as u64 LE, position as u64 LE, pathLength as u64 LE, path]
|
|
35
|
+
const innerData = Buffer.concat([
|
|
36
|
+
Buffer.from([4]),
|
|
37
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
38
|
+
Buffer.from(new BN(position).toArray('le', 8)),
|
|
38
39
|
pathLengthBuffer,
|
|
39
40
|
pathBuffer
|
|
40
41
|
])
|
|
42
|
+
|
|
43
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
44
|
+
const innerLen = Buffer.alloc(4)
|
|
45
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
46
|
+
|
|
47
|
+
const instructionData = Buffer.concat([
|
|
48
|
+
Buffer.from([0]),
|
|
49
|
+
innerLen,
|
|
50
|
+
innerData
|
|
51
|
+
])
|
|
41
52
|
let feeDistributorPda = getFeeDistributorPda()
|
|
42
53
|
const instruction = new TransactionInstruction({
|
|
43
54
|
keys: [
|
|
@@ -55,6 +66,11 @@ export async function poke (
|
|
|
55
66
|
pubkey: feeDistributorPda.pda,
|
|
56
67
|
isSigner: false,
|
|
57
68
|
isWritable: true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
pubkey: SystemProgram.programId,
|
|
72
|
+
isSigner: false,
|
|
73
|
+
isWritable: false
|
|
58
74
|
}
|
|
59
75
|
],
|
|
60
76
|
programId: new PublicKey(programId),
|
package/src/removeDirectory.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -20,12 +20,22 @@ export async function removeDirectory (
|
|
|
20
20
|
wallet: PublicKey
|
|
21
21
|
): Promise<Transaction> {
|
|
22
22
|
sanitizePath(path)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Buffer.from(
|
|
26
|
-
Buffer.from(
|
|
23
|
+
// inner_data: [7u8 (operation), fsid as u64 LE, path]
|
|
24
|
+
const innerData = Buffer.concat([
|
|
25
|
+
Buffer.from([7]),
|
|
26
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
27
27
|
Buffer.from(`${path}`, 'utf-8')
|
|
28
28
|
])
|
|
29
|
+
|
|
30
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
31
|
+
const innerLen = Buffer.alloc(4)
|
|
32
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
33
|
+
|
|
34
|
+
const instructionData = Buffer.concat([
|
|
35
|
+
Buffer.from([0]),
|
|
36
|
+
innerLen,
|
|
37
|
+
innerData
|
|
38
|
+
])
|
|
29
39
|
let feeDistributorPda = getFeeDistributorPda()
|
|
30
40
|
const instruction = new TransactionInstruction({
|
|
31
41
|
keys: [
|
|
@@ -38,6 +48,11 @@ export async function removeDirectory (
|
|
|
38
48
|
pubkey: feeDistributorPda.pda,
|
|
39
49
|
isSigner: false,
|
|
40
50
|
isWritable: true
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
pubkey: SystemProgram.programId,
|
|
54
|
+
isSigner: false,
|
|
55
|
+
isWritable: false
|
|
41
56
|
}
|
|
42
57
|
],
|
|
43
58
|
programId: new PublicKey(programId),
|
package/src/removeFile.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -21,12 +21,22 @@ export async function removeFile (
|
|
|
21
21
|
): Promise<Transaction> {
|
|
22
22
|
sanitizePath(path)
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Buffer.from(
|
|
27
|
-
Buffer.from(
|
|
24
|
+
// inner_data: [5u8 (operation), fsid as u64 LE, path]
|
|
25
|
+
const innerData = Buffer.concat([
|
|
26
|
+
Buffer.from([5]),
|
|
27
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
28
28
|
Buffer.from(`${path}`, 'utf-8')
|
|
29
29
|
])
|
|
30
|
+
|
|
31
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
32
|
+
const innerLen = Buffer.alloc(4)
|
|
33
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
34
|
+
|
|
35
|
+
const instructionData = Buffer.concat([
|
|
36
|
+
Buffer.from([0]),
|
|
37
|
+
innerLen,
|
|
38
|
+
innerData
|
|
39
|
+
])
|
|
30
40
|
let feeDistributorPda = getFeeDistributorPda()
|
|
31
41
|
const instruction = new TransactionInstruction({
|
|
32
42
|
keys: [
|
|
@@ -39,6 +49,11 @@ export async function removeFile (
|
|
|
39
49
|
pubkey: feeDistributorPda.pda,
|
|
40
50
|
isSigner: false,
|
|
41
51
|
isWritable: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
pubkey: SystemProgram.programId,
|
|
55
|
+
isSigner: false,
|
|
56
|
+
isWritable: false
|
|
42
57
|
}
|
|
43
58
|
],
|
|
44
59
|
programId: new PublicKey(programId),
|
package/src/renamePath.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
3
|
import { programId } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
@@ -27,12 +27,22 @@ export async function renamePath (
|
|
|
27
27
|
|
|
28
28
|
const rest = Buffer.from(`${oldPath}\0${name}`, 'utf-8')
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
Buffer.from(
|
|
33
|
-
Buffer.from(
|
|
30
|
+
// inner_data: [8u8 (operation), fsid as u64 LE, paths]
|
|
31
|
+
const innerData = Buffer.concat([
|
|
32
|
+
Buffer.from([8]),
|
|
33
|
+
Buffer.from(new BN(fsid).toArray('le', 8)),
|
|
34
34
|
rest
|
|
35
35
|
])
|
|
36
|
+
|
|
37
|
+
// wrap_storage_tx: [0u8, inner_data.len() as u32 LE, inner_data]
|
|
38
|
+
const innerLen = Buffer.alloc(4)
|
|
39
|
+
innerLen.writeUInt32LE(innerData.length)
|
|
40
|
+
|
|
41
|
+
const instructionData = Buffer.concat([
|
|
42
|
+
Buffer.from([0]),
|
|
43
|
+
innerLen,
|
|
44
|
+
innerData
|
|
45
|
+
])
|
|
36
46
|
let feeDistributorPda = getFeeDistributorPda()
|
|
37
47
|
const instruction = new TransactionInstruction({
|
|
38
48
|
keys: [
|
|
@@ -45,6 +55,11 @@ export async function renamePath (
|
|
|
45
55
|
pubkey: feeDistributorPda.pda,
|
|
46
56
|
isSigner: false,
|
|
47
57
|
isWritable: true
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
pubkey: SystemProgram.programId,
|
|
61
|
+
isSigner: false,
|
|
62
|
+
isWritable: false
|
|
48
63
|
}
|
|
49
64
|
],
|
|
50
65
|
programId: new PublicKey(programId),
|