psf-multisig-approval 2.0.1 → 2.0.3
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/index.js +2 -0
- package/lib/nfts.js +8 -1
- package/package.json +1 -1
- package/test/integration/main-index-integration.js +2 -1
- package/test/unit/nfts-unit.js +17 -0
package/index.js
CHANGED
|
@@ -52,8 +52,10 @@ class MultisigApproval {
|
|
|
52
52
|
// console.log('groupTokenId: ', groupTokenId)
|
|
53
53
|
|
|
54
54
|
const nfts = await this.nfts.getNftsFromGroup()
|
|
55
|
+
// console.log('getNftHolderInfo() nfts: ', nfts)
|
|
55
56
|
|
|
56
57
|
const addrs = await this.nfts.getAddrsFromNfts(nfts)
|
|
58
|
+
// console.log('getNftHolderInfo() addrs: ', addrs)
|
|
57
59
|
|
|
58
60
|
const { keys, keysNotFound } = await this.nfts.findKeys(addrs, nfts)
|
|
59
61
|
|
package/lib/nfts.js
CHANGED
|
@@ -40,8 +40,14 @@ class NFTs {
|
|
|
40
40
|
for (let i = 0; i < nfts.length; i++) {
|
|
41
41
|
const thisNft = nfts[i]
|
|
42
42
|
|
|
43
|
+
// console.log('getAddrsFromNfts() this.wallet.bchjs.restURL: ', this.wallet.bchjs.restURL)
|
|
44
|
+
|
|
43
45
|
const nftData = await this.wallet.getTokenData(thisNft, true)
|
|
44
|
-
// console.log('nftData: ', nftData)
|
|
46
|
+
// console.log('getAddrsFromNfts() nftData: ', nftData)
|
|
47
|
+
|
|
48
|
+
if (!nftData.genesisData.nftHolder) {
|
|
49
|
+
throw new Error(`SLP indexer data does not include a holder address for this NFT. nftData: ${JSON.stringify(nftData, null, 2)}`)
|
|
50
|
+
}
|
|
45
51
|
|
|
46
52
|
addrs.push(nftData.genesisData.nftHolder)
|
|
47
53
|
}
|
|
@@ -76,6 +82,7 @@ class NFTs {
|
|
|
76
82
|
const thisAddr = addrs[i]
|
|
77
83
|
const thisNft = nfts[i]
|
|
78
84
|
|
|
85
|
+
// console.log('findKeys() thisAddr: ', thisAddr)
|
|
79
86
|
// console.log('this.wallet: ', this.wallet)
|
|
80
87
|
// console.log('this.wallet.interface: ', this.wallet.interface)
|
|
81
88
|
// console.log('this.wallet.restURL: ', this.wallet.restURL)
|
package/package.json
CHANGED
|
@@ -15,7 +15,8 @@ describe('#psf-multisig-approval', () => {
|
|
|
15
15
|
before(async () => {
|
|
16
16
|
const wallet = new SlpWallet(undefined, {
|
|
17
17
|
interface: 'consumer-api',
|
|
18
|
-
restURL: 'https://bch-consumer-anacortes-wa-usa.fullstackcash.nl'
|
|
18
|
+
// restURL: 'https://bch-consumer-anacortes-wa-usa.fullstackcash.nl'
|
|
19
|
+
restURL: 'https://free-bch.fullstack.cash'
|
|
19
20
|
})
|
|
20
21
|
await wallet.walletInfoPromise
|
|
21
22
|
|
package/test/unit/nfts-unit.js
CHANGED
|
@@ -112,6 +112,23 @@ describe('#NFTs', () => {
|
|
|
112
112
|
assert.include(err.message, 'test error')
|
|
113
113
|
}
|
|
114
114
|
})
|
|
115
|
+
|
|
116
|
+
it('should throw an error if Cash Stack server does not return nftHolder property', async () => {
|
|
117
|
+
try {
|
|
118
|
+
// Mock dependencies and force desired code path.
|
|
119
|
+
sandbox.stub(uut.wallet, 'getTokenData').resolves({
|
|
120
|
+
genesisData: {}
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
const nfts = ['a']
|
|
124
|
+
|
|
125
|
+
await uut.getAddrsFromNfts(nfts)
|
|
126
|
+
|
|
127
|
+
assert.fail('Unexpected code path')
|
|
128
|
+
} catch (err) {
|
|
129
|
+
assert.include(err.message, 'SLP indexer data does not include a holder address for this NFT.')
|
|
130
|
+
}
|
|
131
|
+
})
|
|
115
132
|
})
|
|
116
133
|
|
|
117
134
|
describe('#findKeys', () => {
|