Skip to content

Commit 0282477

Browse files
authored
Merge pull request #94 from ngdenterprise/neoxp-update
Update `neoxp` to RC3 build and misc. bug fixes
2 parents 2353e69 + 0e638b0 commit 0282477

File tree

5 files changed

+42
-33
lines changed

5 files changed

+42
-33
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
1010

1111
- C# sample contract now provides scaffolding for a ContractUpdate method
1212
- Fixed an issue where hashes were shown in an unintuitive byte order in some contexts
13+
- Updated Neo Express to latest RC3 build
14+
- Allow asset transfers to arbitrary wallets
1315

1416
## [2.1.45] - 2021-05-18
1517

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@
321321
},
322322
"scripts": {
323323
"bundle-nxp": "npm run bundle-nxp-download && npm run bundle-nxp-extract",
324-
"bundle-nxp-download": "shx rm -rf deps/nxp && shx mkdir -p deps/nxp && nwget \"https://github.com/neo-project/neo-express/releases/download/2.0.32-preview/Neo.Express.2.0.32-preview.nupkg\" -O deps/nxp/nxp.nupkg",
324+
"bundle-nxp-download": "shx rm -rf deps/nxp && shx mkdir -p deps/nxp && nwget \"https://github.com/neo-project/neo-express/releases/download/2.0.35-preview/Neo.Express.2.0.35-preview.nupkg\" -O deps/nxp/nxp.nupkg",
325325
"bundle-nxp-extract": "cd deps/nxp && extract-zip nxp.nupkg",
326326
"compile": "npm run compile-ext && npm run compile-panel",
327327
"compile-ext": "webpack --config src/extension/webpack.config.js --mode development",

src/extension/autoComplete.ts

+8-10
Original file line numberDiff line numberDiff line change
@@ -233,21 +233,19 @@ export default class AutoComplete {
233233
for (const contractName of Object.keys(deployedContracts)) {
234234
const deployedContract = deployedContracts[contractName];
235235
const contractHash = deployedContract.hash;
236-
const contractHashReversed = reverseBytes(contractHash);
237-
if (!this.cachedManifests[contractHashReversed]) {
238-
this.cachedManifests[contractHashReversed] =
239-
await NeoExpressIo.contractGet(
240-
this.neoExpress,
241-
connection.blockchainIdentifier,
242-
contractHash
243-
);
236+
if (!this.cachedManifests[contractHash]) {
237+
this.cachedManifests[contractHash] = await NeoExpressIo.contractGet(
238+
this.neoExpress,
239+
connection.blockchainIdentifier,
240+
contractHash
241+
);
244242
}
245243
const manifest = this.cachedManifests[contractHash];
246244
if (manifest) {
247-
newData.contractManifests[contractHashReversed] = manifest;
245+
newData.contractManifests[contractHash] = manifest;
248246
newData.contractManifests[contractName] = manifest;
249247
}
250-
newData.contractNames[contractHashReversed] = contractName;
248+
newData.contractNames[contractHash] = contractName;
251249
}
252250
} catch (e) {
253251
Log.warn(

src/extension/commands/neoExpressCommands.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,11 @@ export default class NeoExpressCommands {
100100
);
101101
NeoExpressCommands.showResult(output);
102102
if (!output.isError) {
103-
const blockchainIdentifier = await BlockchainIdentifier.fromNeoExpressConfig(
104-
context.extensionPath,
105-
configSavePath
106-
);
103+
const blockchainIdentifier =
104+
await BlockchainIdentifier.fromNeoExpressConfig(
105+
context.extensionPath,
106+
configSavePath
107+
);
107108
if (blockchainIdentifier) {
108109
await neoExpressInstanceManager.run(blockchainsTreeDataProvider, {
109110
blockchainIdentifier,
@@ -326,12 +327,17 @@ export default class NeoExpressCommands {
326327
return;
327328
}
328329
let receiver = commandArguments?.receiver;
330+
const CUSTOM_ADDRESS = "(enter an address manually)";
329331
if (!receiver || walletNames.indexOf(receiver) === -1) {
330332
receiver = await IoHelpers.multipleChoice(
331333
`Transfer ${amount} ${asset} from '${sender}' to...`,
332-
...walletNames
334+
...walletNames,
335+
CUSTOM_ADDRESS
333336
);
334337
}
338+
if (receiver === CUSTOM_ADDRESS) {
339+
receiver = await IoHelpers.enterString("Enter the recipients address");
340+
}
335341
if (!receiver) {
336342
return;
337343
}

src/panel/components/tracker/ScriptToken.tsx

+20-17
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,18 @@ export default function ScriptToken({
2525
for (const contractHash of contractHashes) {
2626
const name = autoCompleteData.contractNames[contractHash] || "contract";
2727
const contractHashRaw = contractHash.replace(/^0x/g, "").toLowerCase();
28-
if (token === contractHashRaw) {
29-
return (
28+
if (reverseBytes(token) === contractHashRaw) {
29+
return [
3030
<span title={`Contract:\n ${contractHashRaw}\n (${name})`}>
3131
<strong>
3232
{contractHashRaw.substring(0, 4)}..
3333
{contractHashRaw.substring(contractHashRaw.length - 4)} (
3434
</strong>
3535
<i>{name}</i>
3636
<strong>)</strong>
37-
</span>
38-
);
37+
</span>,
38+
reverseBytes(token),
39+
];
3940
}
4041
}
4142

@@ -45,7 +46,7 @@ export default function ScriptToken({
4546
reverseBytes(token)
4647
);
4748
if (address.startsWith("N")) {
48-
return (
49+
return [
4950
<>
5051
<strong title={token}>
5152
{token.substring(0, 4)}..
@@ -56,8 +57,9 @@ export default function ScriptToken({
5657
addressNames={autoCompleteData.addressNames}
5758
onClick={selectAddress}
5859
/>
59-
</>
60-
);
60+
</>,
61+
token,
62+
];
6163
}
6264
} catch {}
6365
}
@@ -75,7 +77,7 @@ export default function ScriptToken({
7577
printableAscii = printableAscii && c >= 32 && c <= 126;
7678
}
7779
if (printableAscii) {
78-
return (
80+
return [
7981
<span title={`Detected text:\n0x${token} =\n"${asText}"`}>
8082
<strong>
8183
{" "}
@@ -91,8 +93,9 @@ export default function ScriptToken({
9193
</strong>
9294
<i>{asText}</i>
9395
<strong>")</strong>
94-
</span>
95-
);
96+
</span>,
97+
token,
98+
];
9699
}
97100
}
98101
} catch {}
@@ -102,9 +105,9 @@ export default function ScriptToken({
102105
if (
103106
!!token.match(/^([a-f0-9][a-f0-9])+$/i) &&
104107
!isNaN(numericalValue) &&
105-
numericalValue < Math.pow(2, 32)
108+
numericalValue < Math.pow(2, 64)
106109
) {
107-
return (
110+
return [
108111
<span title={`0x${token} = ${numericalValue}`}>
109112
<strong>
110113
{" "}
@@ -120,16 +123,16 @@ export default function ScriptToken({
120123
</strong>
121124
<i>{numericalValue}</i>
122125
<strong>)</strong>
123-
</span>
124-
);
126+
</span>,
127+
token,
128+
];
125129
}
126130
} catch {}
127131

128-
return null;
132+
return [null, token];
129133
};
130134

131-
const unabbreviated = token;
132-
let innerElement = getAbbreviatedElement();
135+
let [innerElement, unabbreviated] = getAbbreviatedElement();
133136
const isAbbreviated = innerElement !== null;
134137
innerElement = innerElement || <>{token}</>;
135138
return (

0 commit comments

Comments
 (0)