@project-serum/anchor
Advanced tools
Comparing version 0.4.3 to 0.4.4
@@ -278,3 +278,15 @@ "use strict"; | ||
return IdlCoder.typeDefLayout(filtered[0], types, fieldName); | ||
// @ts-ignore | ||
} | ||
else if (field.type.array) { | ||
// @ts-ignore | ||
let arrayTy = field.type.array[0]; | ||
// @ts-ignore | ||
let arrayLen = field.type.array[1]; | ||
let innerLayout = IdlCoder.fieldLayout({ | ||
name: undefined, | ||
type: arrayTy, | ||
}, types); | ||
return borsh.array(innerLayout, arrayLen, fieldName); | ||
} | ||
else { | ||
@@ -388,2 +400,11 @@ throw new Error(`Not yet implemented: ${field}`); | ||
} | ||
// @ts-ignore | ||
if (ty.array !== undefined) { | ||
// @ts-ignore | ||
let arrayTy = ty.array[0]; | ||
// @ts-ignore | ||
let arraySize = ty.array[1]; | ||
// @ts-ignore | ||
return typeSize(idl, arrayTy) * arraySize; | ||
} | ||
throw new Error(`Invalid type ${JSON.stringify(ty)}`); | ||
@@ -390,0 +411,0 @@ } |
@@ -252,3 +252,15 @@ import camelCase from "camelcase"; | ||
return IdlCoder.typeDefLayout(filtered[0], types, fieldName); | ||
// @ts-ignore | ||
} | ||
else if (field.type.array) { | ||
// @ts-ignore | ||
let arrayTy = field.type.array[0]; | ||
// @ts-ignore | ||
let arrayLen = field.type.array[1]; | ||
let innerLayout = IdlCoder.fieldLayout({ | ||
name: undefined, | ||
type: arrayTy, | ||
}, types); | ||
return borsh.array(innerLayout, arrayLen, fieldName); | ||
} | ||
else { | ||
@@ -359,2 +371,11 @@ throw new Error(`Not yet implemented: ${field}`); | ||
} | ||
// @ts-ignore | ||
if (ty.array !== undefined) { | ||
// @ts-ignore | ||
let arrayTy = ty.array[0]; | ||
// @ts-ignore | ||
let arraySize = ty.array[1]; | ||
// @ts-ignore | ||
return typeSize(idl, arrayTy) * arraySize; | ||
} | ||
throw new Error(`Invalid type ${JSON.stringify(ty)}`); | ||
@@ -361,0 +382,0 @@ } |
{ | ||
"name": "@project-serum/anchor", | ||
"version": "0.4.3", | ||
"version": "0.4.4", | ||
"description": "Anchor client", | ||
@@ -23,3 +23,3 @@ "main": "dist/cjs/index.js", | ||
"dependencies": { | ||
"@project-serum/borsh": "^0.1.0", | ||
"@project-serum/borsh": "^0.1.1", | ||
"@solana/web3.js": "^1.2.0", | ||
@@ -26,0 +26,0 @@ "@types/bn.js": "^4.11.6", |
import camelCase from "camelcase"; | ||
import { snakeCase } from "snake-case"; | ||
import { Layout } from "buffer-layout"; | ||
import { Layout, seq } from "buffer-layout"; | ||
import * as sha256 from "js-sha256"; | ||
@@ -352,2 +352,16 @@ import * as borsh from "@project-serum/borsh"; | ||
return IdlCoder.typeDefLayout(filtered[0], types, fieldName); | ||
// @ts-ignore | ||
} else if (field.type.array) { | ||
// @ts-ignore | ||
let arrayTy = field.type.array[0]; | ||
// @ts-ignore | ||
let arrayLen = field.type.array[1]; | ||
let innerLayout = IdlCoder.fieldLayout( | ||
{ | ||
name: undefined, | ||
type: arrayTy, | ||
}, | ||
types | ||
); | ||
return borsh.array(innerLayout, arrayLen, fieldName); | ||
} else { | ||
@@ -468,2 +482,11 @@ throw new Error(`Not yet implemented: ${field}`); | ||
} | ||
// @ts-ignore | ||
if (ty.array !== undefined) { | ||
// @ts-ignore | ||
let arrayTy = ty.array[0]; | ||
// @ts-ignore | ||
let arraySize = ty.array[1]; | ||
// @ts-ignore | ||
return typeSize(idl, arrayTy) * arraySize; | ||
} | ||
throw new Error(`Invalid type ${JSON.stringify(ty)}`); | ||
@@ -470,0 +493,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
483751
5217
Updated@project-serum/borsh@^0.1.1