@xandeum/web3.js 1.3.6 → 1.3.7
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 +19 -13
- package/dist/assignCoowner.js +17 -11
- package/dist/bigbang.d.ts +3 -3
- package/dist/bigbang.js +25 -27
- package/dist/const.d.ts +5 -1
- package/dist/const.js +6 -2
- package/dist/copyPath.js +17 -11
- package/dist/createDirectory.d.ts +1 -1
- package/dist/createDirectory.js +18 -12
- package/dist/createFile.js +17 -11
- package/dist/helpers.d.ts +26 -0
- package/dist/helpers.js +44 -0
- package/dist/move.js +15 -9
- package/dist/peek.js +15 -9
- package/dist/poke.d.ts +1 -1
- package/dist/poke.js +16 -10
- package/dist/removeDirectory.js +15 -9
- package/dist/removeFile.js +15 -9
- package/dist/renamePath.js +15 -9
- package/package.json +1 -1
- package/src/armageddon.ts +17 -13
- package/src/assignCoowner.ts +19 -14
- package/src/bigbang.ts +29 -30
- package/src/const.ts +6 -1
- package/src/copyPath.ts +18 -13
- package/src/createDirectory.ts +19 -14
- package/src/createFile.ts +19 -13
- package/src/helpers.ts +48 -1
- package/src/move.ts +18 -13
- package/src/peek.ts +18 -13
- package/src/poke.ts +19 -14
- package/src/removeDirectory.ts +19 -13
- package/src/removeFile.ts +19 -13
- package/src/renamePath.ts +19 -13
package/src/move.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
|
-
import { programId } from './const'
|
|
3
|
+
import { programId, TOKEN_PROGRAM_ID } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
5
|
-
import { getFeeDistributorPda } from './helpers'
|
|
5
|
+
import { getFeeDistributorPda, getAssociatedTokenAddressWithProgramIds, buildInstructionData } from './helpers'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Constructs a Solana transaction to copy a file or directory from one path to another.
|
|
@@ -40,16 +40,11 @@ export async function move (
|
|
|
40
40
|
rest
|
|
41
41
|
])
|
|
42
42
|
|
|
43
|
-
|
|
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
|
-
])
|
|
43
|
+
const instructionData = buildInstructionData(innerData)
|
|
52
44
|
let feeDistributorPda = getFeeDistributorPda()
|
|
45
|
+
const payerAta = getAssociatedTokenAddressWithProgramIds(wallet)
|
|
46
|
+
const feeAta = getAssociatedTokenAddressWithProgramIds(feeDistributorPda.pda)
|
|
47
|
+
|
|
53
48
|
const instruction = new TransactionInstruction({
|
|
54
49
|
keys: [
|
|
55
50
|
{
|
|
@@ -63,7 +58,17 @@ export async function move (
|
|
|
63
58
|
isWritable: true
|
|
64
59
|
},
|
|
65
60
|
{
|
|
66
|
-
pubkey:
|
|
61
|
+
pubkey: payerAta.ata,
|
|
62
|
+
isSigner: false,
|
|
63
|
+
isWritable: true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
pubkey: feeAta.ata,
|
|
67
|
+
isSigner: false,
|
|
68
|
+
isWritable: true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
pubkey: TOKEN_PROGRAM_ID,
|
|
67
72
|
isSigner: false,
|
|
68
73
|
isWritable: false
|
|
69
74
|
}
|
package/src/peek.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
|
-
import { programId } from './const'
|
|
3
|
+
import { programId, TOKEN_PROGRAM_ID } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
5
|
-
import { getFeeDistributorPda } from './helpers'
|
|
5
|
+
import { getFeeDistributorPda, getAssociatedTokenAddressWithProgramIds, buildInstructionData } from './helpers'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Constructs a Solana transaction to perform a "peek" operation on a file within a file system.
|
|
@@ -38,16 +38,11 @@ export async function peek (
|
|
|
38
38
|
rest
|
|
39
39
|
])
|
|
40
40
|
|
|
41
|
-
|
|
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
|
-
])
|
|
41
|
+
const instructionData = buildInstructionData(innerData)
|
|
50
42
|
let feeDistributorPda = getFeeDistributorPda()
|
|
43
|
+
const payerAta = getAssociatedTokenAddressWithProgramIds(wallet)
|
|
44
|
+
const feeAta = getAssociatedTokenAddressWithProgramIds(feeDistributorPda.pda)
|
|
45
|
+
|
|
51
46
|
const instruction = new TransactionInstruction({
|
|
52
47
|
keys: [
|
|
53
48
|
{
|
|
@@ -61,7 +56,17 @@ export async function peek (
|
|
|
61
56
|
isWritable: true
|
|
62
57
|
},
|
|
63
58
|
{
|
|
64
|
-
pubkey:
|
|
59
|
+
pubkey: payerAta.ata,
|
|
60
|
+
isSigner: false,
|
|
61
|
+
isWritable: true
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
pubkey: feeAta.ata,
|
|
65
|
+
isSigner: false,
|
|
66
|
+
isWritable: true
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
pubkey: TOKEN_PROGRAM_ID,
|
|
65
70
|
isSigner: false,
|
|
66
71
|
isWritable: false
|
|
67
72
|
}
|
package/src/poke.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
|
-
import { programId } from './const'
|
|
3
|
+
import { programId, TOKEN_PROGRAM_ID } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
5
|
-
import { getFeeDistributorPda } from './helpers'
|
|
5
|
+
import { getFeeDistributorPda, getAssociatedTokenAddressWithProgramIds, buildInstructionData } from './helpers'
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Constructs a Solana transaction to perform a poke
|
|
8
|
+
* Constructs a Solana transaction to perform a poke operation, which writes data
|
|
9
9
|
* to a file at the specified path and byte position.
|
|
10
10
|
*
|
|
11
11
|
* @param fsid - A stringified integer representing the file system ID where the file resides.
|
|
@@ -40,16 +40,11 @@ export async function poke (
|
|
|
40
40
|
pathBuffer
|
|
41
41
|
])
|
|
42
42
|
|
|
43
|
-
|
|
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
|
-
])
|
|
43
|
+
const instructionData = buildInstructionData(innerData)
|
|
52
44
|
let feeDistributorPda = getFeeDistributorPda()
|
|
45
|
+
const payerAta = getAssociatedTokenAddressWithProgramIds(wallet)
|
|
46
|
+
const feeAta = getAssociatedTokenAddressWithProgramIds(feeDistributorPda.pda)
|
|
47
|
+
|
|
53
48
|
const instruction = new TransactionInstruction({
|
|
54
49
|
keys: [
|
|
55
50
|
{
|
|
@@ -68,7 +63,17 @@ export async function poke (
|
|
|
68
63
|
isWritable: true
|
|
69
64
|
},
|
|
70
65
|
{
|
|
71
|
-
pubkey:
|
|
66
|
+
pubkey: payerAta.ata,
|
|
67
|
+
isSigner: false,
|
|
68
|
+
isWritable: true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
pubkey: feeAta.ata,
|
|
72
|
+
isSigner: false,
|
|
73
|
+
isWritable: true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
pubkey: TOKEN_PROGRAM_ID,
|
|
72
77
|
isSigner: false,
|
|
73
78
|
isWritable: false
|
|
74
79
|
}
|
package/src/removeDirectory.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
|
-
import { programId } from './const'
|
|
3
|
+
import { programId, TOKEN_PROGRAM_ID } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
5
|
-
import { getFeeDistributorPda } from './helpers'
|
|
5
|
+
import { getFeeDistributorPda, getAssociatedTokenAddressWithProgramIds, buildInstructionData } from './helpers'
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Constructs a Solana transaction to perform a "remove directory" operation
|
|
8
9
|
* in a file system, identified by a file system ID (`fsid`).
|
|
@@ -27,16 +28,11 @@ export async function removeDirectory (
|
|
|
27
28
|
Buffer.from(`${path}`, 'utf-8')
|
|
28
29
|
])
|
|
29
30
|
|
|
30
|
-
|
|
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
|
-
])
|
|
31
|
+
const instructionData = buildInstructionData(innerData)
|
|
39
32
|
let feeDistributorPda = getFeeDistributorPda()
|
|
33
|
+
const payerAta = getAssociatedTokenAddressWithProgramIds(wallet)
|
|
34
|
+
const feeAta = getAssociatedTokenAddressWithProgramIds(feeDistributorPda.pda)
|
|
35
|
+
|
|
40
36
|
const instruction = new TransactionInstruction({
|
|
41
37
|
keys: [
|
|
42
38
|
{
|
|
@@ -50,7 +46,17 @@ export async function removeDirectory (
|
|
|
50
46
|
isWritable: true
|
|
51
47
|
},
|
|
52
48
|
{
|
|
53
|
-
pubkey:
|
|
49
|
+
pubkey: payerAta.ata,
|
|
50
|
+
isSigner: false,
|
|
51
|
+
isWritable: true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
pubkey: feeAta.ata,
|
|
55
|
+
isSigner: false,
|
|
56
|
+
isWritable: true
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
pubkey: TOKEN_PROGRAM_ID,
|
|
54
60
|
isSigner: false,
|
|
55
61
|
isWritable: false
|
|
56
62
|
}
|
package/src/removeFile.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
|
-
import { programId } from './const'
|
|
3
|
+
import { programId, TOKEN_PROGRAM_ID } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
5
|
-
import { getFeeDistributorPda } from './helpers'
|
|
5
|
+
import { getFeeDistributorPda, getAssociatedTokenAddressWithProgramIds, buildInstructionData } from './helpers'
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Constructs a Solana transaction to remove a file from a file system,
|
|
8
9
|
* identified by a file system ID (`fsid`) and a UTF-8 encoded file path.
|
|
@@ -28,16 +29,11 @@ export async function removeFile (
|
|
|
28
29
|
Buffer.from(`${path}`, 'utf-8')
|
|
29
30
|
])
|
|
30
31
|
|
|
31
|
-
|
|
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
|
-
])
|
|
32
|
+
const instructionData = buildInstructionData(innerData)
|
|
40
33
|
let feeDistributorPda = getFeeDistributorPda()
|
|
34
|
+
const payerAta = getAssociatedTokenAddressWithProgramIds(wallet)
|
|
35
|
+
const feeAta = getAssociatedTokenAddressWithProgramIds(feeDistributorPda.pda)
|
|
36
|
+
|
|
41
37
|
const instruction = new TransactionInstruction({
|
|
42
38
|
keys: [
|
|
43
39
|
{
|
|
@@ -51,7 +47,17 @@ export async function removeFile (
|
|
|
51
47
|
isWritable: true
|
|
52
48
|
},
|
|
53
49
|
{
|
|
54
|
-
pubkey:
|
|
50
|
+
pubkey: payerAta.ata,
|
|
51
|
+
isSigner: false,
|
|
52
|
+
isWritable: true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
pubkey: feeAta.ata,
|
|
56
|
+
isSigner: false,
|
|
57
|
+
isWritable: true
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
pubkey: TOKEN_PROGRAM_ID,
|
|
55
61
|
isSigner: false,
|
|
56
62
|
isWritable: false
|
|
57
63
|
}
|
package/src/renamePath.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Transaction, TransactionInstruction, PublicKey
|
|
1
|
+
import { Transaction, TransactionInstruction, PublicKey } from '@solana/web3.js'
|
|
2
2
|
import BN from 'bn.js'
|
|
3
|
-
import { programId } from './const'
|
|
3
|
+
import { programId, TOKEN_PROGRAM_ID } from './const'
|
|
4
4
|
import { sanitizePath } from './sanitizePath'
|
|
5
|
-
import { getFeeDistributorPda } from './helpers'
|
|
5
|
+
import { getFeeDistributorPda, getAssociatedTokenAddressWithProgramIds, buildInstructionData } from './helpers'
|
|
6
|
+
|
|
6
7
|
/**
|
|
7
8
|
* Constructs a Solana transaction to rename (or move) a file or directory
|
|
8
9
|
* within a file system, based on a provided file system ID (`fsid`).
|
|
@@ -34,16 +35,11 @@ export async function renamePath (
|
|
|
34
35
|
rest
|
|
35
36
|
])
|
|
36
37
|
|
|
37
|
-
|
|
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
|
-
])
|
|
38
|
+
const instructionData = buildInstructionData(innerData)
|
|
46
39
|
let feeDistributorPda = getFeeDistributorPda()
|
|
40
|
+
const payerAta = getAssociatedTokenAddressWithProgramIds(wallet)
|
|
41
|
+
const feeAta = getAssociatedTokenAddressWithProgramIds(feeDistributorPda.pda)
|
|
42
|
+
|
|
47
43
|
const instruction = new TransactionInstruction({
|
|
48
44
|
keys: [
|
|
49
45
|
{
|
|
@@ -57,7 +53,17 @@ export async function renamePath (
|
|
|
57
53
|
isWritable: true
|
|
58
54
|
},
|
|
59
55
|
{
|
|
60
|
-
pubkey:
|
|
56
|
+
pubkey: payerAta.ata,
|
|
57
|
+
isSigner: false,
|
|
58
|
+
isWritable: true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
pubkey: feeAta.ata,
|
|
62
|
+
isSigner: false,
|
|
63
|
+
isWritable: true
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
pubkey: TOKEN_PROGRAM_ID,
|
|
61
67
|
isSigner: false,
|
|
62
68
|
isWritable: false
|
|
63
69
|
}
|