Skip to content

Instantly share code, notes, and snippets.

@saltyskip
Last active December 7, 2020 07:52
Show Gist options
  • Save saltyskip/140bfdd1a2fb17f9cce87eeb46846551 to your computer and use it in GitHub Desktop.
Save saltyskip/140bfdd1a2fb17f9cce87eeb46846551 to your computer and use it in GitHub Desktop.
JP mnemonic tests
func testJPMnemonic1() throws {
let mnemonic = ["ふうとう", "いがく", "はんろん", "よそう", "たまご", "にちじょう", "かんけい", "いだい", "だんねつ", "くなん", "れいせい", "すきま"]
let wallet = BcomWallet(mnemonic: mnemonic, chain: .bitcoin)
let address = BlockchainAddressGenerator.shared.getDefaultBlockchainAddress(from: wallet, x: 0, y: 0, chain: BcomBlockchain.bitcoin)
XCTAssertEqual(address, "15wZ1znjcz48MDjSgzasvzJBiSyLn8cqZ4")
let xPub = wallet.getExtendedPubKey(for: .bitcoin)
XCTAssertEqual(xPub, "xpub6D9oYGG8TsHWBxYaGMQPyMq7o7xyv6kvqUozhzTGnHgA9gY4WYdPdQJt2WWCUBP3iYW8xs4pymVhJAhR7Mdi7qbTbP2in2FFV7kHcSJdXgv")
}
func testJPMnemonic2() throws {
let mnemonic2 = ["こおり", "ねんまつ", "いわい", "ばんぐみ", "にんげん", "こんれい", "きかく", "すんぜん", "みなと", "いさん", "よかぜ", "しめい"]
let wallet2 = BcomWallet(mnemonic: mnemonic2, chain: .bitcoin)
let address2 = BlockchainAddressGenerator.shared.getDefaultBlockchainAddress(from: wallet2, x: 0, y: 0, chain: BcomBlockchain.bitcoin)
XCTAssertEqual(address2, "1Lpqy5L7AJb3xu1ZpZKg1djpyrMt3zHksB")
let xPub2 = wallet2.getExtendedPubKey(for: .bitcoin)
XCTAssertEqual(xPub2, "xpub6CYqHJbCzTHJsbWjz7DHyZCgoSBPNtzJMamEcYa3oLFWphNGsaHpQyzML8h9NTtB7oNvrW65pkib1W3mD6jd85a3u5VCdzi8FbcZiKvciRi")
}
func testJPMnemonic3() throws {
let mnemonic3 = ["けらい", "すもう", "こせき", "しはい", "つとめる", "にりんしゃ", "むげん", "はっさん", "せこう", "しゃしん", "けってい", "けぶかい"]
let wallet3 = BcomWallet(mnemonic: mnemonic3, chain: .bitcoin)
let address3 = BlockchainAddressGenerator.shared.getDefaultBlockchainAddress(from: wallet3, x: 0, y: 0, chain: BcomBlockchain.bitcoin)
XCTAssertEqual(address3, "1A5ZD2wSQHn3NR2MrPL3tDXDtJS15UNvgx")
let xPub3 = wallet3.getExtendedPubKey(for: .bitcoin)
XCTAssertEqual(xPub3, "xpub6CmTT1a6JVkHsaTccG9fCbwA1A3SSiJAHrpwjd35RkJSMPuH96rwH6YmmVaoE9BoSGoW5otrH2B9hsgiZP8H69tEiftUpzTSqYFa3X57ZYH")
}
func testJPMnemonic4() throws {
let mnemonic3 = ["くちこみ", "いわう", "きびしい", "むいか", "いふく", "ながい", "わじまし", "せんしゅ", "さつえい", "ねむたい", "はこぶ", "つよい"]
let wallet3 = BcomWallet(mnemonic: mnemonic3, chain: .bitcoin)
let address3 = BlockchainAddressGenerator.shared.getDefaultBlockchainAddress(from: wallet3, x: 0, y: 0, chain: BcomBlockchain.bitcoin)
XCTAssertEqual(address3, "1LHnU1QppWtJfboWbZUdQ1uTJaWnG5tEZ2")
let xPub3 = wallet3.getExtendedPubKey(for: .bitcoin)
XCTAssertEqual(xPub3, "xpub6D3iEmeYDF4ok3Z6wy69M77LjzY8tCGEBAQmrcMVmiNBCcgYaVezCBBtX8XYpctwZpQx8BwSCYSsW7coW9AAs6V8d3JN6yuGCktNGnvaKmJ")
}
func testJPMnemonic5() throws {
let mnemonic5 = ["こうえん", "くせん", "てくび", "いぜん", "かいふく", "ゆらい", "よかぜ", "てまえ", "うれしい", "あんてい", "けろけろ", "おしえる"]
let wallet5 = BcomWallet(mnemonic: mnemonic5, chain: .bitcoin)
let address5 = BlockchainAddressGenerator.shared.getDefaultBlockchainAddress(from: wallet5, x: 0, y: 0, chain: BcomBlockchain.bitcoin)
XCTAssertEqual(address5, "1AREGBvZ7YhDvUt5UDkxG3JHH6igxTawx")
let xPub5 = wallet5.getExtendedPubKey(for: .bitcoin)
XCTAssertEqual(xPub5, "xpub6CwMrZeDsFgX7GuWxPuaFinwNyFXkjxnUwk3dVjvHoModSfok1rzzBkkEPFSvqN3AgF9RjK7cskkwGMPdGE735qj8cX69A3uxyu1iw5WUp4")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment